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


C++ configset::iterator类代码示例

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


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

示例1: ChooseConfigs

EGLBoolean EglDisplayImpl::ChooseConfigs(const EGLint* attribs,
                                         EGLConfig* configs,
                                         EGLint configs_size,
                                         EGLint* num_config) {
  int count = 0;
  EglConfigImpl dummy(attribs);
  const EGLConfig egl_config = dummy.GetKey();
  if (egl_config != reinterpret_cast<EGLConfig>(EGL_DONT_CARE)) {
    const EglConfigImpl* cfg = GetConfig(egl_config);
    if (cfg && configs_size > 0) {
      configs[0] = cfg->GetKey();
      count = 1;
    } else {
      count = 0;
    }
  } else {
    for (ConfigSet::iterator i = configs_.begin(); i != configs_.end(); ++i) {
      if (i->Matches(dummy)) {
        if (configs) {
          if (count >= configs_size) {
            break;
          }
          configs[count] = i->GetKey();
        }
        ++count;
      }
    }
  }

  if (num_config) {
    *num_config = count;
  }

  return EGL_TRUE;
}
开发者ID:epowers,项目名称:arc,代码行数:35,代码来源:egl_display_impl.cpp

示例2: key

void
Config::setReferrer( const std::string& referrer )
{
    if ( referrer.empty() )
        return;

    std::string absReferrer;
    if( !osgDB::containsServerAddress( referrer ) ) {
        absReferrer = osgEarth::getAbsolutePath( referrer );

        if( osgEarth::isRelativePath( absReferrer ) )
        {
            OE_WARN << LC << "ILLEGAL: call to setReferrer with relative path:  "
                "key=" << key() << "; referrer=" << referrer << "\n";
            return;
        }
    }
    else {
        absReferrer = referrer;
    }

    // Don't overwrite an existing referrer:
    if ( _referrer.empty() )
    {
        _referrer = absReferrer;
    }

    for( ConfigSet::iterator i = _children.begin(); i != _children.end(); i++ )
    { 
        i->setReferrer( absReferrer );
    }
}
开发者ID:ldelgass,项目名称:osgearth,代码行数:32,代码来源:Config.cpp

示例3: 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;
}
开发者ID:emminizer,项目名称:osgearth,代码行数:32,代码来源:ArcGIS.cpp

示例4:

void
Config::setReferrer( const std::string& referrer )
{
    _referrer = referrer;
    for( ConfigSet::iterator i = _children.begin(); i != _children.end(); i++ )
    { 
        i->setReferrer( osgEarth::getFullPath(_referrer, i->_referrer) );
    }
}
开发者ID:JohnDr,项目名称:osgearth,代码行数:9,代码来源:Config.cpp

示例5:

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");
    }
}
开发者ID:DavidLeehome,项目名称:osgearth,代码行数:17,代码来源:TextureSplatter.cpp

示例6: GetConfigs

EGLBoolean EglDisplayImpl::GetConfigs(EGLConfig* configs, EGLint config_size,
                                      EGLint* num_config) {
  const EGLint total_configs = GetNumConfigs();
  if (!configs) {
    *num_config = total_configs;
    return EGL_TRUE;
  }

  int count = 0;
  const EGLint max_configs = std::min(total_configs, config_size);
  for (ConfigSet::iterator i = configs_.begin(); i != configs_.end(); ++i) {
    if (count >= max_configs) {
      break;
    }
    configs[count] = i->GetKey();
    ++count;
  }
  LOG_ALWAYS_FATAL_IF(!num_config, "num_config must be non-NULL");
  *num_config = count;
  return EGL_TRUE;
}
开发者ID:epowers,项目名称:arc,代码行数:21,代码来源:egl_display_impl.cpp

示例7: Initialize

void EglDisplayImpl::Initialize() {
  Mutex::Autolock mutex(&lock_);
  if (initialized_) {
    return;
  }

  window_ = Native::CreateNativeWindow();
  LOG_ALWAYS_FATAL_IF(!window_, "Could not create native window.");

  EGLConfig cfg = NULL;
  for (ConfigSet::iterator it = configs_.begin(); it != configs_.end(); ++it) {
    const EGLint r = it->GetValue(EGL_RED_SIZE);
    const EGLint g = it->GetValue(EGL_GREEN_SIZE);
    const EGLint b = it->GetValue(EGL_BLUE_SIZE);
    if (r > 0 && g > 0 && b > 0) {
      cfg = it->GetKey();
      break;
    }
  }

  EGLint err = 0;
  global_context_ = EglContextImpl::Create(kDefaultDisplay, cfg, NULL, 2, &err);

  // Bind the window surface here in order for the compositor to be associated
  // with the correct context.  (The compositor associates itself to the first
  // surface that is bound.)
  ContextPtr ctx = contexts_.Get(global_context_);
  Native::BindNativeWindow(window_, ctx->GetNativeContext());

  // Force the GlesContext owned by the global context to be initialized at
  // least once.
  EglThreadInfo& info = EglThreadInfo::GetInstance();
  info.SetCurrentContext(ctx);
  ctx->GetGlesContext()->OnMakeCurrent();
  info.SetCurrentContext(ContextPtr());

  initialized_ = true;
}
开发者ID:epowers,项目名称:arc,代码行数:38,代码来源:egl_display_impl.cpp

示例8: 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;
        }
    }
}
开发者ID:JohnDr,项目名称:osgearth,代码行数:81,代码来源:StyleSheet.cpp

示例9: 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;
        }
    }
}
开发者ID:rdelmont,项目名称:osgearth,代码行数:76,代码来源:Style.cpp

示例10: 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;
        }
    }
}
开发者ID:spencerg,项目名称:osgearth,代码行数:93,代码来源:Style.cpp


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