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