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; } }
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); } }
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>(); }
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>()); }
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>()); }