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


C++ ASTNode::getKey方法代码示例

本文整理汇总了C++中ASTNode::getKey方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNode::getKey方法的具体用法?C++ ASTNode::getKey怎么用?C++ ASTNode::getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ASTNode的用法示例。


在下文中一共展示了ASTNode::getKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transform

vector<ASTNode*> ASTNode::getChildren(const string &key) {
    vector<ASTNode*> subset;

    if (m_children.size() > 0) {
        string keyLC = key;

        // Transform key name to lower case for case insensitive lookups.
        transform(keyLC.begin(), keyLC.end(), keyLC.begin(), ptr_fun(::tolower));

        vector<ASTNode*>::iterator it = m_children.begin();
        while (it != m_children.end()) {
            ASTNode *n = (*it++);
            string nodeKey = n->getKey();

            // Transform key name to lower case for case insensitive lookups.
            transform(nodeKey.begin(), nodeKey.end(), nodeKey.begin(), ptr_fun(::tolower));

            // Try to match the key.
            if (keyLC == nodeKey) {
                subset.push_back(n);
            }
        }
    }

    return subset;
}
开发者ID:nedwed123,项目名称:AutonomousCar,代码行数:26,代码来源:ASTNode.cpp

示例2: printKeys

void ASTNode::printKeys() const {
    vector<ASTNode*>::const_iterator it = m_children.begin();
    while (it != m_children.end()) {
        ASTNode *n = (*it++);
        clog << "Key: " << n->getKey() << endl;
    }
}
开发者ID:nedwed123,项目名称:AutonomousCar,代码行数:7,代码来源:ASTNode.cpp

示例3: visitObject

        Object SITSituationVisitor::visitObject(ASTNode *node) {
            Object o;

            if (node != NULL) {
                ASTNode *n = NULL;

                n = node->getNodeFromFirstMatchingChildFor("OBJECT");
                if (n == NULL) {
                    OPENDAVINCI_CORE_THROW_EXCEPTION(SITSituationVisitorException, "Node to get value from OBJECT expected.");
                }
                o.setName(n->getValue<string>());

                n = node->getNodeFromFirstMatchingChildFor("OBJECTID");
                if (n == NULL) {
                    OPENDAVINCI_CORE_THROW_EXCEPTION(SITSituationVisitorException, "Node to get value from OBJECTID expected.");
                }
                o.setID(n->getValue<uint32_t>());

                // Parse shape from child.
                vector<ASTNode*> listOfChildren = node->getChildren("OBJECTID");
                vector<ASTNode*>::iterator it = listOfChildren.begin() + 1; // Skip first OBJECTID.
                while (it != listOfChildren.end()) {
                    ASTNode *child = (*it++)->getFirstChild();
                    if (child != NULL) {
                        if (child->getKey() == "SHAPENAME") {
                            Shape *shape = visitShape(child->getParent());
                            o.setShape(shape);
                        }
                    }
                }

                n = node->getNodeFromFirstMatchingChildFor("ROTZ");
                if (n == NULL) {
                    OPENDAVINCI_CORE_THROW_EXCEPTION(SITSituationVisitorException, "Node to get value from ROTZ expected.");
                }
                o.setRotationZ(n->getValue<double>());

                n = *(node->getChildren("ROTZ").begin() + 1); // BEHAVIOR starts directly after ROTZ.
                if (n == NULL) {
                    OPENDAVINCI_CORE_THROW_EXCEPTION(SITSituationVisitorException, "Node to get value from BEHAVIOR expected.");
                }
                o.setBehavior(visitBehavior(n));
            }

            return o;
        }
开发者ID:TacoVox,项目名称:OpenDaVINCI,代码行数:46,代码来源:SITSituationVisitor.cpp


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