当前位置: 首页>>代码示例>>C++>>正文


C++ shared_ptr::nodeName方法代码示例

本文整理汇总了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;

//.........这里部分代码省略.........
开发者ID:rug-compling,项目名称:xpath-dtd-validation,代码行数:101,代码来源:main.cpp


注:本文中的std::tr1::shared_ptr::nodeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。