当前位置: 首页>>代码示例>>C++>>正文


C++ Manifest::empty方法代码示例

本文整理汇总了C++中Manifest::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Manifest::empty方法的具体用法?C++ Manifest::empty怎么用?C++ Manifest::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Manifest的用法示例。


在下文中一共展示了Manifest::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
开发者ID:ConfusedReality,项目名称:pkg_network_poco,代码行数:52,代码来源:ManifestTest.cpp


注:本文中的Manifest::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。