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


C++ variables_map::at方法代码示例

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


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

示例1: parse

void parse(std::string const & appName, boost::program_options::variables_map const & cmdLine)
{
  ReflectionOptions options;

  options.generatorPath = appName;
  options.targetName = cmdLine.at(kSwitchTargetName).as<std::string>();
  options.inputPath = cmdLine.at(kSwitchInput).as<std::string>();
  options.outputPath = cmdLine.at(kSwitchOutput).as<std::string>();
  options.buildDirectory = cmdLine.at(kSwitchBuildDirectory).as<std::string>();

  // default arguments
  options.arguments =
  { {
      "-analyzer-display-progress",
      "-x",
      "c++",
      "-D__SC_REFLECTION_PARSER__",
      "-std=c++11"
    } };

  if (cmdLine.count(kSwitchCompilerFlags))
  {
    auto flagsList = cmdLine.at(kSwitchCompilerFlags).as<std::vector<std::string>>();

    for (std::string & flags : flagsList)
    {
      while (1)
      {
        size_t pos = flags.find(";");
        if (pos == std::string::npos)
          break;
        std::string f = flags.substr(0, pos);
        options.arguments.emplace_back(f);

        flags = flags.substr(pos + 1);
      }

    }
    //for (auto & flag : flags)
    //    options.arguments.emplace_back(flag.c_str());
  }

  std::cout << "Generate reflection code for \"" << options.targetName << "\"" << std::endl;

  ReflectionParser parser(options);

  try
  {
    parser.Parse();
  }
  catch (Exception e)
  {
    std::cerr << "Error: " << e.GetDescription() << std::endl;
  }
}
开发者ID:deniskoronchik,项目名称:sc-machine,代码行数:55,代码来源:Main.cpp

示例2: initialize

void application::initialize(const fc::path& data_dir, const boost::program_options::variables_map& options)
{
   my->_data_dir = data_dir;
   my->_options = &options;

   if( options.count("create-genesis-json") )
   {
      fc::path genesis_out = options.at("create-genesis-json").as<boost::filesystem::path>();
      genesis_state_type genesis_state = detail::create_example_genesis();
      if( fc::exists(genesis_out) )
      {
         try {
            genesis_state = fc::json::from_file(genesis_out).as<genesis_state_type>();
         } catch(const fc::exception& e) {
            std::cerr << "Unable to parse existing genesis file:\n" << e.to_string()
                      << "\nWould you like to replace it? [y/N] ";
            char response = std::cin.get();
            if( toupper(response) != 'Y' )
               return;
         }

         std::cerr << "Updating genesis state in file " << genesis_out.generic_string() << "\n";
      } else {
         std::cerr << "Creating example genesis state in file " << genesis_out.generic_string() << "\n";
      }
      fc::json::save_to_file(genesis_state, genesis_out);

      std::exit(EXIT_SUCCESS);
   }
}
开发者ID:VoR0220,项目名称:graphene,代码行数:30,代码来源:application.cpp

示例3: plugin_initialize

void delayed_node_plugin::plugin_initialize(const boost::program_options::variables_map& options)
{
   FC_ASSERT( options.count( "trusted-node" ) > 0 );
   my->remote_endpoint = "ws://" + options.at("trusted-node").as<std::string>();
}
开发者ID:iamsmooth,项目名称:steem,代码行数:5,代码来源:delayed_node_plugin.cpp

示例4: pimpl

	configuration::configuration(const boost::program_options::variables_map& vars, logger::logger& log) : basic_configuration(vars, log), pimpl(std::make_unique<impl>())
	{
		if (vars.count("input"))
			set_input_filename(vars.at("input").as<std::string>());
	}
开发者ID:Lewerow,项目名称:DetailIdentifier,代码行数:5,代码来源:configuration.cpp

示例5: pimpl

	basic_configuration::basic_configuration(const boost::program_options::variables_map& vars, logger::logger& log) : pimpl(std::make_unique<impl>(&log))
	{
		if (vars.count("working_directory"))
			set_workspace(vars.at("working_directory").as<std::string>());
	}
开发者ID:Lewerow,项目名称:DetailIdentifier,代码行数:5,代码来源:basic_configuration.cpp


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