本文整理汇总了C++中moe::OptionSection::addOption方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionSection::addOption方法的具体用法?C++ OptionSection::addOption怎么用?C++ OptionSection::addOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moe::OptionSection
的用法示例。
在下文中一共展示了OptionSection::addOption方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addMongoShellOptions
Status addMongoShellOptions(moe::OptionSection* options) {
typedef moe::OptionDescription OD;
typedef moe::PositionalOptionDescription POD;
Status ret = options->addOption(OD("shell", "shell", moe::Switch,
"run the shell after executing files", true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("nodb", "nodb", moe::Switch,
"don't connect to mongod on startup - no 'db address' arg expected", true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("norc", "norc", moe::Switch,
"will not run the \".mongorc.js\" file on start up", true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("quiet", "quiet", moe::Switch, "be less chatty", true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("port", "port", moe::String, "port to connect to" , true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("host", "host", moe::String, "server to connect to" , true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("eval", "eval", moe::String, "evaluate javascript" , true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("username", "username,u", moe::String,
"username for authentication" , true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("password", "password,p", moe::String,
"password for authentication" , true, moe::Value(), moe::Value(std::string(""))));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("authenticationDatabase", "authenticationDatabase", moe::String,
"user source (defaults to dbname)" , true, moe::Value(std::string(""))));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("authenticationMechanism", "authenticationMechanism", moe::String,
"authentication mechanism", true, moe::Value(std::string("MONGODB-CR"))));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("help", "help,h", moe::Switch, "show this usage information",
true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("version", "version", moe::Switch, "show version information",
true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("verbose", "verbose", moe::Switch, "increase verbosity", true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("ipv6", "ipv6", moe::Switch,
"enable IPv6 support (disabled by default)", true));
if (!ret.isOK()) {
return ret;
}
#ifdef MONGO_SSL
ret = options->addOption(OD("ssl", "ssl", moe::Switch, "use SSL for all connections", true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("ssl.CAFile", "sslCAFile", moe::String,
"Certificate Authority for SSL" , true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("ssl.PEMKeyFile", "sslPEMKeyFile", moe::String,
"PEM certificate/key file for SSL" , true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("ssl.PEMKeyPassword", "sslPEMKeyPassword", moe::String,
"password for key in PEM file for SSL" , true));
if (!ret.isOK()) {
return ret;
}
ret = options->addOption(OD("ssl.CRLFile", "sslCRLFile", moe::String,
"Certificate Revocation List file for SSL", true));
if (!ret.isOK()) {
return ret;
}
//.........这里部分代码省略.........