mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 07:22:05 +00:00
- Added NewStruct() function.
This commit is contained in:
parent
0ec33191aa
commit
7e24f6b00c
2 changed files with 46 additions and 0 deletions
|
@ -899,6 +899,27 @@ PMap *NewMap(PType *keytype, PType *valuetype)
|
|||
|
||||
IMPLEMENT_CLASS(PStruct)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStruct - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PStruct::PStruct()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStruct - Parameterized Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PStruct::PStruct(FName name, DObject *outer)
|
||||
: PNamedType(name, outer)
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStruct :: PropagateMark
|
||||
|
@ -915,6 +936,26 @@ size_t PStruct::PropagateMark()
|
|||
return marked + Super::PropagateMark();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// NewStruct
|
||||
// Returns a PStruct for the given name and container, making sure not to
|
||||
// create duplicates.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PStruct *NewStruct(FName name, DObject *outer)
|
||||
{
|
||||
size_t bucket;
|
||||
PType *stype = TypeTable.FindType(RUNTIME_CLASS(PStruct), (intptr_t)outer, (intptr_t)name, &bucket);
|
||||
if (stype == NULL)
|
||||
{
|
||||
stype = new PStruct(name, outer);
|
||||
TypeTable.AddType(stype, RUNTIME_CLASS(PStruct), (intptr_t)outer, (intptr_t)name, bucket);
|
||||
}
|
||||
return static_cast<PStruct *>(stype);
|
||||
}
|
||||
|
||||
/* PPrototype *************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PPrototype)
|
||||
|
|
|
@ -412,10 +412,14 @@ class PStruct : public PNamedType
|
|||
{
|
||||
DECLARE_CLASS(PStruct, PNamedType);
|
||||
public:
|
||||
PStruct(FName name, DObject *outer);
|
||||
|
||||
TArray<PField *> Fields;
|
||||
PSymbolTable Symbols;
|
||||
|
||||
size_t PropagateMark();
|
||||
protected:
|
||||
PStruct();
|
||||
};
|
||||
|
||||
class PPrototype : public PCompoundType
|
||||
|
@ -585,6 +589,7 @@ PPointer *NewPointer(PType *type);
|
|||
PClassPointer *NewClassPointer(PClass *restrict);
|
||||
PClassWaitingForParent *NewUnknownClass(FName myname, FName parentname);
|
||||
PEnum *NewEnum(FName name, DObject *outer);
|
||||
PStruct *NewStruct(FName name, DObject *outer);
|
||||
|
||||
// Built-in types -----------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue