本文整理汇总了C++中Anonymous类的典型用法代码示例。如果您正苦于以下问题:C++ Anonymous类的具体用法?C++ Anonymous怎么用?C++ Anonymous使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Anonymous类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MemEntity
void BaseMindMapEntityintegration::test_MemMapreadEntity_changeloc()
{
MemEntity * tlve = new MemEntity("0", 0);
tlve->m_contains = new LocatedEntitySet;
m_mind->m_map.m_entities[0] = tlve;
MemEntity * e2 = new MemEntity("2", 2);
e2->m_contains = new LocatedEntitySet;
e2->m_location.m_loc = tlve;
tlve->m_contains->insert(e2);
m_mind->m_map.m_entities[2] = e2;
MemEntity * e3 = new MemEntity("3", 3);
e3->m_contains = new LocatedEntitySet;
e3->m_location.m_loc = e2;
e2->m_contains->insert(e3);
m_mind->m_map.m_entities[3] = e3;
ASSERT_EQUAL(m_mind->m_map.m_entities.size(), 4u);
Anonymous data;
data->setLoc(tlve->getId());
// Read in entity data that changes the LOC of e3 from e2 to TLVE
m_mind->m_map.readEntity(e3, data);
ASSERT_EQUAL(e3->m_location.m_loc, tlve)
ASSERT_TRUE(e2->m_contains->find(e3) == e2->m_contains->end());
ASSERT_TRUE(tlve->m_contains->find(e3) != tlve->m_contains->end());
}
示例2: Entity
void Admintest::test_SetOperation_obj_IG()
{
Account_SetOperation_called = 0;
long cid = m_id_counter++;
Entity * c = new Entity(compose("%1", cid), cid);
m_account->m_charactersDict.insert(std::make_pair(cid, c));
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId(c->getId());
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(Account_SetOperation_called, m_account);
// The operation returned would have come from Account::SetOperation
// but that is stubbed out
ASSERT_EQUAL(res.size(), 0u);
delete c;
}
示例3: Admin
void Admintest::test_LogoutOperation_other_but_unconnected()
{
Account_LogoutOperation_called = 0;
m_account->m_connection = 0;
long cid = m_id_counter++;
std::string cid_str = String::compose("%1", cid);
Account * ac2 = new Admin(0,
"f3332c00-5d2b-45c1-8cf4-3429bdf2845f",
"c0e095f0-575c-477c-bafd-2055d6958d4d",
cid_str, cid);
m_server->addObject(ac2);
ASSERT_EQUAL(m_server->getObject(cid_str), ac2);
Atlas::Objects::Operation::Logout op;
OpVector res;
Anonymous arg;
arg->setId(cid_str);
op->setArgs1(arg);
m_account->LogoutOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
ASSERT_NULL(Account_LogoutOperation_called);
delete ac2;
}
示例4: assert
void World::LookOperation(const Operation & op, OpVector & res)
{
// We must be the top level entity
assert(m_location.m_parent == nullptr);
// We must contains something, or where the hell did the look come from?
assert(m_contains != nullptr);
//The top level entity is a little special, since its properties can be inspected by all entities, although it's children can not.
//First check if there's a movement domain. If so we'll handle Look ops just like usually. However, if not we'll send the properties sans the "contains" property.
auto from = BaseWorld::instance().getEntity(op->getFrom());
if (!from) {
log(ERROR, String::compose("Look op has invalid from %1. %2", op->getFrom(), describeEntity()));
return;
}
Domain* domain = nullptr;
if (m_location.m_parent) {
domain = m_location.m_parent->getDomain();
}
if (domain) {
generateSightOp(*from, op, res);
} else {
Sight s;
Anonymous sarg;
addToEntity(sarg);
//Hide all contents of the root entity.
sarg->removeAttr("contains");
s->setArgs1(sarg);
s->setTo(op->getFrom());
res.push_back(s);
}
}
示例5: test_GetOperation_rule_found
void Admintest::test_GetOperation_rule_found()
{
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("class");
arg->setId("root");
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
const Operation & reply = res.front();
ASSERT_EQUAL(reply->getClassNo(),
Atlas::Objects::Operation::INFO_NO);
ASSERT_EQUAL(reply->getArgs().size(), 1u);
const Root & reply_arg = reply->getArgs().front();
ASSERT_TRUE(!reply_arg->isDefaultId());
ASSERT_EQUAL(reply_arg->getId(), "root");
}
示例6: S_LOG_WARNING
bool EntityImporterBase::getRule(const std::string & id, OpVector & res)
{
auto I = mPersistedRules.find(id);
if (I == mPersistedRules.end()) {
S_LOG_WARNING("Could not find rule with id " << id << ".");
return false;
}
auto definition = I->second;
m_state = RULE_WALKING;
std::list<std::string> children;
extractChildren(definition, children);
RuleStackEntry entry = { id, definition, children };
mRuleStack.push_back(entry);
Get get;
Anonymous arg;
arg->setId(id);
get->setArgs1(arg);
// get->setObjtype("op");
get->setSerialno(newSerialNumber());
res.push_back(get);
Anonymous get_arg;
get_arg->setId(id);
get_arg->setObjtype("obj");
return true;
}
示例7: test_check_fail
// check() empty description
void PropertyRuleHandlertest::test_check_fail()
{
Anonymous description;
description->setParents(std::list<std::string>(1, "foo"));
int ret = rh->check(description);
assert(ret == -1);
}
示例8: test_addToEntity_tree
void Admintest::test_addToEntity_tree()
{
Anonymous data;
m_account->addToEntity(data);
ASSERT_TRUE(data->hasAttr("character_types"));
ASSERT_EQUAL(data->getAttr("character_types"), ListType());
}
示例9: test_check_pass
// check() description with op_definition objtype
void PropertyRuleHandlertest::test_check_pass()
{
Anonymous description;
description->setObjtype("type");
description->setParents(std::list<std::string>(1, "foo"));
int ret = rh->check(description);
assert(ret == 0);
}
示例10: if
void InventoryDomain::processVisibilityForMovedEntity(const LocatedEntity& moved_entity, const Location& old_loc, OpVector & res)
{
if (m_entity.m_contains) {
std::vector<LocatedEntity*> visibleEntities;
std::unordered_set<int> outfitted;
LocatedEntity* rightHandWieldedEntity = nullptr;
const OutfitProperty* outfitProperty = m_entity.getPropertyClass<OutfitProperty>("outfit");
if (outfitProperty) {
for (auto& entry : outfitProperty->data()) {
outfitted.insert(entry.second->getIntId());
}
}
const EntityProperty* rightHandWieldProperty = m_entity.getPropertyClass<EntityProperty>("right_hand_wield");
if (rightHandWieldProperty) {
rightHandWieldedEntity = rightHandWieldProperty->data().get();
}
for (auto childEntity : *m_entity.m_contains) {
if (childEntity == rightHandWieldedEntity) {
visibleEntities.push_back(childEntity);
} else if (outfitted.find(childEntity->getIntId()) != outfitted.end()) {
visibleEntities.push_back(childEntity);
}
}
std::set<std::string> newVisibleEntities;
for (auto visibleEntity : visibleEntities) {
if (m_lastVisibleEntities.find(visibleEntity->getId()) == m_lastVisibleEntities.end()) {
Anonymous ent;
ent->setId(visibleEntity->getId());
ent->setStamp(visibleEntity->getSeq());
Appearance d;
d->setArgs1(ent);
res.push_back(d);
} else {
m_lastVisibleEntities.erase(visibleEntity->getId());
}
newVisibleEntities.insert(visibleEntity->getId());
}
for (auto entityId : m_lastVisibleEntities) {
Anonymous ent;
ent->setId(entityId);
Disappearance d;
d->setArgs1(ent);
res.push_back(d);
}
m_lastVisibleEntities = std::move(newVisibleEntities);
}
}
示例11: test_install_noparent
void PropertyRuleHandlertest::test_install_noparent()
{
Anonymous description;
description->setObjtype("type");
std::string dependent, reason;
int ret = rh->install("new_int_type", "int", description, dependent, reason);
assert(ret == 0);
}
示例12: del
void CreatorClient::del(const std::string & id)
{
Delete op;
Anonymous ent;
ent->setId(id);
op->setArgs1(ent);
op->setFrom(getId());
op->setTo(id);
return send(op);
}
示例13: sendLook
LocatedEntity * CharacterClient::look(const std::string & id)
{
Look op;
if (!id.empty()) {
Anonymous ent;
ent->setId(id);
op->setArgs1(ent);
}
op->setFrom(getId());
return sendLook(op);
}
示例14: test_addToEntity
void Playertest::test_addToEntity()
{
Player::playableTypes.insert("settler");
Anonymous data;
m_account->addToEntity(data);
ASSERT_TRUE(data->hasAttr("character_types"));
ASSERT_EQUAL(data->getAttr("character_types"), ListType(1, "settler"));
}
示例15: getRule
void RuleTraversalTask::getRule(const std::string & id, OpVector & res)
{
Get get;
Anonymous arg;
arg->setId(id);
get->setArgs1(arg);
get->setObjtype("op");
get->setSerialno(newSerialNo());
mSerial = get->getSerialno();
res.push_back(get);
}