本文整理汇总了C++中OptionSet::addOption方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionSet::addOption方法的具体用法?C++ OptionSet::addOption怎么用?C++ OptionSet::addOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionSet
的用法示例。
在下文中一共展示了OptionSet::addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defineOptions
void defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);
options.addOption(
Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false)
.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::handleHelp)));
options.addOption(
Option("server", "S", "running in server mode")
.required(false)
.repeatable(false)
.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::startServer)));
options.addOption(
Option("host", "H", "IP of FileTransfer server")
.required(false)
.repeatable(false)
.argument("IP address (x.x.x.x)")
.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::setHost)));
options.addOption(
Option("port", "P", "Port of FileTransfer server")
.required(false)
.repeatable(false)
.argument("port number")
.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::setPort)));
options.addOption(
Option("file", "F", "file path to transfer")
.required(false)
.repeatable(false)
.argument("file")
.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::setFile)));
}
示例2: defineOptions
void check_ortho::defineOptions(OptionSet& options)
{
Application::defineOptions(options);
options.addOption(
Option("help", "h", "mostra le informazioni sui parametri da specificare")
.required(false)
.repeatable(false)
.callback(OptionCallback<check_ortho>(this, &check_ortho::handleHelp)));
options.addOption(
Option("dir", "d", "Specifica la cartella del progetto")
.required(false)
.repeatable(false)
.argument("value")
.callback(OptionCallback<check_ortho>(this, &check_ortho::handlePrjDir)));
options.addOption(
Option("img", "i", "Specifica la cartella delle ortho immagini")
.required(false)
.repeatable(false)
.argument("value")
.callback(OptionCallback<check_ortho>(this, &check_ortho::handleImgDir)));
//options.addOption(
// Option("scale", "s", "Specifica la scala di lavoro")
// .required(false)
// .repeatable(false)
// .argument("value")
// .callback(OptionCallback<check_ortho>(this, &check_ortho::handleScale)));
}
示例3: defineOptions
void defineOptions(OptionSet& options)
{
Application::defineOptions(options);
options.addOption(
Option("help", "h", "Display help information on command line arguments.")
.required(false)
.repeatable(false)
.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleHelp)));
options.addOption(
Option("output", "o", "Specify base directory for extracted files.")
.required(false)
.repeatable(false)
.argument("path")
.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleOutput)));
options.addOption(
Option("list", "l", "List files and directories in archive.")
.required(false)
.repeatable(false)
.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleList)));
options.addOption(
Option("extract", "x", "Extract single file or entire archive.")
.required(false)
.repeatable(false)
.argument("file", false)
.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleExtract)));
}
示例4: defineOptions
void defineOptions(OptionSet& options)
{
Application::defineOptions(options);
options.addOption(
Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false)
.callback(OptionCallback<TweetApp>(this, &TweetApp::handleHelp)));
options.addOption(
Option("username", "u", "specify the Twitter user/account name")
.required(true)
.repeatable(false)
.argument("account")
.callback(OptionCallback<TweetApp>(this, &TweetApp::handleUsername)));
options.addOption(
Option("password", "p", "specify the Twitter password")
.required(true)
.repeatable(false)
.argument("password")
.callback(OptionCallback<TweetApp>(this, &TweetApp::handlePassword)));
options.addOption(
Option("message", "m", "specify the status message")
.required(false)
.repeatable(true)
.argument("message")
.callback(OptionCallback<TweetApp>(this, &TweetApp::handleMessage)));
}
示例5: defineOptions
void defineOptions(OptionSet& options)
{
Application::defineOptions(options);
options.addOption(
Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false)
.callback(OptionCallback<configuracao>(this, &configuracao::handleHelp)));
options.addOption(
Option("define", "D", "define a configuration property")
.required(false)
.repeatable(true)
.argument("name=value")
.callback(OptionCallback<configuracao>(this, &configuracao::handleDefine)));
options.addOption(
Option("config-file", "f", "load configuration data from a file")
.required(false)
.repeatable(true)
.argument("file")
.callback(OptionCallback<configuracao>(this, &configuracao::handleConfig)));
options.addOption(
Option("bind", "b", "bind option value to test.property")
.required(false)
.repeatable(false)
.argument("value")
.binding("test.property"));
}
示例6: defineOptions
void BeeServer::defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);
options.addOption(
Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false)
.callback(OptionCallback<BeeServer>(this, &BeeServer::handleHelp)));
options.addOption(
Option("stop", "stop", "stop process.")
.required(false)
.repeatable(false)
.argument("taskids w/o arguments", false)
.callback(OptionCallback<BeeServer>(this, &BeeServer::stop)));
options.addOption(
Option("start", "start", "start process.")
.required(false)
.repeatable(false)
.argument("taskids w/o arguments", false)
.callback(OptionCallback<BeeServer>(this, &BeeServer::start)));
options.addOption(
Option("query", "q", "query process state.")
.required(false)
.repeatable(false)
.argument("taskids w/o arguments", false)
.callback(OptionCallback<BeeServer>(this, &BeeServer::query)));
}
示例7: defineOptions
void defineOptions(OptionSet& options) {
ServerApplication::defineOptions(options);
options.addOption(
Option("log", "l", "Log level argument, must be beetween 0 and 8 : nothing, fatal, critic, error, warn, note, info, debug, trace. Default value is 6 (info), all logs until info level are displayed.")
.required(false)
.argument("level")
.repeatable(false));
options.addOption(
Option("dump", "d", "Enables packet traces in logs. Optional arguments are 'middle' or 'all' respectively to displays just middle packet process or all packet process. If no argument is given, just outside packet process will be dumped.",false,"middle|all",false)
.repeatable(false));
options.addOption(
Option("cirrus", "c", "Cirrus address to activate a 'man-in-the-middle' developer mode in bypassing flash packets to the official cirrus server of your choice, it's a instable mode to help Cumulus developers, \"p2p.rtmfp.net:10000\" for example. By adding the 'dump' argument, you will able to display Cirrus/Flash packet exchange in your logs (see 'dump' argument).",false,"address",true)
.repeatable(false));
options.addOption(
Option("middle", "m","Enables a 'man-in-the-middle' developer mode between two peers. It's a instable mode to help Cumulus developers. By adding the 'dump' argument, you will able to display Flash/Flash packet exchange in your logs (see 'dump' argument).")
.repeatable(false));
options.addOption(
Option("help", "h", "Displays help information about command-line usage.")
.required(false)
.repeatable(false));
}
示例8: testHelpFormatter
void HelpFormatterTest::testHelpFormatter()
{
OptionSet set;
set.addOption(
Option("include-dir", "I", "specify a search path for locating header files")
.required(false)
.repeatable(true)
.argument("path"));
set.addOption(
Option("library-dir", "L", "specify a search path for locating library files (this option has a very long description)")
.required(false)
.repeatable(true)
.argument("path"));
set.addOption(
Option("output", "o", "specify the output file", true)
.argument("file", true));
set.addOption(
Option("verbose", "v")
.description("enable verbose mode")
.required(false)
.repeatable(false));
set.addOption(
Option("optimize", "O")
.description("enable optimization")
.required(false)
.repeatable(false)
.argument("level", false));
HelpFormatter formatter(set);
formatter.format(std::cout);
formatter.setCommand("cc");
formatter.format(std::cout);
formatter.setUsage("OPTIONS FILES");
formatter.setHeader("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
"Vivamus volutpat imperdiet massa. Nulla at ipsum vitae risus facilisis posuere. "
"Cras convallis, lacus ac vulputate convallis, metus nisl euismod ligula, "
"ac euismod diam wisi in dolor.\nMauris vitae leo.");
formatter.setFooter("Cras semper mollis tellus. Mauris eleifend mauris et lorem. "
"Etiam odio dolor, fermentum quis, mollis nec, sodales sed, tellus. "
"Quisque consequat orci eu augue. Aliquam ac nibh ac neque hendrerit iaculis.");
formatter.format(std::cout);
formatter.setUnixStyle(false);
formatter.format(std::cout);
formatter.setHeader("");
formatter.setFooter("tab: a\tb\tcde\tf\n\ta\n\t\tb");
formatter.format(std::cout);
}
示例9: defineOptions
//============================================================================//
void SmitlabService::defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);
options.addOption(Option("help", "h",
"display help information for command line arguments"));
options.addOption(Option("config-file", "f",
"load configuration data from a file", false, "path", true));
}
示例10: defineOptions
void defineOptions(OptionSet& options) {
Application::defineOptions(options);
options.addOption(
Option("help", "h", "display help information")
.required(false)
.repeatable(false)
.callback(OptionCallback<WebSocketClient>(this, &WebSocketClient::HandleHelp)));
options.addOption(
Option("uri", "u", "Address to server e.g. ws://127.0.0.1:3001/")
.required(true)
.repeatable(false)
.argument("addr")
.callback(OptionCallback<WebSocketClient>(this, &WebSocketClient::HandleURI)));
}
示例11: defineOptions
void ServerApplication::defineOptions(OptionSet& options)
{
Application::defineOptions(options);
options.addOption(
Option("daemon", "", "run application as a daemon")
.required(false)
.repeatable(false));
options.addOption(
Option("pidfile", "", "write PID to given file")
.required(false)
.repeatable(false)
.argument("path"));
}
示例12: defineOptions
void defineOptions(OptionSet& options)
{
Application::defineOptions(options);
options.addOption(
Option("help", "h", "Display help information on command line arguments.")
.required(false)
.repeatable(false)
.callback(OptionCallback<ProcessKillerApp>(this, &ProcessKillerApp::handleHelp)));
options.addOption(
Option("friendly", "f", "Kindly ask application to shut down.")
.required(false)
.repeatable(false)
.callback(OptionCallback<ProcessKillerApp>(this, &ProcessKillerApp::handleFriendly)));
}
示例13: defineOptions
void defineOptions(OptionSet& options)
{
options.addOption(
Option("help", "h", "display help")
.required(false)
.repeatable(false)
);
}
示例14: defineOptions
void defineOptions(OptionSet& options)
{
Application::defineOptions(options);
options.addOption(
Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false)
.callback(OptionCallback<ZipApp>(this, &ZipApp::handleHelp)));
options.addOption(
Option("file", "f", "specifies the output zip file")
.required(true)
.repeatable(false)
.argument("filename")
.callback(OptionCallback<ZipApp>(this, &ZipApp::handleFile)));
}
示例15: createOption
void ComputeApp::createOption(OptionSet& options, OptionsCallback handler, std::string arg, std::string shorthand)
{
OptionCallback<ComputeApp> optionCallback(this, handler);
Option option(arg, shorthand, "", false);
option.callback(optionCallback);
option.repeatable(false);
options.addOption(option);
}