本文整理汇总了C++中ConfigSet::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigSet::begin方法的具体用法?C++ ConfigSet::begin怎么用?C++ ConfigSet::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigSet
的用法示例。
在下文中一共展示了ConfigSet::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Service
bool
ServiceReader::read( const Config& conf, RESTResponse& response )
{
response.getServices().clear();
response.getFolders().clear();
if (conf.hasChild("currentVersion"))
{
response.setCurrentVersion( conf.value("currentVersion") );
}
if (conf.hasChild("services"))
{
ConfigSet services = conf.child("services").children();
for (ConfigSet::iterator itr = services.begin(); itr != services.end(); ++itr)
{
response.getServices().push_back( Service( itr->value("name"), itr->value("type") ) );
}
}
if (conf.hasChild("folders"))
{
ConfigSet folders = conf.child("folders").children();
for (ConfigSet::iterator itr = folders.begin(); itr != folders.end(); ++itr)
{
response.getFolders().push_back( itr->value() );
}
}
return true;
}
示例2: uri
void
ShaderOptions::fromConfig(const Config& conf)
{
_code = conf.value();
_samplers.clear();
ConfigSet s = conf.children("sampler");
for (ConfigSet::const_iterator i = s.begin(); i != s.end(); ++i) {
_samplers.push_back(Sampler());
_samplers.back()._name = i->value("name");
const Config* urlarray = i->find("array");
if (urlarray) {
ConfigSet uris = urlarray->children("url");
for (ConfigSet::const_iterator j = uris.begin(); j != uris.end(); ++j) {
URI uri(j->value(), URIContext(conf.referrer()));
_samplers.back()._uris.push_back(uri);
}
}
else {
optional<URI> uri;
i->get("url", uri);
if (uri.isSet())
_samplers.back()._uris.push_back(uri.get());
}
}
s = conf.children("uniform");
for (ConfigSet::const_iterator i = s.begin(); i != s.end(); ++i) {
_uniforms.push_back(Uniform());
_uniforms.back()._name = i->value("name");
i->get("value", _uniforms.back()._value);
}
}
示例3: _dem
void CExternalChannel::CFrontEnd::MParseDemands(const NSHARE::CConfig& aConf)
{
const ConfigSet _dems = aConf.MChildren(DEMAND);
LOG_IF(WARNING,_dems.empty()) << "No demands ";
if (!_dems.empty())
{
ConfigSet::const_iterator _it = _dems.begin();
for (; _it != _dems.end(); ++_it)
{
VLOG(2) << "dem info " << *_it;
demand_dg_t _dem(*_it);
_dem.FHandler = 0;
LOG_IF(ERROR,!_dem.MIsValid()) << "Cannot create demands from "
<< _it->MToJSON(true);
if (_dem.MIsValid())
{
LOG(INFO)<<"Demand "<<_dem;
FDemands.push_back(_dem);
FSendProtocol.insert(_dem.FProtocol);
}
}
}
if (aConf.MIsChild(RECV_PROTOCOL))
{
VLOG(2) << "There is exit protocol";
FReceiveProtocol=aConf.MChild(RECV_PROTOCOL).MValue();
LOG_IF(FATAL,!FReceiveProtocol.empty() && !CParserFactory::sMGetInstance().MIsFactoryPresent(FReceiveProtocol))
<< "The protocol handler is not exist."<<FReceiveProtocol;
}
}
示例4: URIContext
void
KML_Model::parseStyle(const Config& conf, KMLContext& cx, Style& style)
{
ModelSymbol* model = 0L;
std::string url = KMLUtils::parseLink(conf);
if ( !url.empty() )
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
model->url()->setLiteral( url );
model->url()->setURIContext( URIContext(conf.referrer()) );
}
Config scale = conf.child("scale");
if (!scale.empty())
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
//TODO: Support XYZ scale instead of single value
model->scale() = scale.value("x", 1.0);
}
Config orientation = conf.child("orientation");
if (!orientation.empty())
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
double h = orientation.value("heading", 0);
if ( !osg::equivalent(h, 0.0) )
model->heading() = NumericExpression( h );
double p = orientation.value("tilt", 0);
if ( !osg::equivalent(p, 0.0) )
model->pitch() = NumericExpression( p );
double r = orientation.value("roll", 0);
if ( !osg::equivalent(r, 0.0) )
model->roll() = NumericExpression( r );
}
// Read and store file path aliases from a KML ResourceMap.
Config resource_map = conf.child("resourcemap");
if ( !resource_map.empty() )
{
const ConfigSet aliases = resource_map.children("alias");
for( ConfigSet::const_iterator i = aliases.begin(); i != aliases.end(); ++i )
{
std::string source = i->value("sourcehref");
std::string target = i->value("targethref");
if ( !source.empty() || !target.empty() )
{
if ( !model ) model = style.getOrCreate<ModelSymbol>();
model->uriAliasMap()->insert( source, target );
}
}
}
KML_Geometry::parseStyle(conf, cx, style);
}
示例5: addLevel
void
FeatureDisplayLayout::fromConfig( const Config& conf )
{
conf.getIfSet( "tile_size_factor", _tileSizeFactor );
conf.getIfSet( "crop_features", _cropFeatures );
ConfigSet children = conf.children( "level" );
for( ConfigSet::const_iterator i = children.begin(); i != children.end(); ++i )
addLevel( FeatureLevel( *i ) );
}
示例6: addResource
void
ResourceLibrary::mergeConfig( const Config& conf )
{
// read skins
const ConfigSet skins = conf.children( "skin" );
for( ConfigSet::const_iterator i = skins.begin(); i != skins.end(); ++i )
{
addResource( new SkinResource(*i) );
}
//todo: other types later..
}
示例7: LandCoverValueMapping
void
LandCoverCoverageLayerOptions::fromConfig(const Config& conf)
{
ConfigSet mappings = conf.child("land_cover_mappings").children("mapping");
for (ConfigSet::const_iterator i = mappings.begin(); i != mappings.end(); ++i)
{
osg::ref_ptr<LandCoverValueMapping> mapping = new LandCoverValueMapping(*i);
_valueMappings.push_back(mapping.get());
}
conf.get("warp", _warp);
}
示例8:
void
URI::mergeConfig(const Config& conf)
{
conf.get("option_string", _optionString);
const ConfigSet headers = conf.child("headers").children();
for (ConfigSet::const_iterator i = headers.begin(); i != headers.end(); ++i)
{
const Config& header = *i;
if (!header.key().empty() && !header.value().empty())
{
_context.addHeader(header.key(), header.value());
}
}
}
示例9: addLevel
void
FeatureDisplayLayout::fromConfig( const Config& conf )
{
conf.getIfSet( "tile_size", _tileSize );
conf.getIfSet( "tile_size_factor", _tileSizeFactor );
conf.getIfSet( "crop_features", _cropFeatures );
conf.getIfSet( "priority_offset", _priorityOffset );
conf.getIfSet( "priority_scale", _priorityScale );
conf.getIfSet( "min_expiry_time", _minExpiryTime );
conf.getIfSet( "min_range", _minRange );
conf.getIfSet( "max_range", _maxRange );
ConfigSet children = conf.children( "level" );
for( ConfigSet::const_iterator i = children.begin(); i != children.end(); ++i )
addLevel( FeatureLevel( *i ) );
}
示例10: StyleSelector
void
FeatureLevel::fromConfig( const Config& conf )
{
if ( conf.hasValue( "min_range" ) )
_minRange = conf.value( "min_range", 0.0f );
if ( conf.hasValue( "max_range" ) )
_maxRange = conf.value( "max_range", FLT_MAX );
conf.getIfSet( "lod", _lod );
const ConfigSet selectorsConf = conf.children( "selector" );
for( ConfigSet::const_iterator i = selectorsConf.begin(); i != selectorsConf.end(); ++i )
{
_selectors.push_back( StyleSelector(*i) );
}
}
示例11:
void
TextureSplatter::mergeConfig(const Config& conf)
{
conf.getIfSet( "start_lod", _startLOD );
conf.getIfSet( "intensity", _intensity );
conf.getIfSet( "scale", _scale );
conf.getIfSet( "attenuation_distance", _attenuationDistance );
conf.getIfSet( "mask_layer", _maskLayerName );
ConfigSet textures = conf.child("textures").children("texture");
for(ConfigSet::iterator i = textures.begin(); i != textures.end(); ++i)
{
_textures.push_back(TextureSource());
_textures.back()._tag = i->value("tag");
_textures.back()._url = i->value("url");
}
}
示例12: initialize
DataManager::DataManager(osgEarth::MapNode* mapNode) : _mapNode(mapNode), _maxUndoStackSize( 128 )
{
if (_mapNode)
{
_map = _mapNode->getMap();
//Look for viewpoints in the MapNode externals
const Config& externals = _mapNode->externalConfig();
const ConfigSet children = externals.children("viewpoint");
if (children.size() > 0)
{
for( ConfigSet::const_iterator i = children.begin(); i != children.end(); ++i )
_viewpoints.push_back(Viewpoint(*i));
}
}
initialize();
}
示例13: CoverageValuePredicate
void
SplatCoverageLegend::fromConfig(const Config& conf)
{
conf.get("name", _name);
conf.get("source", _source);
ConfigSet predicatesConf = conf.child("mappings").children();
for(ConfigSet::const_iterator i = predicatesConf.begin(); i != predicatesConf.end(); ++i)
{
osg::ref_ptr<CoverageValuePredicate> p = new CoverageValuePredicate();
i->get( "name", p->_description );
i->get( "value", p->_exactValue );
i->get( "class", p->_mappedClassName );
if ( p->_mappedClassName.isSet() )
{
_predicates.push_back( p.get() );
}
}
}
示例14: 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 )
{
ResourceLibrary* resLib = new ResourceLibrary( *i );
_resLibs[resLib->getName()] = resLib;
}
// 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" )
{
// 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.value() = *i;
//OE_INFO << LC << "Style block = " << blockConf.toJSON() << std::endl;
Style style( blockConf );
_styles[ style.getName() ] = style;
}
}
else
{
Style style( styleConf );
_styles[ style.getName() ] = style;
}
}
}
示例15: mapOptions
MapNode*
EarthFileSerializer2::deserialize( const Config& conf, const std::string& referenceURI ) const
{
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 );
}
Map* map = new Map( mapOptions );
// Yes, MapOptions and MapNodeOptions share the same Config node. Weird but true.
MapNodeOptions mapNodeOptions( conf.child( "options" ) );
// 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;
layerDriverConf.add( "default_tile_size", "256" );
ImageLayerOptions layerOpt( layerDriverConf );
layerOpt.name() = layerDriverConf.value("name");
//layerOpt.driver() = TileSourceOptions( layerDriverConf );
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;
layerDriverConf.add( "default_tile_size", "16" );
ElevationLayerOptions layerOpt( layerDriverConf );
layerOpt.name() = layerDriverConf.value( "name" );
//layerOpt.driver() = TileSourceOptions( layerDriverConf );
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) );
//map->addModelLayer( new ModelLayer( layerDriverConf.value("name"), ModelSourceOptions(*i) ) );
}
// Overlay layers (just an alias for Model Layer with overlay=true)
ConfigSet overlays = conf.children( "overlay" );
for( ConfigSet::const_iterator i = overlays.begin(); i != overlays.end(); i++ )
{
Config layerDriverConf = *i;
if ( !layerDriverConf.hasValue("driver") )
layerDriverConf.set("driver", "feature_geom");
ModelLayerOptions layerOpt( layerDriverConf );
layerOpt.name() = layerDriverConf.value( "name" );
layerOpt.driver() = ModelSourceOptions( layerDriverConf );
layerOpt.overlay() = true; // forced on when "overlay" specified
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");
//.........这里部分代码省略.........