Add ScriptingTypeHandle::IsSubclassOf
This commit is contained in:
@@ -53,6 +53,19 @@ const ScriptingType& ScriptingTypeHandle::GetType() const
|
|||||||
return Module->Types[TypeIndex];
|
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
|
bool ScriptingTypeHandle::IsAssignableFrom(ScriptingTypeHandle c) const
|
||||||
{
|
{
|
||||||
while (c)
|
while (c)
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ struct FLAXENGINE_API ScriptingTypeHandle
|
|||||||
String ToString(bool withAssembly = false) const;
|
String ToString(bool withAssembly = false) const;
|
||||||
|
|
||||||
const ScriptingType& GetType() const;
|
const ScriptingType& GetType() const;
|
||||||
|
bool IsSubclassOf(ScriptingTypeHandle c) const;
|
||||||
bool IsAssignableFrom(ScriptingTypeHandle c) const;
|
bool IsAssignableFrom(ScriptingTypeHandle c) const;
|
||||||
|
|
||||||
bool operator==(const ScriptingTypeHandle& other) const
|
bool operator==(const ScriptingTypeHandle& other) const
|
||||||
|
|||||||
Reference in New Issue
Block a user