Base: Add 'getTypeIfDerivedFrom' member function to Type class

This commit is contained in:
marioalexis
2021-09-01 10:10:39 -03:00
committed by wwmayer
parent 82b97374fd
commit 33b2c7d353
3 changed files with 29 additions and 11 deletions

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();
}