35 virtual bool Is(
const char* name)
const
54 if (Is(T::ClassRuntimeId()))
71 if (
object && object->
Is(T::ClassRuntimeId()))
79template <
typename T,
typename U>
82 if (
object && object->Is(T::ClassRuntimeId()))
84 return PtrStaticCast<T>(
object);
90template <
typename T,
typename U>
93 if (
object && object->Is(T::ClassRuntimeId()))
95 return PtrStaticCast<T>(
object);
101#define DECLARE_OBJECT(Type, ParentType) \
103 static const char* ClassRuntimeName() { return #Type; } \
104 virtual const char* RuntimeName() const override { return Type::ClassRuntimeName(); } \
105 virtual const char* RuntimeParentName() const override { return ParentType::ClassRuntimeName(); } \
106 static RuntimeId ClassRuntimeId() { return sRuntimeId; } \
107 virtual RuntimeId InstanceRuntimeId() const override { return Type::ClassRuntimeId(); } \
108 virtual Object* QueryInterface(RuntimeId id) const override \
110 if (id == sRuntimeId) \
111 { return (Object*)this; } \
113 { return ParentType::QueryInterface(id); } \
115 virtual bool Is(RuntimeId id) const override \
117 if (id == sRuntimeId) \
120 { return ParentType::Is(id); } \
122 virtual bool Is(const char* name) const override \
124 if (strncmp(name, ClassRuntimeName(), 256) == 0) \
127 { return ParentType::Is(name); } \
130 static RuntimeId sRuntimeId; \
133#define DEFINE_OBJECT(Type) RuntimeId Type::sRuntimeId = reinterpret_cast<RuntimeId>(&Type::sRuntimeId);
uint64_t RuntimeId
Definition EngineTypes.h:67
POLYPHASE_API int CreateClassMetatable(const char *className, const char *classFlag, const char *parentClassName)
T * Cast(Object *object)
Definition Object.h:69
Export macros for Polyphase Engine symbols.
#define POLYPHASE_API
Definition PolyphaseAPI.h:31
#define OCT_UNUSED(var)
Definition Utilities.h:17
virtual bool DrawCustomProperty(Property &prop)
Definition Object.h:46
virtual const char * RuntimeParentName() const =0
virtual ~Object()=default
virtual const char * RuntimeName() const =0
virtual void GatherProperties(std::vector< Property > &props)
Definition Object.h:41
virtual RuntimeId InstanceRuntimeId() const =0
static const char * ClassRuntimeName()
Definition Object.h:21
virtual bool Equals(const Object *rhs) const
Definition Object.h:62
virtual Object * QueryInterface(RuntimeId id) const
Definition Object.h:23
virtual bool Is(RuntimeId id) const
Definition Object.h:29
virtual bool Is(const char *name) const
Definition Object.h:35
T * As() const
Definition Object.h:52
Definition SmartPointer.h:33
Definition SmartPointer.h:312