本文整理汇总了C++中TypeNode::getLocalName方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeNode::getLocalName方法的具体用法?C++ TypeNode::getLocalName怎么用?C++ TypeNode::getLocalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeNode
的用法示例。
在下文中一共展示了TypeNode::getLocalName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFullName
void TypeNode::getFullName(std::string& name)
{
std::string localName;
name.clear();
std::vector<TypeNode*> enclosings;
getEnclosings(enclosings);
auto it = enclosings.begin();
auto end = enclosings.end();
for (; it != end; ++it)
{
TypeNode* enclosing = *it;
enclosing->getLocalName(localName);
name += localName + "::";
}
getLocalName(localName);
name += localName;
}
示例2: getRelativeName
void TypeNameNode::getRelativeName(std::string& typeName, ScopeNode* scopeNode)
{
assert(m_startTypeNode && scopeNode);
if (0 == m_scopeNameList)// predefined type
{
m_typeNode->getFullName(typeName);
}
else
{
if (m_typeNode)
{
MemberNode* memberNode = m_typeNode->getSyntaxNode();
if (memberNode && memberNode->m_nativeName)
{
memberNode->getNativeName(typeName, 0);
return;
}
}
if (m_scopeNameList->isGlobal())
{
m_scopeNameList->getString(typeName);
}
else
{
TypeNode* scopeTypeNode = scopeNode->getTypeNode();
std::vector<TypeNode*> enclosings;
m_startTypeNode->getEnclosings(enclosings);
std::vector<TypeNode*> scopeEnclosings;
scopeTypeNode->getEnclosings(scopeEnclosings);
scopeEnclosings.push_back(scopeTypeNode);
auto it = enclosings.begin();
auto end = enclosings.end();
auto it2 = scopeEnclosings.begin();
auto end2 = scopeEnclosings.end();
for (; it2 != end2; ++it2)
{
if (it == end)
{
break;
}
if (*it != *it2)
{
break;
}
++it;
}
typeName.clear();
for (; it != end; ++it)
{
TypeNode* typeNode = *it;
std::string localName;
typeNode->getLocalName(localName);
typeName += localName + "::";
}
std::string str;
m_scopeNameList->getString(str);
typeName += str;
}
}
}