本文整理汇总了C++中abstractconfiguration::Keys::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Keys::clear方法的具体用法?C++ Keys::clear怎么用?C++ Keys::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类abstractconfiguration::Keys
的用法示例。
在下文中一共展示了Keys::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testRemove
void LayeredConfigurationTest::testRemove()
{
AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
AutoPtr<MapConfiguration> pMC1 = new MapConfiguration;
AutoPtr<MapConfiguration> pMC2 = new MapConfiguration;
pMC1->setString("prop1", "value1");
pMC1->setString("prop2", "value2");
pMC2->setString("prop2", "value3");
pMC2->setString("prop3", "value4");
pLC->add(pMC1, 0);
pLC->add(pMC2, -1);
AbstractConfiguration::Keys keys;
pLC->keys(keys);
assert (keys.size() == 3);
assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end());
assert (pLC->getString("prop1") == "value1");
assert (pLC->getString("prop2") == "value3");
assert (pLC->getString("prop3") == "value4");
pLC->removeConfiguration(pMC2);
keys.clear();
pLC->keys(keys);
assert (keys.size() == 2);
assert (pLC->getString("prop1") == "value1");
assert (pLC->getString("prop2") == "value2");
}