mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +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)
|
DECLARE_POINTER(ValueType)
|
||||||
END_POINTERS
|
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 *****************************************************************/
|
/* PArray *****************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_POINTY_CLASS(PArray)
|
IMPLEMENT_POINTY_CLASS(PArray)
|
||||||
|
|
|
@ -224,6 +224,7 @@ public:
|
||||||
FName TypeName; // this type's name
|
FName TypeName; // this type's name
|
||||||
|
|
||||||
PNamedType() : Outer(NULL) {}
|
PNamedType() : Outer(NULL) {}
|
||||||
|
PNamedType(FName name, DObject *outer) : Outer(outer), TypeName(name) {}
|
||||||
|
|
||||||
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
virtual bool IsMatch(intptr_t id1, intptr_t id2) const;
|
||||||
virtual void GetTypeIDs(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);
|
DECLARE_CLASS(PEnum, PNamedType);
|
||||||
HAS_OBJECT_POINTERS;
|
HAS_OBJECT_POINTERS;
|
||||||
public:
|
public:
|
||||||
|
PEnum(FName name, DObject *outer);
|
||||||
|
|
||||||
PType *ValueType;
|
PType *ValueType;
|
||||||
TMap<FName, int> Values;
|
TMap<FName, int> Values;
|
||||||
|
protected:
|
||||||
|
PEnum();
|
||||||
};
|
};
|
||||||
|
|
||||||
class PArray : public PCompoundType
|
class PArray : public PCompoundType
|
||||||
|
@ -579,6 +584,7 @@ PDynArray *NewDynArray(PType *type);
|
||||||
PPointer *NewPointer(PType *type);
|
PPointer *NewPointer(PType *type);
|
||||||
PClassPointer *NewClassPointer(PClass *restrict);
|
PClassPointer *NewClassPointer(PClass *restrict);
|
||||||
PClassWaitingForParent *NewUnknownClass(FName myname, FName parentname);
|
PClassWaitingForParent *NewUnknownClass(FName myname, FName parentname);
|
||||||
|
PEnum *NewEnum(FName name, DObject *outer);
|
||||||
|
|
||||||
// Built-in types -----------------------------------------------------------
|
// Built-in types -----------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue