bool helper_check_hierarchy_for_name(const CSchemaClassBinding& binding, const std::string_view& name) noexcept
{
for (const auto& parent_node : binding.GetParents())
{
if (const auto* parent = parent_node.GetParent(); parent)
{
if (parent->GetName() == name || helper_check_hierarchy_for_name(*parent, name))
return true;
}
}
return false;
}
const CSchemaClassBinding& C_BaseEntity::GetBinding() const
{
const auto* result = CallVFunc<0, CSchemaClassBinding*>();
if (!result)
throw std::runtime_error{ "C_BaseEntity::GetBinding returned nullptr!" };
return *result;
}
bool C_BaseEntity::IsInstanceOfClass(const std::string_view& cls) const
{
const auto& binding = GetBinding();
if (binding.GetName() == cls)
return true;
else
return helper_check_hierarchy_for_name(binding, cls);
return false;
}