mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
new method from JeffH and Marauder: getClassHierarchy(classname). dumps a list of the class inhericance in reverse ancestor order (so that class first, next parent, *it's* parent, ect
This commit is contained in:
parent
3e131f5b8e
commit
313466f57c
1 changed files with 25 additions and 0 deletions
|
|
@ -3185,6 +3185,31 @@ DefineEngineMethod( SimObject, getField, const char*, ( S32 index ),,
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineFunction(getClassHierarchy, const char*, (const char* name), ,
|
||||||
|
"Returns the inheritance hierarchy for a given class.")
|
||||||
|
{
|
||||||
|
AbstractClassRep* pRep = AbstractClassRep::findClassRep(name);
|
||||||
|
if (!pRep)
|
||||||
|
{
|
||||||
|
//Con::errorf("%s does not exist", name);
|
||||||
|
return StringTable->EmptyString();
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder buffer;
|
||||||
|
|
||||||
|
while (pRep != NULL)
|
||||||
|
{
|
||||||
|
StringTableEntry className = pRep->getClassName();
|
||||||
|
buffer.append(className);
|
||||||
|
buffer.append(" ");
|
||||||
|
pRep = pRep->getParentClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = buffer.end().trim();
|
||||||
|
//Con::printf("getClassHierarchy for %s=%s", name, result.c_str());
|
||||||
|
return Con::getReturnBuffer(result.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef TORQUE_DEBUG
|
#ifdef TORQUE_DEBUG
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue