Base: Add 'getTypeIfDerivedFrom' member function to Type class

This commit is contained in:
marioalexis
2022-01-19 08:14:41 +01:00
committed by wwmayer
parent fdabaf692b
commit de59bce3b3
3 changed files with 29 additions and 11 deletions
+13
View File
@@ -234,3 +234,16 @@ int Type::getNumTypes(void)
{
return typedata.size();
}
Type Type::getTypeIfDerivedFrom(const char* name , const Type parent, bool bLoadModule)
{
if (bLoadModule)
importModule(name);
Type type = fromName(name);
if (type.isDerivedFrom(parent))
return type;
else
return Type::badType();
}