本文整理汇总了C++中Options::add_options方法的典型用法代码示例。如果您正苦于以下问题:C++ Options::add_options方法的具体用法?C++ Options::add_options怎么用?C++ Options::add_options使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::add_options方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitOptions
void StandardCommandLine::InitOptions(Options& opts) {
Base::InitOptions(opts);
if (IsServerCli()) {
// server cli
opts.add_options()
("R,relay-only", "The server will only relay connections")
("l,bind-address", "Server bind address", cxxopts::value<std::string>());
} else {
// client cli
opts.add_options()
("m,max-connect-attempts",
"Max unsuccessful connection attempts before stopping",
cxxopts::value<uint32_t>()->default_value("1"))
("t,reconnect-delay",
"Time to wait before attempting to reconnect",
cxxopts::value<uint32_t>()->default_value("60"))
("n,no-reconnect",
"Do not attempt to reconnect after loosing a connection")
("server-address", "", cxxopts::value<std::vector<std::string>>());
opts.parse_positional("server-address");
opts.positional_help("server_address");
}
opts.add_options()
("g,gateway-ports", "Enable gateway ports")
("S,status", "Display microservices status");
}
示例2: SetOptions
void MyApp::SetOptions(Options& o, Options& h, Positional& p)
{
namespace po = boost::program_options;
o.add_options()
("all,a", po::bool_switch(&m_checkStores)->default_value(false), "Run a thorough check")
("show", po::bool_switch(&m_show)->default_value(false), "Render and show images, used with -a");
h.add_options()
("in", po::value<String>(&m_seqPath)->default_value(""), "Path to the input sequence database folder");
p.add("in", 1);
}
示例3: parseArgs
void parseArgs(int argc, char* argv[], Options& options) {
options.add_options()
(K_OPT "," L_K_OPT , "K parameter" , value<int>())
(LINK_CAP_OPT "," L_LINK_CAP_OPT, "Link Capacity (in MB)" , value<int>())
(HOST_CAP_OPT "," L_HOST_CAP_OPT, "Host Capacity (in Number of CPUs)", value<int>())
(OUTPUT_OPT "," L_OUTPUT_OPT , "Output File (Default is dc.txt)" , value<string>());
options.parse(argc, argv);
}