本文整理汇总了C++中configset::const_iterator::key方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::key方法的具体用法?C++ const_iterator::key怎么用?C++ const_iterator::key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configset::const_iterator
的用法示例。
在下文中一共展示了const_iterator::key方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const Config*
Config::find( const std::string& key, bool checkMe ) const
{
if ( checkMe && key == this->key() )
return this;
for( ConfigSet::const_iterator c = _children.begin(); c != _children.end(); ++c )
if ( key == c->key() )
return &(*c);
for( ConfigSet::const_iterator c = _children.begin(); c != _children.end(); ++c )
{
const Config* r = c->find(key, false);
if ( r ) return r;
}
return 0L;
}
示例2: end
void ChromeMetricsBackend::end(const std::string& name, const Config& args)
{
osg::Timer_t now = osg::Timer::instance()->tick();
OpenThreads::ScopedLock< OpenThreads::Mutex > lk(_mutex);
if (_firstEvent)
{
_firstEvent = false;
}
else
{
_metricsFile << "," << std::endl;
}
_metricsFile << "{"
<< "\"cat\": \"" << "" << "\","
<< "\"pid\": \"" << 0 << "\","
<< "\"tid\": \"" << osgEarth::Threading::getCurrentThreadId() << "\","
<< "\"ts\": \"" << std::setprecision(9) << osg::Timer::instance()->delta_u(_startTime, now) << "\","
<< "\"ph\": \"E\","
<< "\"name\": \"" << name << "\"";
if (!args.empty())
{
_metricsFile << "," << std::endl << " \"args\": {";
bool first = true;
for( ConfigSet::const_iterator i = args.children().begin(); i != args.children().end(); ++i ) {
if (first)
{
first = !first;
}
else
{
_metricsFile << "," << std::endl;
}
_metricsFile << "\"" << i->key() << "\" : \"" << i->value() << "\"";
}
_metricsFile << "}";
}
_metricsFile << "}";
}
示例3: if
XmlElement::XmlElement( const Config& conf )
{
name = conf.key();
if ( !conf.value().empty() )
{
children.push_back( new XmlText(conf.value()) );
}
for( ConfigSet::const_iterator j = conf.children().begin(); j != conf.children().end(); j++ )
{
if ( j->isSimple() )
{
attrs[j->key()] = j->value();
}
else if ( j->children().size() > 0 )
{
children.push_back( new XmlElement(*j) );
}
}
}
示例4: mapOptions
//.........这里部分代码省略.........
// Read the layers in LAST (otherwise they will not benefit from the cache/profile configuration)
// Image layers:
ConfigSet images = conf.children( "image" );
for( ConfigSet::const_iterator i = images.begin(); i != images.end(); i++ )
{
Config layerDriverConf = *i;
ImageLayerOptions layerOpt( layerDriverConf );
layerOpt.name() = layerDriverConf.value("name");
map->addImageLayer( new ImageLayer(layerOpt) );
}
// Elevation layers:
for( int k=0; k<2; ++k )
{
std::string tagName = k == 0 ? "elevation" : "heightfield"; // support both :)
ConfigSet heightfields = conf.children( tagName );
for( ConfigSet::const_iterator i = heightfields.begin(); i != heightfields.end(); i++ )
{
Config layerDriverConf = *i;
ElevationLayerOptions layerOpt( layerDriverConf );
layerOpt.name() = layerDriverConf.value( "name" );
map->addElevationLayer( new ElevationLayer(layerOpt) );
}
}
// Model layers:
ConfigSet models = conf.children( "model" );
for( ConfigSet::const_iterator i = models.begin(); i != models.end(); i++ )
{
const Config& layerDriverConf = *i;
ModelLayerOptions layerOpt( layerDriverConf );
layerOpt.name() = layerDriverConf.value( "name" );
layerOpt.driver() = ModelSourceOptions( layerDriverConf );
map->addModelLayer( new ModelLayer(layerOpt) );
}
// Mask layer:
ConfigSet masks = conf.children( "mask" );
for( ConfigSet::const_iterator i = masks.begin(); i != masks.end(); i++ )
{
Config maskLayerConf = *i;
MaskLayerOptions options(maskLayerConf);
options.name() = maskLayerConf.value( "name" );
options.driver() = MaskSourceOptions(options);
map->addTerrainMaskLayer( new MaskLayer(options) );
}
//Add any addition paths specified in the options/osg_file_paths element to the file path. Useful for pointing osgEarth at resource folders.
Config osg_file_paths = conf.child( "options" ).child("osg_file_paths");
ConfigSet urls = osg_file_paths.children("url");
for (ConfigSet::const_iterator i = urls.begin(); i != urls.end(); i++)
{
std::string path = osgEarth::getFullPath( referrer, (*i).value());
OE_DEBUG << "Adding OSG file path " << path << std::endl;
osgDB::Registry::instance()->getDataFilePathList().push_back( path );
}
osg::ref_ptr<MapNode> mapNode = new MapNode( map, mapNodeOptions );
// External configs. Support both "external" and "extensions" tags.
Config ext = conf.child( "external" );
if ( ext.empty() )
ext = conf.child( "extensions" );
if ( !ext.empty() )
{
// save the configuration in case we need to write it back out later
mapNode->externalConfig() = ext;
// locate and install any registered extensions.
ConfigSet extensions = ext.children();
for(ConfigSet::const_iterator i = extensions.begin(); i != extensions.end(); ++i)
{
Extension* extension = Extension::create( i->key(), *i );
if ( extension )
{
mapNode->addExtension( extension );
}
else
{
OE_DEBUG << LC << "Failed to load an extension for \"" << i->key() << "\"\n";
}
}
}
return mapNode.release();
}
示例5: uri
void
StyleSheet::mergeConfig( const Config& conf )
{
// read in any resource library references
ConfigSet libraries = conf.children( "library" );
for( ConfigSet::iterator i = libraries.begin(); i != libraries.end(); ++i )
{
std::string name = i->value("name");
if ( name.empty() ) {
OE_WARN << LC << "Resource library missing required 'name' attribute" << std::endl;
continue;
}
URI uri( i->value("url"), i->uriContext() );
if ( uri.empty() ) {
OE_WARN << LC << "Resource library missing required 'url' element" << std::endl;
continue;
}
osg::ref_ptr<ResourceLibrary> reslib = ResourceLibrary::create( uri );
if ( !reslib.valid() ) {
OE_WARN << LC << "Resource library creation failed" << std::endl;
continue;
}
addResourceLibrary( name, reslib.get() );
}
// 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" )
{
// 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.uriContext() );
HTTPClient::readString( uri.full(), cssString );
}
// a CSS style definition can actually contain multiple styles. Read them
// and create one style for each in the catalog.
std::stringstream buf( cssString );
Config css = CssUtils::readConfig( buf );
css.setURIContext( styleConf.uriContext( ) );
const ConfigSet children = css.children();
for(ConfigSet::const_iterator j = children.begin(); j != children.end(); ++j )
{
Style style( styleConf );
if ( SLDReader::readStyleFromCSSParams( *j, style ) )
_styles[ j->key() ] = style;
}
}
else
{
Style style( styleConf );
_styles[ style.getName() ] = style;
}
}
}
示例6: uri
void
StyleSheet::mergeConfig( const Config& conf )
{
_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 )
{
std::string name = i->value("name");
if ( name.empty() ) {
OE_WARN << LC << "Resource library missing required 'name' attribute" << std::endl;
continue;
}
URI uri( i->value("url"), i->referrer() );
if ( uri.empty() ) {
OE_WARN << LC << "Resource library missing required 'url' element" << std::endl;
continue;
}
_resLibs[name] = ResourceLibraryEntry(uri, (osgEarth::Symbology::ResourceLibrary*)0L);
//addResourceLibrary( name, reslib.get() );
}
// read in any scripts
ConfigSet scripts = conf.children( "script" );
for( ConfigSet::iterator i = scripts.begin(); i != scripts.end(); ++i )
{
// get the script code
std::string code = i->value();
// name is optional and unused at the moment
std::string name = i->value("name");
std::string lang = i->value("language");
if ( lang.empty() ) {
// default to javascript
lang = "javascript";
}
_script = new Script(code, lang, name);
}
// 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" )
{
// 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();
}
// a CSS style definition can actually contain multiple styles. Read them
// and create one style for each in the catalog.
std::stringstream buf( cssString );
Config css = CssUtils::readConfig( buf );
css.setReferrer( styleConf.referrer() );
const ConfigSet children = css.children();
for(ConfigSet::const_iterator j = children.begin(); j != children.end(); ++j )
{
Style style( styleConf );
if ( SLDReader::readStyleFromCSSParams( *j, style ) )
_styles[ j->key() ] = style;
}
}
else
{
Style style( styleConf );
_styles[ style.getName() ] = style;
}
}
}
示例7: mapOptions
osg::Node*
EarthFileSerializer2::deserialize( const Config& conf, const std::string& referrer ) const
{
// First, pre-load any extension DLLs.
preloadExtensionLibs(conf);
preloadExtensionLibs(conf.child("extensions"));
preloadExtensionLibs(conf.child("external"));
MapOptions mapOptions( conf.child( "options" ) );
// legacy: check for name/type in top-level attrs:
if ( conf.hasValue( "name" ) || conf.hasValue( "type" ) )
{
Config legacy;
if ( conf.hasValue("name") ) legacy.add( "name", conf.value("name") );
if ( conf.hasValue("type") ) legacy.add( "type", conf.value("type") );
mapOptions.mergeConfig( legacy );
}
osg::ref_ptr< Map > map = new Map( mapOptions );
// Start a batch update of the map:
map->beginUpdate();
// Read all the elevation layers in FIRST so other layers can access them for things like clamping.
// TODO: revisit this since we should really be listening for elevation data changes and
// re-clamping based on that..
for(ConfigSet::const_iterator i = conf.children().begin(); i != conf.children().end(); ++i)
{
// for backwards compatibility:
if (i->key() == "heightfield")
{
Config temp = *i;
temp.key() = "elevation";
addLayer(temp, map);
}
else if ( i->key() == "elevation" ) // || i->key() == "heightfield" )
{
addLayer(*i, map);
}
}
Config externalConfig;
std::vector<osg::ref_ptr<Extension> > extensions;
// Read the layers in LAST (otherwise they will not benefit from the cache/profile configuration)
for(ConfigSet::const_iterator i = conf.children().begin(); i != conf.children().end(); ++i)
{
if (i->key() == "options" || i->key() == "name" || i->key() == "type" || i->key() == "version")
{
// nop - handled earlier
}
#if 0
else if ( i->key() == "image" )
{
addImageLayer( *i, map );
}
else */if ( i->key() == "model" )
{
addModelLayer( *i, map );
}
else if ( i->key() == "mask" )
{
addMaskLayer( *i, map );
}
#endif
else if ( i->key() == "external" || i->key() == "extensions" )
{
externalConfig = *i;
for(ConfigSet::const_iterator e = i->children().begin(); e != i->children().end(); ++e)
{
Extension* extension = loadExtension(*e);
if (extension)
extensions.push_back(extension);
//addExtension( *e, mapNode.get() );
}
}
else if ( !isReservedWord(i->key()) ) // plugins/extensions.
{
// try to add as a plugin Layer first:
bool addedLayer = addLayer(*i, map);
// failing that, try to load as an extension:
if ( !addedLayer )
{
Extension* extension = loadExtension(*i);
if (extension)
extensions.push_back(extension);
}
}
}
// Complete the batch update of the map
//.........这里部分代码省略.........