mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
- Added NewEnum() function.
This commit is contained in:
parent
12a312b6b4
commit
0ec33191aa
2 changed files with 49 additions and 0 deletions
|
@ -568,6 +568,49 @@ IMPLEMENT_POINTY_CLASS(PEnum)
|
|||
DECLARE_POINTER(ValueType)
|
||||
END_POINTERS
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PEnum - Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PEnum::PEnum()
|
||||
: ValueType(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PEnum - Parameterized Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PEnum::PEnum(FName name, DObject *outer)
|
||||
: PNamedType(name, outer), ValueType(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// NewEnum
|
||||
//
|
||||
// Returns a PEnum for the given name and container, making sure not to
|
||||
// create duplicates.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PEnum *NewEnum(FName name, DObject *outer)
|
||||
{
|
||||
size_t bucket;
|
||||
PType *etype = TypeTable.FindType(RUNTIME_CLASS(PEnum), (intptr_t)outer, (intptr_t)name, &bucket);
|
||||
if (etype == NULL)
|
||||
{
|
||||
etype = new PEnum(name, outer);
|
||||
TypeTable.AddType(etype, RUNTIME_CLASS(PEnum), (intptr_t)outer, (intptr_t)name, bucket);
|
||||
}
|
||||
return static_cast<PEnum *>(etype);
|
||||
}
|
||||
|
||||
/* PArray *****************************************************************/
|
||||
|
||||
IMPLEMENT_POINTY_CLASS(PArray)
|
||||
|
|
|
@ -224,6 +224,7 @@ public:
|
|||
FName TypeName; // this type's name
|
||||
|
||||
PNamedType() : Outer(NULL) {}
|
||||
PNamedType(FName name, DObject *outer) : Outer(outer), TypeName(name) {}
|
||||
|
||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const;
|
||||
|
@ -341,8 +342,12 @@ class PEnum : public PNamedType
|
|||
DECLARE_CLASS(PEnum, PNamedType);
|
||||
HAS_OBJECT_POINTERS;
|
||||
public:
|
||||
PEnum(FName name, DObject *outer);
|
||||
|
||||
PType *ValueType;
|
||||
TMap<FName, int> Values;
|
||||
protected:
|
||||
PEnum();
|
||||
};
|
||||
|
||||
class PArray : public PCompoundType
|
||||
|
@ -579,6 +584,7 @@ PDynArray *NewDynArray(PType *type);
|
|||
PPointer *NewPointer(PType *type);
|
||||
PClassPointer *NewClassPointer(PClass *restrict);
|
||||
PClassWaitingForParent *NewUnknownClass(FName myname, FName parentname);
|
||||
PEnum *NewEnum(FName name, DObject *outer);
|
||||
|
||||
// Built-in types -----------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue