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


C++ options_description::options方法代码示例

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


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

示例1: result

    basic_parsed_options<charT>
    parse_config_file(std::basic_istream<charT>& is, 
                      const options_description& desc,
                      bool allow_unregistered)
    {    
        set<string> allowed_options;

        const vector<shared_ptr<option_description> >& options = desc.options();
        for (unsigned i = 0; i < options.size(); ++i)
        {
            const option_description& d = *options[i];

            if (d.long_name().empty())
                pdalboost::throw_exception(
                    error("long name required for config file"));

            allowed_options.insert(d.long_name());
        }

        // Parser return char strings
        parsed_options result(&desc);        
        copy(detail::basic_config_file_iterator<charT>(
                 is, allowed_options, allow_unregistered), 
             detail::basic_config_file_iterator<charT>(), 
             back_inserter(result.options));
        // Convert char strings into desired type.
        return basic_parsed_options<charT>(result);
    }
开发者ID:xhy20070406,项目名称:PDAL,代码行数:28,代码来源:parsers.cpp

示例2: get_section_options

options_description get_section_options(const string section_name, const string group_caption, const options_description &original_options_descriptions)
{

    const std::vector< shared_ptr<option_description> >&original_options = original_options_descriptions.options();

    options_description new_options(group_caption.c_str());

    std::vector< shared_ptr<option_description> >::const_iterator options_it;
    for(options_it = original_options.begin(); options_it != original_options.end(); ++options_it)
    {

        const option_description &t_option = *(*options_it);
        string new_name(section_name + ".");
        new_name += t_option.long_name();


        // IMPORTANT: in order for this line not to crash the original_options_descriptions needs to be a static declaration
        // otherwise t_option.semantic().get() will point to an invalid memory direction and
        // the application will raise a segmentation fault
        new_options.add_options()
                (new_name.c_str(), t_option.semantic().get(), t_option.description().c_str());

    }

    return new_options;
}
开发者ID:HaoLiuHust,项目名称:doppia,代码行数:26,代码来源:get_section_options.cpp

示例3: result

    basic_parsed_options<charT>
    parse_xml(const options_description& desc) {
        using boost::shared_ptr;
        set<string> allowed_options;

        const vector<shared_ptr<option_description> >& options = desc.options();
        for (unsigned i = 0; i < options.size(); ++i) {
            const option_description& d = *options[i];

            if (d.long_name().empty())
                boost::throw_exception(
                    error("long name required for config file"));

            allowed_options.insert(d.long_name());
        }

        // Parser return char strings
        parsed_options result(&desc);
        result.options.push_back(basic_option<charT>("my_double", vector<string>(1, "10.1214")));
        //result.options.push_back(basic_option<charT>("my_string", vector<string>(1, "hello world")));
        return basic_parsed_options<charT>(result);
    }
开发者ID:cfobel,项目名称:boost_any,代码行数:22,代码来源:typed_value_options.cpp


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