Add ScriptingTypeHandle::IsSubclassOf
This commit is contained in:
@@ -53,6 +53,19 @@ const ScriptingType& ScriptingTypeHandle::GetType() const
|
||||
return Module->Types[TypeIndex];
|
||||
}
|
||||
|
||||
bool ScriptingTypeHandle::IsSubclassOf(ScriptingTypeHandle c) const
|
||||
{
|
||||
auto type = *this;
|
||||
if (type == c)
|
||||
return false;
|
||||
for (; type; type = type.GetType().GetBaseType())
|
||||
{
|
||||
if (type == c)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScriptingTypeHandle::IsAssignableFrom(ScriptingTypeHandle c) const
|
||||
{
|
||||
while (c)
|
||||
|
||||
@@ -65,6 +65,7 @@ struct FLAXENGINE_API ScriptingTypeHandle
|
||||
String ToString(bool withAssembly = false) const;
|
||||
|
||||
const ScriptingType& GetType() const;
|
||||
bool IsSubclassOf(ScriptingTypeHandle c) const;
|
||||
bool IsAssignableFrom(ScriptingTypeHandle c) const;
|
||||
|
||||
bool operator==(const ScriptingTypeHandle& other) const
|
||||
|
||||
Reference in New Issue
Block a user