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


C++ Create::getObjtype方法代码示例

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


在下文中一共展示了Create::getObjtype方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testValues

void testValues()
{
    Account account;
    Login l;
    account->setId("al");
    account->setAttr("password", std::string("ping"));
    l->setArgs1(account);

    // assert(l->getArgs()[0]->getLongDescription()=="Later in hierarchy tree objtype changes to 'object' when actual game objects are made.");
    // assert(l->getArgs()[0]->getDescription()=="Base class for accounts");
    assert(l->getId()=="");
    assert(l->getParents().front()=="login");
    assert(l->getObjtype()=="op");
    // std::cout<<std::endl<<"account.long_description: "
        // <<l->getArgs()[0]->getLongDescription()<<std::endl;
    
    {
    Atlas::Message::MapType mobj;
    Atlas::Message::ListType parents;
    parents.push_back(std::string("account"));
    mobj["parents"] = parents;
    mobj["name"] = std::string("foo");
    mobj["objtype"] = std::string("op");
    Root obj = Atlas::Objects::Factories::instance()->createObject(mobj);
    assert(obj->getClassNo() == Atlas::Objects::Entity::ACCOUNT_NO);
    assert(obj->getId() == "");
    assert(obj->isDefaultId() == true);
    assert(obj->getName() == "foo");
    assert(obj->isDefaultName() == false);
    assert(obj->getParents().front() == "account");
    //should this be true? modify MessageObject2ClassObject if yes
    assert(obj->isDefaultParents() == false);
    assert(obj->getObjtype() == "op");
    assert(obj->isDefaultObjtype() == false); //should this be true? 
    // assert(obj->getDescription() == "Base class for accounts");
    // assert(obj->isDefaultDescription() == true);
    }
    
    {
    Atlas::Message::MapType mobj;
    Root obj = Atlas::Objects::objectDefinitions.find(std::string("account"))->second;
    assert(obj->getClassNo() == Atlas::Objects::Entity::ACCOUNT_NO);
    assert(obj->getId() == "account");
    assert(obj->isDefaultId() == false);
    assert(obj->getName() == "");
    assert(obj->isDefaultName() == true);
    assert(obj->getParents().front() == "admin_entity");
    assert(obj->isDefaultParents() == false);
    assert(obj->getObjtype() == "class");
    assert(obj->isDefaultObjtype() == false);
    // assert(obj->getDescription() == "Base class for accounts");
    // assert(obj->isDefaultDescription() == false);
    }

    {
    Atlas::Message::MapType mobj;
    Root obj = Atlas::Objects::Factories::instance()->createObject(mobj);
    assert(obj->getClassNo() == Atlas::Objects::Entity::ANONYMOUS_NO);
    assert(obj->getId() == "");
    assert(obj->getName() == "");
    assert(obj->getParents().size() == 0);
    assert(obj->getObjtype() == "obj");
    // assert(obj->getDescription() == "");
    }

    {
    Atlas::Message::MapType mobj;
    mobj["id"] = std::string("bar");
    mobj["name"] = std::string("foo");
    Atlas::Message::ListType parents;
    parents.push_back(std::string("account"));
    mobj["parents"] = parents;
    Root obj = Atlas::Objects::Factories::instance()->createObject(mobj);
    assert(obj->getClassNo() == Atlas::Objects::Entity::ANONYMOUS_NO);
    assert(obj->getId() == "bar");
    assert(obj->getName() == "foo");
    assert(obj->getParents().front() == "account");
    assert(obj->getObjtype() == "obj");
    // assert(obj->getDescription() == "");
    }

    {
    Atlas::Message::MapType maccount;
    maccount["id"] = std::string("bar");
    maccount["name"] = std::string("foo");
    Atlas::Message::ListType parents;
    parents.push_back(std::string("player"));
    maccount["parents"] = parents;
    maccount["objtype"] = "obj";

    Atlas::Message::MapType mcreate;
    mcreate["from"] = std::string("bar");
    Atlas::Message::ListType parents2;
    parents2.push_back(std::string("create"));
    mcreate["parents"] = parents2;
    Atlas::Message::ListType args;
    args.push_back(maccount);
    mcreate["args"] = args;
    mcreate["objtype"] = "op";

//.........这里部分代码省略.........
开发者ID:danniellecandys,项目名称:atlas-cpp,代码行数:101,代码来源:objects2.cpp


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