本文整理汇总了C++中PropertyMap::find方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyMap::find方法的具体用法?C++ PropertyMap::find怎么用?C++ PropertyMap::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyMap
的用法示例。
在下文中一共展示了PropertyMap::find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
PropertyMap *
Event::find(const PropertyName &name, PropertyMap::iterator &i)
{
PropertyMap *map = m_data->m_properties;
if (!map || ((i = map->find(name)) == map->end())) {
map = m_nonPersistentProperties;
if (!map) return 0;
i = map->find(name);
if (i == map->end()) return 0;
}
return map;
}
示例2: get
const std::shared_ptr<ValueImpl>& get(const std::string& propertyName) const override
{
auto val = properties.find(propertyName);
if (val == properties.end())
{
D6_THROW(JsonException, std::string("Property ") + propertyName + " not found");
}
return val->second;
}
示例3: minimum_spanning_tree_prim
edge_list minimum_spanning_tree_prim(const Graph & g, const PropertyMap & p, vertex start)
{
using Value = typename PropertyMap::mapped_type;
return detail::minimum_spanning_tree_prim<Value>(g, start, [&p](edge e) -> Value {
auto const i = p.find(e);
if (i != p.end())
return i->second;
return {};
});
}
示例4: testInsertAndExtract
void testInsertAndExtract()
{
ScopedFileCopy copy("matroska", ".mka");
string filename = copy.fileName();
{
EBML::Matroska::File f1(filename.c_str());
CPPUNIT_ASSERT(f1.isValid());
Tag* t = f1.tag();
CPPUNIT_ASSERT(t != 0);
t->setTitle("Seconds of Silence");
t->setArtist("Nobody");
t->setAlbum("TagLib Test Suite");
t->setComment("Well, there's nothing to say - a few special signs: ©’…ä–€ſ");
t->setGenre("Air");
t->setYear(2013);
t->setTrack(15);
CPPUNIT_ASSERT(f1.save());
}
{
EBML::Matroska::File f2(filename.c_str());
CPPUNIT_ASSERT(f2.isValid());
Tag* t = f2.tag();
CPPUNIT_ASSERT(t != 0);
CPPUNIT_ASSERT_EQUAL(String("Seconds of Silence"), t->title());
CPPUNIT_ASSERT_EQUAL(String("Nobody"), t->artist());
CPPUNIT_ASSERT_EQUAL(String("TagLib Test Suite"), t->album());
CPPUNIT_ASSERT_EQUAL(String("Well, there's nothing to say - a few special signs: ©’…ä–€ſ"), t->comment());
CPPUNIT_ASSERT_EQUAL(String("Air"), t->genre());
CPPUNIT_ASSERT_EQUAL(2013u, t->year());
CPPUNIT_ASSERT_EQUAL(15u, t->track());
PropertyMap pm = f2.properties();
pm.erase("COMMENT");
f2.setProperties(pm);
CPPUNIT_ASSERT(f2.save());
}
{
EBML::Matroska::File f3(filename.c_str());
CPPUNIT_ASSERT(f3.isValid());
PropertyMap pm = f3.properties();
PropertyMap::Iterator i = pm.find("GENRE");
CPPUNIT_ASSERT(i != pm.end());
CPPUNIT_ASSERT_EQUAL(String("Air"), i->second.front());
}
}
示例5: constructBuddy
BuddyPtr XMPPAccountHandler::constructBuddy(const PropertyMap& vProps)
{
PropertyMap::const_iterator pos = vProps.find("name");
if (pos != vProps.end())
{
UT_return_val_if_fail(pos->second.size() > 0, XMPPBuddyPtr());
UT_DEBUGMSG(("Constructing buddy (%s)\n", pos->second.c_str()));
return XMPPBuddyPtr(new XMPPBuddy(this, pos->second.c_str()));
}
UT_ASSERT_HARMLESS(UT_NOT_REACHED);
return XMPPBuddyPtr();
}
示例6: TestLabelActorCreateActorProperties
void LabelActorTests::TestLabelActorCreateActorProperties()
{
using namespace dtActors;
try
{
// Get the actor from the proxy.
dtABC::LabelActor* actor = NULL;
mLabelProxy->GetActor(actor);
dtABC::LabelActor::ActorPropertyArray propArray;
actor->CreateActorProperties(propArray);
typedef std::map<dtUtil::RefString, dtDAL::ActorProperty*> PropertyMap;
PropertyMap propMap;
// Convert the array to a map keyed on the property names.
dtDAL::ActorProperty* curProp = NULL; // use this for code readability.
dtABC::LabelActor::ActorPropertyArray::iterator curPropIter = propArray.begin();
dtABC::LabelActor::ActorPropertyArray::iterator endPropArray = propArray.end();
for (; curPropIter != endPropArray; ++curPropIter)
{
curProp = curPropIter->get(); // This is better for code readability.
propMap.insert(std::make_pair(curProp->GetName(),curProp));
}
PropertyMap::iterator endMap = propMap.end(); // This is for better code readability.
CPPUNIT_ASSERT(propMap.find(dtABC::LabelActor::PROPERTY_TEXT) != endMap);
CPPUNIT_ASSERT(propMap.find(dtABC::LabelActor::PROPERTY_FONT) != endMap);
CPPUNIT_ASSERT(propMap.find(dtABC::LabelActor::PROPERTY_FONT_SIZE) != endMap);
CPPUNIT_ASSERT(propMap.find(dtABC::LabelActor::PROPERTY_BACK_SIZE) != endMap);
CPPUNIT_ASSERT(propMap.find(dtABC::LabelActor::PROPERTY_TEXT_COLOR) != endMap);
CPPUNIT_ASSERT(propMap.find(dtABC::LabelActor::PROPERTY_BACK_COLOR) != endMap);
CPPUNIT_ASSERT(propMap.find(dtABC::LabelActor::PROPERTY_BACK_VISIBLE) != endMap);
}
catch (const dtUtil::Exception& e)
{
CPPUNIT_FAIL(e.ToString());
}
}
示例7: constructBuddy
BuddyPtr TCPAccountHandler::constructBuddy(const PropertyMap& props)
{
UT_DEBUGMSG(("TCPAccountHandler::constructBuddy()\n"));
PropertyMap::const_iterator hi = props.find("server");
UT_return_val_if_fail(hi != props.end(), BuddyPtr());
UT_return_val_if_fail(hi->second.size() > 0, BuddyPtr());
UT_sint32 port = _getPort(props);
UT_return_val_if_fail(port != -1, BuddyPtr());
UT_DEBUGMSG(("Constructing TCP Buddy (host: %s, port: %d)\n", hi->second.c_str(), port));
return boost::shared_ptr<TCPBuddy>(new TCPBuddy(this, hi->second, boost::lexical_cast<std::string>(port)));
}
示例8: testPredefined
void testPredefined()
{
ScopedFileCopy copy("matroska", ".mka");
string filename = copy.fileName();
EBML::Matroska::File f(filename.c_str());
CPPUNIT_ASSERT(f.isValid());
PropertyMap pm = f.properties();
PropertyMap::Iterator i = pm.find("ENCODER");
CPPUNIT_ASSERT(i != pm.end());
CPPUNIT_ASSERT_EQUAL(String("Lavf54.63.104"), i->second.front());
}
示例9: _getPort
UT_sint32 TCPAccountHandler::_getPort(const PropertyMap& props)
{
PropertyMap::const_iterator pi = props.find("port");
UT_sint32 port = -1;
if (pi == props.end()) // no port specified, use the default port
{
port = DEFAULT_TCP_PORT;
}
else
{
long portl = strtol(pi->second.c_str(), (char **)NULL, 10);
if (portl == LONG_MIN || portl == LONG_MAX) // TODO: we should check errno here for ERANGE
port = DEFAULT_TCP_PORT;
else
port = (UT_sint32)portl;
}
return port;
}
示例10: setProperty
void Inventory::setProperty(const CeGuiString& key, const Property& value)
{
if (key == Inventory::PROPERTY_SLOTS)
{
PropertyArray slotVec = value.toArray();
for (PropertyArray::const_iterator it = slotVec.begin(); it != slotVec.end(); ++it)
{
PropertyMap slotProps = it->toMap();
CeGuiString name = slotProps["name"].toString();
int holdItems = Item::ITEMTYPE_ALL_ITEMS;
if (slotProps.find("holds") != slotProps.end())
{
holdItems = slotProps["holds"].toInt();
}
int readyItems = Item::ITEMTYPE_ALL_ITEMS;
if (slotProps.find("readies") != slotProps.end())
{
readyItems = slotProps["readies"].toInt();
}
CeGuiString type = slotProps.find("type")->second.toString();
if (type == "bone")
{
CeGuiString bone = slotProps["bone"].toString();
LOG_MESSAGE("Inventory", "Add bone slot "+ bone);
addSlot(name, bone.c_str(), readyItems, holdItems, SLOT_BONE);
}
else if (type == "submesh")
{
CeGuiString submesh = slotProps["submesh"].toString();
LOG_MESSAGE("Inventory", "Add submesh slot "+ submesh);
addSlot(name, submesh.c_str(), readyItems, holdItems, SLOT_SUBMESH);
}
else if (type == "material")
{
CeGuiString submesh = slotProps["submesh"].toString();
LOG_MESSAGE("Inventory", "Add material slot "+ submesh);
addSlot(name, submesh.c_str(), readyItems, holdItems, SLOT_MATERIAL);
}
else if (type == "default")
{
LOG_MESSAGE("Inventory", "Add default slot "+ name);
addSlot(name, "", readyItems, holdItems, SLOT_DEFAULT);
}
else
{
LOG_ERROR(Logger::RULES,
"Unknown slot type '"+type+"' in inventory properties.");
}
}
}
else if (key == Inventory::PROPERTY_CONTENT)
{
PropertyMap bonesContent = value.toMap();
for (PropertyMap::const_iterator it = bonesContent.begin();
it != bonesContent.end(); ++it)
{
Item* item = dynamic_cast<Item*>(
GameObjectManager::getSingleton().createGameObjectFromProperty(
(*it).second));
if (item)
{
LOG_MESSAGE("Inventory", "Add item " + it->second.toString() + " to slot "+ (*it).first);
hold(item, (*it).first);
}
}
}
}