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


C++ YamlNode::type方法代码示例

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


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

示例1: openMapping

YamlMapping* YamlMapping::openMapping(const std::string& key, bool doOverwrite)
{
    if(!isValid()){
        throwNotMappingException();
    }

    YamlMapping* mapping = 0;
    const string uKey(toUtf8(key));
    iterator p = values.find(uKey);
    if(p != values.end()){
        YamlNode* node = p->second.get();
        if(node->type() != YAML_MAPPING){
            values.erase(p);
        } else {
            mapping = static_cast<YamlMapping*>(node);
            if(doOverwrite){
                mapping->clear();
            }
            mapping->indexInMapping = indexCounter++;
        }
    }

    if(!mapping){
        mapping = new YamlMapping();
        mapping->doubleFormat_ = doubleFormat_;
        insertSub(uKey, mapping);
    }

    return mapping;
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:30,代码来源:YamlNodes.cpp

示例2: openSequence

YamlSequence* YamlMapping::openSequence(const std::string& key, bool doOverwrite)
{
    if(!isValid()){
        throwNotMappingException();
    }

    YamlSequence* sequence = 0;
    const string uKey(toUtf8(key));
    iterator p = values.find(uKey);
    if(p != values.end()){
        YamlNode* node = p->second.get();
        if(node->type() != YAML_SEQUENCE){
            values.erase(p);
        } else {
            sequence = static_cast<YamlSequence*>(node);
            if(doOverwrite){
                sequence->clear();
            }
            sequence->indexInMapping = indexCounter++;
        }
    }

    if(!sequence){
        sequence = new YamlSequence();
        sequence->doubleFormat_ = doubleFormat_;
        insertSub(uKey, sequence);
    }

    return sequence;
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:30,代码来源:YamlNodes.cpp

示例3: findSequence

YamlSequence* YamlMapping::findSequence(const std::string& key) const
{
    if(!isValid()){
        throwNotMappingException();
    }
    const_iterator p = values.find(toUtf8(key));
    if(p != values.end()){
        YamlNode* node = p->second.get();
        if(node->type() == YAML_SEQUENCE){
            return static_cast<YamlSequence*>(node);
        }
    }
    return invalidSequence.get();
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:14,代码来源:YamlNodes.cpp

示例4: writeSub

/**
   This is for internal use. Text are not converted to UTF-8.
*/
void YamlMapping::writeSub(const std::string &key, const char* text, size_t length, YamlStringStyle stringStyle)
{
    const string uKey(toUtf8(key));
    iterator p = values.find(uKey);
    if(p == values.end()){
        insertSub(uKey, new YamlScalar(text, length, stringStyle));
    } else {
        YamlNode* node = p->second.get();
        if(node->type() == YAML_SCALAR){
            YamlScalar* scalar = static_cast<YamlScalar*>(node);
            scalar->stringValue = string(text, length);
            scalar->stringStyle = stringStyle;
            scalar->indexInMapping = indexCounter++;
        } else {
            throwNotScalrException();
        }
    }
}
开发者ID:thomas-moulard,项目名称:choreonoid-deb,代码行数:21,代码来源:YamlNodes.cpp


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