本文整理汇总了C++中std::tr1::shared_ptr::nodeName方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::nodeName方法的具体用法?C++ shared_ptr::nodeName怎么用?C++ shared_ptr::nodeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::tr1::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::nodeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inspect
void inspect(ASTNode *node, std::tr1::shared_ptr<QueryScope> scope, SimpleDTD const &dtd)
{
switch (node->getType())
{
case ASTNode::NAVIGATION:
{
cout << "Type NAVIGATION" << endl;
XQNav *nav = reinterpret_cast<XQNav*>(node);
XQNav::Steps steps(nav->getSteps());
for (XQNav::Steps::const_iterator it = steps.begin(); it != steps.end(); ++it)
inspect(it->step, scope, dtd);
break;
}
case ASTNode::LITERAL:
cout << "Type LITERAL" << endl;
break;
case ASTNode::NUMERIC_LITERAL:
cout << "Type NUMERIC_LITERAL" << endl;
break;
case ASTNode::QNAME_LITERAL:
cout << "Type QNAME_LITERAL" << endl;
break;
case ASTNode::SEQUENCE:
cout << "Type SEQUENCE" << endl;
break;
case ASTNode::FUNCTION:
{
cout << "Type FUNCTION" << endl;
XQFunction *fun = reinterpret_cast<XQFunction *>(node);
VectorOfASTNodes const &args(fun->getArguments());
for (VectorOfASTNodes::const_iterator it = args.begin();
it != args.end(); ++it)
inspect(*it, scope, dtd);
break;
}
case ASTNode::VARIABLE:
cout << "Type VARIABLE" << endl;
break;
case ASTNode::STEP:
{
XQStep *step = reinterpret_cast<XQStep*>(node);
NodeTest *test = step->getNodeTest();
// Wild cards have no element name.
if (test->getNameWildcard())
{
scope->setNodeName("*");
return;
}
char *nodeType = XMLString::transcode(test->getNodeType());
char *nodeName = XMLString::transcode(test->getNodeName());
if (strcmp(nodeType, "element") == 0)
{
// Test to see if this element is allowed here
if (!dtd.allowElement(nodeName, scope->nodeName()))
cerr << "The element " << nodeName
<< " is not allowed inside "
<< scope->nodeName() << endl;
scope->setNodeName(nodeName);
}
else if (strcmp(nodeType, "attribute") == 0)
{
if (!dtd.allowAttribute(nodeName, scope->nodeName()))
cerr << "The attribute " << nodeName
<< " is not allowed inside "
<< scope->nodeName() << endl;
}
delete[] nodeType;
delete[] nodeName;
break;
}
case ASTNode::IF:
cout << "Type IF" << endl;
break;
case ASTNode::INSTANCE_OF:
cout << "Type INSTANCE_OF" << endl;
break;
//.........这里部分代码省略.........