本文整理汇总了C++中Manifest::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Manifest::begin方法的具体用法?C++ Manifest::begin怎么用?C++ Manifest::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifest
的用法示例。
在下文中一共展示了Manifest::begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testManifest
void ManifestTest::testManifest()
{
Manifest<MfTestBase> manifest;
assert (manifest.empty());
assert (manifest.size() == 0);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject1")));
assert (!manifest.empty());
assert (manifest.size() == 1);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject2")));
MetaObject<MfTestObject, MfTestBase>* pMeta = new MetaObject<MfTestObject, MfTestBase>("MfTestObject2");
assert (!manifest.insert(pMeta));
delete pMeta;
assert (!manifest.empty());
assert (manifest.size() == 2);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject3")));
assert (manifest.size() == 3);
assert (manifest.find("MfTestObject1") != manifest.end());
assert (manifest.find("MfTestObject2") != manifest.end());
assert (manifest.find("MfTestObject3") != manifest.end());
assert (manifest.find("MfTestObject4") == manifest.end());
std::set<std::string> classes;
Manifest<MfTestBase>::Iterator it = manifest.begin();
assert (it != manifest.end());
classes.insert(it->name());
++it;
assert (it != manifest.end());
classes.insert(it->name());
++it;
assert (it != manifest.end());
classes.insert(it->name());
it++;
assert (it == manifest.end());
assert (classes.find("MfTestObject1") != classes.end());
assert (classes.find("MfTestObject2") != classes.end());
assert (classes.find("MfTestObject3") != classes.end());
manifest.clear();
assert (manifest.empty());
assert (manifest.size() == 0);
assert (manifest.insert(new MetaObject<MfTestObject, MfTestBase>("MfTestObject4")));
assert (!manifest.empty());
assert (manifest.size() == 1);
it = manifest.begin();
assert (it != manifest.end());
assert (std::string(it->name()) == "MfTestObject4");
++it;
assert (it == manifest.end());
}
示例2:
void
write_manifest(ostream& os)
{
os << "@prefix lv2: <http://lv2plug.in/ns/lv2core#> ." << endl;
os << "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ." << endl;
os << "@prefix uiext: <http://lv2plug.in/ns/extensions/ui#> ." << endl << endl;
for (Manifest::iterator i = manifest.begin(); i != manifest.end(); ++i) {
Record& r = i->second;
os << "<" << i->first << ">\n\ta lv2:Plugin ;" << endl;
os << "\trdfs:seeAlso <" << r.base_name << ".ttl> ;" << endl;
os << "\tlv2:binary <" << r.base_name << ".so> ";
for (Record::UIs::iterator j = r.uis.begin(); j != r.uis.end(); ++j)
os << ";" << endl << "\tuiext:ui <" << *j << "> ";
os << "." << endl << endl;
}
}