本文整理汇总了C++中AbstractClassRep::getParentClass方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractClassRep::getParentClass方法的具体用法?C++ AbstractClassRep::getParentClass怎么用?C++ AbstractClassRep::getParentClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractClassRep
的用法示例。
在下文中一共展示了AbstractClassRep::getParentClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: script_simobject_find
S32 script_simobject_find(const char* classname, const char* name)
{
SimObject *object;
if( Sim::findObject( name, object ) )
{
// if we specified a classname do type checking
if (classname && dStrlen(classname))
{
AbstractClassRep* ocr = object->getClassRep();
while (ocr)
{
if (!dStricmp(ocr->getClassName(), classname))
return object->getId();
ocr = ocr->getParentClass();
}
}
// invalid type
return 0;
}
// didn't find object
return 0;
}
示例2: while
AbstractClassRep *AbstractClassRep::getCommonParent( const AbstractClassRep *otherClass ) const
{
// CodeReview: This may be a noob way of doing it. There may be some kind of
// super-spiffy algorithm to do what the code below does, but this appeared
// to make sense to me, and it is pretty easy to see what it is doing [6/23/2007 Pat]
static VectorPtr<AbstractClassRep *> thisClassHeirarchy;
thisClassHeirarchy.clear();
AbstractClassRep *walk = const_cast<AbstractClassRep *>( this );
while( walk != NULL )
{
thisClassHeirarchy.push_front( walk );
walk = walk->getParentClass();
}
static VectorPtr<AbstractClassRep *> compClassHeirarchy;
compClassHeirarchy.clear();
walk = const_cast<AbstractClassRep *>( otherClass );
while( walk != NULL )
{
compClassHeirarchy.push_front( walk );
walk = walk->getParentClass();
}
// Make sure we only iterate over the list the number of times we can
S32 maxIterations = getMin( compClassHeirarchy.size(), thisClassHeirarchy.size() );
U32 i = 0;
for( ; i < maxIterations; i++ )
{
if( compClassHeirarchy[i] != thisClassHeirarchy[i] )
break;
}
return compClassHeirarchy[i];
}
示例3: findCommonAncestorClass
AbstractClassRep* GuiInspectorGroup::findCommonAncestorClass()
{
AbstractClassRep* classRep = getInspector()->getInspectObject( 0 )->getClassRep();
const U32 numInspectObjects = getInspector()->getNumInspectObjects();
for( U32 i = 1; i < numInspectObjects; ++ i )
{
SimObject* object = getInspector()->getInspectObject( i );
while( !object->getClassRep()->isClass( classRep ) )
{
classRep = classRep->getParentClass();
AssertFatal( classRep, "GuiInspectorGroup::findcommonAncestorClass - Walked above ConsoleObject!" );
}
}
return classRep;
}
示例4: exportNamespaces
//.........这里部分代码省略.........
S32 minArgs = entry->mMinArgs;
S32 maxArgs = entry->mMaxArgs;
if (maxArgs < minArgs)
maxArgs = minArgs;
mXML->setAttribute("name", functionName);
mXML->setAttribute("minArgs", avar("%i", minArgs));
mXML->setAttribute("maxArgs", avar("%i", maxArgs));
const char* usage = "";
if (entry->mUsage && entry->mUsage[0])
usage = entry->mUsage;
mXML->setAttribute("usage", usage);
mXML->setAttribute("package", entry->mPackage ? entry->mPackage : "");
mXML->setAttribute("entryType", avar("%i", entry->mType));
mXML->popElement(); // Entry
}
mXML->popElement(); // Entries
// Fields
mXML->pushNewElement("Fields");
AbstractClassRep *rep = walk->mClassRep;
Vector<U32> classFields;
if (rep)
{
AbstractClassRep *parentRep = rep->getParentClass();
const AbstractClassRep::FieldList& flist = rep->mFieldList;
for(U32 i = 0; i < flist.size(); i++)
{
if (parentRep)
{
if (parentRep->findField(flist[i].pFieldname))
continue;
}
classFields.push_back(i);
}
for(U32 i = 0; i < classFields.size(); i++)
{
U32 index = classFields[i];
char fieldName[256];
dSprintf(fieldName, 256, flist[index].pFieldname);
//consistently name fields
fieldName[0] = dToupper(fieldName[0]);
mXML->pushNewElement("Field");
mXML->setAttribute("name", fieldName);
mXML->setAttribute("type", avar("%i", flist[index].type));
// RD: temporarily deactivated; TypeEnum is no more; need to sync this up
// if (flist[index].type == TypeEnum && flist[index].table && dStrlen(flist[index].table->name))