本文整理汇总了C++中SoType::isInternal方法的典型用法代码示例。如果您正苦于以下问题:C++ SoType::isInternal方法的具体用法?C++ SoType::isInternal怎么用?C++ SoType::isInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoType
的用法示例。
在下文中一共展示了SoType::isInternal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
/*!
This method appends all the class types derived from \a type to \a list,
and returns the number of types added to the list. Internal types are not
included in the list, nor are they counted.
\a type itself is also added to the list, as a type is seen as a derivation
of its own type.
NB: do not write code which depends in any way on the order of the
elements returned in \a list.
Here is a small, stand-alone example which shows how this method can
be used for introspection, listing all subclasses of the SoBase
superclass:
\code
#include <stdio.h>
#include <Inventor/SoDB.h>
#include <Inventor/lists/SoTypeList.h>
static void
list_subtypes(SoType t, unsigned int indent = 0)
{
SoTypeList tl;
SoType::getAllDerivedFrom(t, tl);
for (unsigned int i=0; i < indent; i++) { printf(" "); }
printf("%s\n", t.getName().getString());
indent++;
for (int j=0; j < tl.getLength(); j++) {
if (tl[j].getParent() == t) { // only interested in direct descendents
list_subtypes(tl[j], indent);
}
}
}
int
main(void)
{
SoDB::init();
list_subtypes(SoType::fromName("SoBase"));
return 0;
}
\endcode
*/
int
SoType::getAllDerivedFrom(const SoType type, SoTypeList & list)
{
assert(type != SoType::badType() && "argument is badType()");
int counter = 0;
int n = SoType::typedatalist->getLength();
for (int i = 0; i < n; i++) {
if ((*SoType::typedatalist)[i]) {
SoType chktype = (*SoType::typedatalist)[i]->type;
if (!chktype.isInternal() && chktype.isDerivedFrom(type)) {
list.append(chktype);
counter++;
}
}
}
return counter;
}