本文整理汇总了C++中Option::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Option::getValue方法的具体用法?C++ Option::getValue怎么用?C++ Option::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: option_i
TEST(OptionsTest, test_option_writing)
{
const Option option_i("my_int", (uint16_t)17);
EXPECT_TRUE(option_i.getName() == "my_int");
EXPECT_TRUE(option_i.getValue() == "17");
const Option option_s("my_string", "Yow.");
EXPECT_TRUE(option_s.getName() == "my_string");
EXPECT_TRUE(option_s.getValue() == "Yow.");
EXPECT_TRUE(option_s.getValue() == "Yow.");
}
示例2: option_i
TEST(OptionsTest, test_option_writing)
{
std::ostringstream ostr_i;
const std::string ref_i = xml_header + xml_int_ref;
std::ostringstream ostr_s;
const std::string ref_s = xml_header + xml_str_ref;
const Option option_i("my_int", (uint16_t)17);
EXPECT_TRUE(option_i.getName() == "my_int");
EXPECT_TRUE(option_i.getValue() == "17");
const Option option_s("my_string", "Yow.");
EXPECT_TRUE(option_s.getName() == "my_string");
EXPECT_TRUE(option_s.getValue() == "Yow.");
EXPECT_TRUE(option_s.getValue() == "Yow.");
}
示例3: if
Stage *PipelineReaderXML::parseElement_Writer(const ptree& tree)
{
Options options;
StageParserContext context;
std::string filename;
map_t attrs;
collect_attributes(attrs, tree);
std::vector<Stage *> prevStages;
for (auto iter = tree.begin(); iter != tree.end(); ++iter)
{
const std::string& name = iter->first;
const ptree& subtree = iter->second;
if (name == "<xmlattr>")
{
// already parsed -- ignore it
}
else if (name == "Option")
{
Option option = parseElement_Option(subtree);
if (option.getName() == "filename")
filename = option.getValue();
options.add(option);
}
else if (name == "Metadata")
{
// ignored
}
else if (name == "Filter" || name == "Reader")
{
context.addStage();
prevStages.push_back(parseElement_anystage(name, subtree));
}
else
{
context.addUnknown(name);
}
}
std::string type;
if (attrs.count("type"))
{
type = attrs["type"];
context.addType();
}
context.validate();
Stage& writer = m_manager.makeWriter(filename, type);
for (auto sp : prevStages)
writer.setInput(*sp);
writer.removeOptions(options);
writer.addOptions(options);
return &writer;
}
示例4: option_j
TEST(OptionsTest, json)
{
// Test that a JSON option will be stringified into the option's underlying
// value.
Json::Value inJson;
inJson["key"] = 42;
const Option option_j("my_json", inJson);
EXPECT_TRUE(option_j.getName() == "my_json");
// Don't string-compare, test JSON-equality, since we don't care exactly
// how it's stringified.
Json::Value outJson;
Json::Reader().parse(option_j.getValue(), outJson);
EXPECT_EQ(inJson, outJson) << inJson << " != " << outJson;
}