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


C++ iterator::hasValue方法代码示例

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


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

示例1: uri

void
StyleSheet::mergeConfig( const Config& conf )
{
    conf.get("name", _name);

    _uriContext = URIContext( conf.referrer() );

    // read in any resource library references
    ConfigSet libraries = conf.children( "library" );
    for( ConfigSet::iterator i = libraries.begin(); i != libraries.end(); ++i )
    {
        const Config& libConf = *i;
        ResourceLibrary* resLib = new ResourceLibrary( libConf );
        if (resLib && libConf.value("name").empty() == false)
            resLib->setName(libConf.value("name"));

        _resLibs[resLib->getName()] = resLib;
    }

    // read in any scripts
    ConfigSet scripts = conf.children( "script" );
    for( ConfigSet::iterator i = scripts.begin(); i != scripts.end(); ++i )
    {
        _script = new ScriptDef();

        // load the code from a URI if there is one:
        if ( i->hasValue("url") )
        {
            _script->uri = URI( i->value("url"), _uriContext );
            OE_INFO << LC << "Loading script from \"" << _script->uri->full() << std::endl;
            _script->code = _script->uri->getString();
        }
        else
        {
            _script->code = i->value();
        }

        // name is optional and unused at the moment
        _script->name = i->value("name");

        std::string lang = i->value("language");
        _script->language = lang.empty() ? "javascript" : lang;

        std::string profile = i->value("profile");
        _script->profile = profile;
    }

    // read any style class definitions. either "class" or "selector" is allowed
    ConfigSet selectors = conf.children( "selector" );
    if ( selectors.empty() ) selectors = conf.children( "class" );
    for( ConfigSet::iterator i = selectors.begin(); i != selectors.end(); ++i )
    {
        _selectors.push_back( StyleSelector( *i ) );
    }

    // read in the actual styles
    ConfigSet styles = conf.children( "style" );
    for( ConfigSet::iterator i = styles.begin(); i != styles.end(); ++i )
    {
        const Config& styleConf = *i;

        if ( styleConf.value("type") == "text/css" )
        {
            // for CSS data, there may be multiple styles in one CSS block. So
            // parse them all out and add them to the stylesheet.

            // read the inline data:
            std::string cssString = styleConf.value();

            // if there's a URL, read the CSS from the URL:
            if ( styleConf.hasValue("url") )
            {
                URI uri( styleConf.value("url"), styleConf.referrer() );
                cssString = uri.readString().getString();
            }

            // break up the CSS into multiple CSS blocks and parse each one individually.
            std::vector<std::string> blocks;
            CssUtils::split( cssString, blocks );

            for( std::vector<std::string>::iterator i = blocks.begin(); i != blocks.end(); ++i )
            {
                Config blockConf( styleConf );
                blockConf.setValue(*i);
                //OE_INFO << LC << "Style block = " << blockConf.toJSON() << std::endl;
                Style style( blockConf, this );
                _styles[ style.getName() ] = style;
            }
        }
        else
        {
            Style style( styleConf );
            _styles[ style.getName() ] = style;
        }
    }
}
开发者ID:emminizer,项目名称:osgearth,代码行数:96,代码来源:StyleSheet.cpp


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