本文整理汇总了C++中OptionsList::getEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionsList::getEntry方法的具体用法?C++ OptionsList::getEntry怎么用?C++ OptionsList::getEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionsList
的用法示例。
在下文中一共展示了OptionsList::getEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: args
using dataTypes::OptionEntry;
TEST_FUNCTION(10) {
std::vector<std::string> args({"--test-argument-value-space", "argument value", "--test-argument-value-equals",
"=sample", "some/file/path", "--test-boolean"});
OptionsList opts;
opts.addEntry(OptionEntry(dataTypes::OptionArgumentType::OptionArgumentFilename, 0, "test-argument-value-space",
"Test passing argument for the value with space", nullptr, "name"));
opts.addEntry(OptionEntry(dataTypes::OptionArgumentType::OptionArgumentFilename, 0, "test-argument-value-equals",
"Test passing argument for the value with equals", nullptr, "name"));
opts.addEntry(
OptionEntry(dataTypes::OptionArgumentType::OptionArgumentLogical, 0, "test-boolean", "Test boolean value"));
int retVal = 0;
ensure("Unable to parse command line", opts.parse(args, retVal));
ensure("incorrect test-boolean", opts.getEntry("test-boolean")->value.logicalValue);
ensure_equals("incorrect test-argument-value-equals", opts.getEntry("test-argument-value-equals")->value.textValue,
"=sample");
ensure_equals("incorrect test-argument-value-space", opts.getEntry("test-argument-value-space")->value.textValue,
"argument value");
ensure("incorrect number of leftover values", opts.pathArgs.size() == 1);
ensure_equals("incorrect leftover value", opts.pathArgs[0], "some/file/path");
}
TEST_FUNCTION(20) {
std::vector<std::string> args({"--test-return-value", "--test-callback", "--test-argument-value-space",
"argument value", "--test-argument-value-equals", "=sample", "some/file/path",
"--test-boolean"});
OptionsList opts;
opts.addEntry(
OptionEntry(dataTypes::OptionArgumentType::OptionArgumentLogical, 0, "test-boolean", "Test boolean value"));