本文整理汇总了C++中TypeNode::isTypedef方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeNode::isTypedef方法的具体用法?C++ TypeNode::isTypedef怎么用?C++ TypeNode::isTypedef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeNode
的用法示例。
在下文中一共展示了TypeNode::isTypedef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findNodeByScopeNames
bool TypeTree::findNodeByScopeNames(TypeNode*& initialTypeTreeNode, TypeNode*& finalTypeTreeNode,
const std::vector<ScopeNameNode*>& scopeNameNodes, TypeNode* enclosingTypeTreeNode, TemplateArguments* templateArguments)
{
assert(!enclosingTypeTreeNode->isTypedef());
initialTypeTreeNode = 0;
finalTypeTreeNode = 0;
auto it = scopeNameNodes.begin();
auto end = scopeNameNodes.end();
initialTypeTreeNode = findNodeByScopeName(*it, enclosingTypeTreeNode, templateArguments);
TypeNode* currentTypeTreeNode = initialTypeTreeNode;
while (true)
{
if (0 == currentTypeTreeNode)
{
return false;
}
finalTypeTreeNode = currentTypeTreeNode;
//currentTypeTreeNode = currentTypeTreeNode->getActualTypeNode(templateArguments);
//assert(0 != currentTypeTreeNode);
if (currentTypeTreeNode->isTypedef())
{
currentTypeTreeNode = static_cast<TypedefTypeNode*>(currentTypeTreeNode)->m_typedefNode->m_srcTypeNode;
if (0 == currentTypeTreeNode)
{
//under template parameter
finalTypeTreeNode = 0;
return true;
}
assert(currentTypeTreeNode && !currentTypeTreeNode->isTypedef());
}
//if (currentTypeTreeNode->isTemplateParameter())
//{
// currentTypeTreeNode = templateArguments->findTypeNode(currentTypeTreeNode->m_name);
// assert(0 != currentTypeTreeNode);
//}
++it;
if (end == it)
{
return !(currentTypeTreeNode->isNamespace());
}
currentTypeTreeNode = findNodeByScopeName(*it, currentTypeTreeNode, templateArguments);
}
}
示例2: getTypeNode
TypeNode* TypeNameNode::getTypeNode(TemplateArguments* templateArguments)
{
//assert(0 == templateArguments || templateArguments->m_classTypeNode->isTemplateClassInstance());
assert(0 != m_startTypeNode);
TypeNode* result = 0;
if (0 == m_typeNode)// under template parameter
{
assert(templateArguments && m_startTypeNode
&& (m_startTypeNode->isTemplateParameter() || m_startTypeNode->isTypedef()) );
if (templateArguments->m_classTypeNode->isClass())
{
return 0;
}
TypeNode* actualStartTypeNode = m_startTypeNode->getActualTypeNode(templateArguments);
assert(actualStartTypeNode);
std::vector<ScopeNameNode*> scopeNameNodes;
m_scopeNameList->collectIdentifyNodes(scopeNameNodes);
if (scopeNameNodes.size() == 1)
{
result = actualStartTypeNode;
}
else
{
scopeNameNodes.erase(scopeNameNodes.begin());
TypeNode* initialTypeTreeNode = 0;
TypeNode* finalTypeTreeNode = 0;
if (g_typeTree.findNodeByScopeNames(initialTypeTreeNode, finalTypeTreeNode,
scopeNameNodes, actualStartTypeNode, templateArguments))
{
assert(finalTypeTreeNode);
result = finalTypeTreeNode;
}
}
}
else if (m_typeNode->isTemplateParameter())
{
assert(templateArguments);
result = templateArguments->findTypeNode(m_scopeNameList->m_scopeName->m_name->m_str);
}
else if (m_typeNode->isTemplateClass())
{
assert(templateArguments);
if (m_scopeNameList->m_scopeName->isTemplateForm())
{
result = g_typeTree.findNodeByScopeName(m_scopeNameList->m_scopeName, m_typeNode->m_enclosing, templateArguments);
}
else
{
assert(m_scopeNameList->m_scopeName->m_name->m_str == templateArguments->m_className);
result = templateArguments->m_classTypeNode;
}
}
else if (m_typeNode->isUnderTemplateClass())
{
assert(templateArguments);
if (m_startTypeNode->isUnderTemplateClass())
{
std::vector<TypeNode*> typeNodes;
TypeNode* typeNode = m_typeNode;
while (typeNode)
{
if (typeNode->isTemplateClass())
{
break;
}
typeNodes.push_back(typeNode);
typeNode = typeNode->m_enclosing;
}
assert(typeNode->isTemplateClass() && typeNode->m_name == templateArguments->m_className);
typeNode = templateArguments->m_classTypeNode;
auto it = typeNodes.rbegin();
auto end = typeNodes.rend();
for (; it != end; ++it)
{
TypeNode* tempTypeNode = *it;
typeNode = typeNode->getChildNode(tempTypeNode->m_name);
assert(typeNode);
}
if (typeNode->isTypedef())
{
TypeNode* actualTypeNode = typeNode->getActualTypeNode(templateArguments);
if (actualTypeNode->isTemplateParameter())
{
typeNode = templateArguments->findTypeNode(actualTypeNode->m_name);
assert(0 != typeNode);
}
}
result = typeNode;
}
else
{
std::vector<ScopeNameNode*> scopeNameNodes;
m_scopeNameList->collectIdentifyNodes(scopeNameNodes);
TypeNode* initialTypeTreeNode = 0;
TypeNode* finalTypeTreeNode = 0;
if (m_startTypeNode->isTemplateClass() && !scopeNameNodes[0]->isTemplateForm())
{
assert(m_startTypeNode->m_name == templateArguments->m_className);
scopeNameNodes.erase(scopeNameNodes.begin());
if (g_typeTree.findNodeByScopeNames(initialTypeTreeNode, finalTypeTreeNode,
//.........这里部分代码省略.........