- Moved WriteFields into SymbolTable as well.
This commit is contained in:
parent
96631e8808
commit
8dc11317dd
3 changed files with 28 additions and 22 deletions
|
|
@ -265,11 +265,35 @@ PField *PSymbolTable::AddField(FName name, PType *type, uint32_t flags, unsigned
|
|||
return field;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PClass :: WriteFields
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void PSymbolTable::WriteFields(FSerializer &ar, const void *addr, const void *def) const
|
||||
{
|
||||
auto it = MapType::ConstIterator(Symbols);
|
||||
MapType::ConstPair *pair;
|
||||
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
const PField *field = dyn_cast<PField>(pair->Value);
|
||||
// Skip fields without or with native serialization
|
||||
if (field && !(field->Flags & (VARF_Transient | VARF_Meta)))
|
||||
{
|
||||
// todo: handle defaults in WriteValue
|
||||
//auto defp = def == nullptr ? nullptr : (const uint8_t *)def + field->Offset;
|
||||
field->Type->WriteValue(ar, field->SymbolName.GetChars(), (const uint8_t *)addr + field->Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PClass :: ReadFields
|
||||
//
|
||||
// This will need some changes later.
|
||||
//==========================================================================
|
||||
|
||||
bool PSymbolTable::ReadFields(FSerializer &ar, void *addr, const char *TypeName) const
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ struct PSymbolTable
|
|||
PSymbol *AddSymbol (PSymbol *sym);
|
||||
PField *AddField(FName name, PType *type, uint32_t flags, unsigned &Size, unsigned *Align = nullptr);
|
||||
bool ReadFields(FSerializer &ar, void *addr, const char *TypeName) const;
|
||||
void WriteFields(FSerializer &ar, const void *addr, const void *def = nullptr) const;
|
||||
|
||||
// Similar to AddSymbol but always succeeds. Returns the symbol that used
|
||||
// to be in the table with this name, if any.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue