本文整理汇总了C++中ObjectType::get_first_child方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectType::get_first_child方法的具体用法?C++ ObjectType::get_first_child怎么用?C++ ObjectType::get_first_child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectType
的用法示例。
在下文中一共展示了ObjectType::get_first_child方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
//.........这里部分代码省略.........
test.validate (
"test become_parent",
(newKitty == anotherCaracal) &&
newKitty.become_parent () &&
(newKitty == anotherCat));
// </validate accessor functions>
// ============================================================================ //
// <validate lookup functions>
String data;
anotherCaracal.get_config ().lookup_attribute ("info.texture", data);
test.validate (
"test lookup_attribute",
!data);
String data2, data3;
Config returnCaracalData;
test.validate (
"test lookup_config",
anotherCaracal.get_config ().lookup_all_config_merged ("info", returnCaracalData));
test.validate (
"test lookup_config->lookup_attribute -- success",
returnCaracalData.lookup_attribute ("ears", data2) &&
data2 == "awesome");
test.validate (
"test lookup_config->lookup_attribute -- failure",
!returnCaracalData.lookup_attribute ("howTo", data3) &&
!data3);
// test.log.out << "M: <" << data2 << ">" << endl;
// test.log.out << "M: <" << data3 << ">" << endl;
test.validate (
"test lookup_all_config",
anotherCaracal.get_config ().lookup_all_config ("info", returnCaracalData));
ConfigIterator dataIt;
Config moreSpecificData;
test.validate (
"test lookup_all_config->get_first_config",
returnCaracalData.get_first_config (dataIt, moreSpecificData));
ConfigIterator it;
String dataName, dataValue;
test.validate (
"test lookup_all_config->get_first_attribute",
moreSpecificData.get_first_attribute (it, dataName, dataValue) &&
(dataName == "ears") &&
(dataValue == "awesome"));
test.validate (
"test lookup_all_config->get_next_attribute",
moreSpecificData.get_next_attribute (it, dataName, dataValue) &&
(dataName == "madeOf") &&
(dataValue == "win"));
test.validate (
"test lookup_all_config->get_next_attribute (failure)",
!moreSpecificData.get_next_attribute (it, dataName, dataValue));
// test.log.out << "M: <" << dataName1 << ":" << dataValue1 << ">" << endl;
// test.log.out << "M: <" << dataName2 << ":" << dataValue2 << ">" << endl;
test.validate (
"test lookup_all_config->get_next_config",
returnCaracalData.get_next_config (dataIt, moreSpecificData));
test.validate (
"test lookup_all_config->get_first_attribute",
moreSpecificData.get_first_attribute (it, dataName, dataValue) &&
(dataName == "motivation") &&
(dataValue == "evil"));
// test.log.out << "M: <" << dataName << ":" << dataValue << ">" << endl;
// </validate lookup functions>
// ============================================================================ //
// <validate child iterator functions>
ObjectTypeIterator oIt;
ObjectType otype;
test.validate (
"test iterator get_first_child ()",
anotherCat.get_first_child (oIt, otype) &&
otype == anotherCaracal);
ObjectType aServal("serval", context);
test.validate (
"test iterator get_next_child ()",
anotherCat.get_next_child (oIt, otype) &&
otype == aServal);
test.validate (
"test iterator get_next_child ()",
!anotherCat.get_next_child (oIt, otype));
// </validate child iterator functions>
// ============================================================================ //
return test.result ();
}