本文整理汇总了C++中BaseObject::getTypeName方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseObject::getTypeName方法的具体用法?C++ BaseObject::getTypeName怎么用?C++ BaseObject::getTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseObject
的用法示例。
在下文中一共展示了BaseObject::getTypeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findLinkDestClass
void* Node::findLinkDestClass(const core::objectmodel::BaseClass* destType, const std::string& path, const core::objectmodel::BaseLink* link)
{
std::string pathStr;
if (link)
{
if (!link->parseString(path,&pathStr))
return NULL;
}
else
{
if (!BaseLink::ParseString(path,&pathStr,NULL,this))
return NULL;
}
#ifdef DEBUG_LINK
std::cout << "LINK: Looking for " << destType->className << "<" << destType->templateName << "> " << pathStr << " from Node " << getName() << std::endl;
#endif
std::size_t ppos = 0;
std::size_t psize = pathStr.size();
if (ppos == psize || (ppos == psize-2 && pathStr[ppos] == '[' && pathStr[ppos+1] == ']')) // self-reference
{
#ifdef DEBUG_LINK
std::cout << " self-reference link." << std::endl;
#endif
if (!link || !link->getOwnerBase()) return destType->dynamicCast(this);
return destType->dynamicCast(link->getOwnerBase());
}
Node* node = this;
BaseObject* master = NULL;
bool based = false;
if (ppos < psize && pathStr[ppos] == '[') // relative index in the list of objects
{
if (pathStr[psize-1] != ']')
{
serr << "Invalid index-based path \"" << path << "\"" << sendl;
return NULL;
}
int index = atoi(pathStr.c_str()+ppos+1);
#ifdef DEBUG_LINK
std::cout << " index-based path to " << index << std::endl;
#endif
ObjectReverseIterator it = object.rbegin();
ObjectReverseIterator itend = object.rend();
if (link && link->getOwnerBase())
{
// index from last
Base* b = link->getOwnerBase();
while (it != itend && *it != b)
++it;
}
while (it != itend && index < 0)
{
++it;
++index;
}
if (it == itend)
return NULL;
#ifdef DEBUG_LINK
std::cout << " found " << it->get()->getTypeName() << " " << it->get()->getName() << "." << std::endl;
#endif
return destType->dynamicCast(it->get());
}
else if (ppos < psize && pathStr[ppos] == '/') // absolute path
{
#ifdef DEBUG_LINK
std::cout << " absolute path" << std::endl;
#endif
node = dynamic_cast<Node*>(this->getRoot());
if (!node) return NULL;
++ppos;
based = true;
}
while(ppos < psize)
{
if ((ppos+1 < psize && pathStr.substr(ppos,2) == "./")
|| pathStr.substr(ppos) == ".")
{
// this must be this node
#ifdef DEBUG_LINK
std::cout << " to current node" << std::endl;
#endif
ppos += 2;
based = true;
}
else if ((ppos+2 < psize && pathStr.substr(ppos,3) == "../") // relative
|| pathStr.substr(ppos) == "..")
{
ppos += 3;
if (master)
{
master = master->getMaster();
#ifdef DEBUG_LINK
std::cout << " to master object " << master->getName() << std::endl;
#endif
}
else
{
Parents parents = node->getParents();
if (parents.empty()) return NULL;
node = dynamic_cast<Node*>(parents[0]); // TODO: explore other parents
if (!node) return NULL;
//.........这里部分代码省略.........