- moved AddNativeField to PSymbolTable, too.
This commit is contained in:
parent
8dc11317dd
commit
afd6743965
4 changed files with 36 additions and 27 deletions
|
|
@ -265,6 +265,27 @@ PField *PSymbolTable::AddField(FName name, PType *type, uint32_t flags, unsigned
|
|||
return field;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStruct :: AddField
|
||||
//
|
||||
// Appends a new native field to the struct. Returns either the new field
|
||||
// or nullptr if a symbol by that name already exists.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PField *PSymbolTable::AddNativeField(FName name, PType *type, size_t address, uint32_t flags, int bitvalue)
|
||||
{
|
||||
PField *field = new PField(name, type, flags | VARF_Native | VARF_Transient, address, bitvalue);
|
||||
|
||||
if (AddSymbol(field) == nullptr)
|
||||
{ // name is already in use
|
||||
field->Destroy();
|
||||
return nullptr;
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PClass :: WriteFields
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ struct PSymbolTable
|
|||
// not copied and will be freed when the symbol table is destroyed.
|
||||
PSymbol *AddSymbol (PSymbol *sym);
|
||||
PField *AddField(FName name, PType *type, uint32_t flags, unsigned &Size, unsigned *Align = nullptr);
|
||||
PField *AddNativeField(FName name, PType *type, size_t address, uint32_t flags, int bitvalue);
|
||||
bool ReadFields(FSerializer &ar, void *addr, const char *TypeName) const;
|
||||
void WriteFields(FSerializer &ar, const void *addr, const void *def = nullptr) const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue