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


C++ parameters::begin方法代码示例

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


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

示例1: make_text

object_ptr interpreter::make_text (parameters &command) {
   TRACE ('f', command);
   string first = shift(command);
   string font = "";
   double size = 12.0; //Default size is 12 for text
   //If conversion succeeds, then next string on list is the fontname,
   //otherwise the string that couldn't be converted to a double is
   //the fontname.
   try{
      size = from_string<double>(first);
      font = shift(command);
   }
   catch (runtime_error &error){
      font = first;
   }
   //At this point, the rest of the words are text to be printed.
   string textdata{};
   parameters::const_iterator itor = command.begin();
   parameters::const_iterator end = command.end();
   --end;
   for(; itor != end; ++itor){
      textdata += *itor + ' ';
   }textdata += *itor;//remove trailing space
   return make_shared<text> (font, points(size), textdata);
}
开发者ID:rcalef,项目名称:Cpp_projects,代码行数:25,代码来源:interp.cpp

示例2: create

datasource_ptr datasource_cache::create(const parameters& params, bool bind)
{
    boost::optional<std::string> type = params.get<std::string>("type");
    if ( ! type)
    {
        throw config_error(std::string("Could not create datasource. Required ") +
                           "parameter 'type' is missing");
    }

#ifdef MAPNIK_THREADSAFE
    mutex::scoped_lock lock(mutex_);
#endif

    datasource_ptr ds;
    std::map<std::string,boost::shared_ptr<PluginInfo> >::iterator itr=plugins_.find(*type);
    if ( itr == plugins_.end() )
    {
        throw config_error(std::string("Could not create datasource. No plugin ") +
                           "found for type '" + * type + "' (searched in: " + plugin_directories() + ")");
    }

    if ( ! itr->second->handle())
    {
        throw std::runtime_error(std::string("Cannot load library: ") +
                                 lt_dlerror());
    }

    // http://www.mr-edd.co.uk/blog/supressing_gcc_warnings
#ifdef __GNUC__
    __extension__
#endif
        create_ds* create_datasource =
        reinterpret_cast<create_ds*>(lt_dlsym(itr->second->handle(), "create"));

    if (! create_datasource)
    {
        throw std::runtime_error(std::string("Cannot load symbols: ") +
                                 lt_dlerror());
    }

#ifdef MAPNIK_LOG
    MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Size=" << params.size();

    parameters::const_iterator i = params.begin();
    for (; i != params.end(); ++i)
    {
        MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: -- " << i->first << "=" << i->second;
    }
#endif

    ds = datasource_ptr(create_datasource(params, bind), datasource_deleter());

    MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Datasource=" << ds << " type=" << type;

    return ds;
}
开发者ID:PierceCountyWA,项目名称:mapnik,代码行数:56,代码来源:datasource_cache.cpp

示例3: getstate

 static boost::python::tuple
 getstate(const parameters& p)
 {
     using namespace boost::python;
     dict d;
     parameters::const_iterator pos=p.begin();
     while(pos!=p.end())
     {
         d[pos->first] = pos->second;
         ++pos;
     }
     return boost::python::make_tuple(d);
 }
开发者ID:PetrDlouhy,项目名称:mapnik,代码行数:13,代码来源:mapnik_parameters.cpp

示例4: serializer

boost::python::list list_params(parameters& p)
{
    boost::python::list l;
    parameters::const_iterator pos=p.begin();
    while(pos!=p.end())
    {
        boost::python::list vals;
        pickle_value serializer( vals );
        mapnik::value_holder val = pos->second;
        boost::apply_visitor( serializer, val );
        l.append(boost::python::make_tuple(pos->first,vals[0]));
        ++pos;
    }
    return l;
}
开发者ID:netconstructor,项目名称:mapnik,代码行数:15,代码来源:mapnik_parameters.cpp

示例5:

chained_datasource::chained_datasource(const parameters& params, bool _bind) :
	datasource(params)
{
	// Iterate over params and populate m_source_params
	// from all parameters that start with "src_"
	for (parameters::const_iterator iter=params.begin(); iter!=params.end(); iter++) {
		const std::string &name(iter->first);
		if (!boost::starts_with(name, "src_")) continue;

		const std::string sub_name(name.substr(4));
		source_params_[sub_name]=iter->second;
	}

	if (_bind) {
		bind();
	}
}
开发者ID:GunioRobot,项目名称:mapnik-rasterizers,代码行数:17,代码来源:chained_datasource.cpp

示例6: create

datasource_ptr datasource_cache::create(parameters const& params)
{
    boost::optional<std::string> type = params.get<std::string>("type");
    if ( ! type)
    {
        throw config_error(std::string("Could not create datasource. Required ") +
                           "parameter 'type' is missing");
    }

    datasource_ptr ds;

#ifdef MAPNIK_STATIC_PLUGINS
    // return if it's created, raise otherwise
    ds = create_static_datasource(params);
    if (ds)
    {
        return ds;
    }
#endif

#ifdef MAPNIK_THREADSAFE
    mapnik::scoped_lock lock(mutex_);
#endif

    std::map<std::string,std::shared_ptr<PluginInfo> >::iterator itr=plugins_.find(*type);
    if (itr == plugins_.end())
    {
        std::string s("Could not create datasource for type: '");
        s += *type + "'";
        if (plugin_directories_.empty())
        {
            s += " (no datasource plugin directories have been successfully registered)";
        }
        else
        {
            s += " (searched for datasource plugins in '" + plugin_directories() + "')";
        }
        throw config_error(s);
    }

    if (! itr->second->valid())
    {
        throw std::runtime_error(std::string("Cannot load library: ") +
                                 itr->second->get_error());
    }

    // http://www.mr-edd.co.uk/blog/supressing_gcc_warnings
#ifdef __GNUC__
    __extension__
#endif
        create_ds* create_datasource = reinterpret_cast<create_ds*>(itr->second->get_symbol("create"));

    if (! create_datasource)
    {
        throw std::runtime_error(std::string("Cannot load symbols: ") +
                                 itr->second->get_error());
    }

    ds = datasource_ptr(create_datasource(params), datasource_deleter());

#ifdef MAPNIK_LOG
    MAPNIK_LOG_DEBUG(datasource_cache)
        << "datasource_cache: Datasource="
        << ds << " type=" << type;

    MAPNIK_LOG_DEBUG(datasource_cache)
        << "datasource_cache: Size="
        << params.size();

    parameters::const_iterator i = params.begin();
    for (; i != params.end(); ++i)
    {
        MAPNIK_LOG_DEBUG(datasource_cache)
            << "datasource_cache: -- "
            << i->first << "=" << i->second;
    }
#endif

    return ds;
}
开发者ID:HUSSBV,项目名称:mapnik,代码行数:80,代码来源:datasource_cache.cpp


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