本文整理汇总了C++中AttributeMap::find方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeMap::find方法的具体用法?C++ AttributeMap::find怎么用?C++ AttributeMap::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeMap
的用法示例。
在下文中一共展示了AttributeMap::find方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
void MordentHandler::startElement(const lxml::QName& qname, const AttributeMap& attributes) {
_result.reset(new Mordent());
auto placement = attributes.find(kPlacementAttribute);
if (placement != attributes.end())
_result->setPlacement(presentOptional(EmptyPlacementHandler::placementFromString(placement->second)));
auto longv = attributes.find(kLongAttribute);
if (longv != attributes.end())
_result->setLong(longv->second == "yes");
}
示例2: startElement
void KeyHandler::startElement(const QName& qname, const AttributeMap& attributes) {
_result.reset(new Key());
auto number = attributes.find(kNumberAttribute);
if (number != attributes.end())
_result->setNumber(lxml::IntegerHandler::parseInteger(number->second));
auto print = attributes.find(kPrintObjectAttribute);
if (print != attributes.end())
_result->setPrintObject(print->second == "no" ? false : true);
}
示例3:
bool
TemplateBuilder::hasAttribute(
const AttributeMap& attributes,
const std::string& name)
{
return attributes.find(name) != attributes.end();
}
示例4: setLength
void StyleSheetTable::setLength(ZLTextStyleEntry &entry, ZLTextStyleEntry::Feature featureId, const AttributeMap &map, const std::string &attributeName) {
StyleSheetTable::AttributeMap::const_iterator it = map.find(attributeName);
if (it != map.end()) {
::trySetLength(entry, featureId, it->second);
return;
}
}
示例5: startElement
void PartHandler::startElement(const QName& qname, const AttributeMap& attributes) {
_result.reset(new Part());
_measureIndex = 0;
auto id = attributes.find(kIdTag);
if (id != attributes.end())
_result->setId(id->second);
}
示例6: onObserve
void onObserve(const HeaderOptions &headerOption , const OCRepresentation& rep , const int& eCode, const int& sequenceNumber)
{
std::cout << "onObserve" << std::endl;
// if(eCode == SUCCESS_RESPONSE)
if(eCode <= OC_STACK_RESOURCE_DELETED)
{
AttributeMap attributeMap = rep.getAttributeMap();
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
if(attributeMap.find(it->first) == attributeMap.end())
{
return;
}
}
if(rep.getUri().empty())
{
cout << "uri is null\n";
return;
}
std::cout << std::endl;
std::cout << "========================================================" << std::endl;
std::cout << "Receive OBSERVE RESULT:" << std::endl;
std::cout << "\tSequenceNumber: " << sequenceNumber << std::endl;
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
std::cout << "\tAttribute name: " << it->first << " value: ";
for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
{
std::cout << "\t" << *valueItr << " ";
}
std::cout << std::endl;
}
if(observe_count() > 30)
{
std::cout << "Cancelling Observe..." << std::endl;
OCStackResult result = g_curResource->cancelObserve();
std::cout << "Cancel result: " << result << std::endl;
sleep(10);
std::cout << "DONE" << std::endl;
std::exit(0);
}
}
else
{
std::cout << "onObserve Response error: " << eCode << std::endl;
std::exit(-1);
}
}
示例7: startElement
void PedalHandler::startElement(const lxml::QName& qname, const AttributeMap& attributes) {
using dom::presentOptional;
using lxml::DoubleHandler;
using lxml::StringHandler;
_result.reset(new Pedal{});
_result->position = PositionFactory::buildFromAttributes(attributes);
auto type = attributes.find(kTypeAttribute);
if (type != attributes.end())
_result->setType(typeFromString(type->second));
auto line = attributes.find(kLineAttribute);
if (line != attributes.end())
_result->setLine(presentOptional(line->second == "yes"));
auto sign = attributes.find(kSignAttribute);
if (sign != attributes.end())
_result->setSign(presentOptional(sign->second == "yes"));
}
示例8: setLength
void StyleSheetTable::setLength(ZLTextStyleEntry &entry, ZLTextStyleEntry::Length name, const AttributeMap &map, const std::string &attributeName) {
StyleSheetTable::AttributeMap::const_iterator it = map.find(attributeName);
if (it == map.end()) {
return;
}
const std::vector<std::string> &values = it->second;
if (!values.empty() && !values[0].empty()) {
short size;
ZLTextStyleEntry::SizeUnit unit;
parseLength(values[0], size, unit);
entry.setLength(name, size, unit);
}
}
示例9: TemplateDefinitionError
bool
TemplateBuilder::getRequiredBooleanAttribute(
const AttributeMap& attributes,
const std::string& name)
{
AttributeMap::const_iterator it = attributes.find(name);
if(it == attributes.end())
{
std::string errMsg;
errMsg +=
"[ERR S1] Missing required attribute \"" + name + "\"";
throw TemplateDefinitionError(errMsg);
}
return getOptionalBooleanAttribute(attributes, name, false);
}
示例10: handleStanzaAttributes
void IQParser::handleStanzaAttributes(const AttributeMap& attributes) {
AttributeMap::const_iterator type = attributes.find("type");
if (type != attributes.end()) {
if (type->second == "set") {
getStanzaGeneric()->setType(IQ::Set);
}
else if (type->second == "get") {
getStanzaGeneric()->setType(IQ::Get);
}
else if (type->second == "result") {
getStanzaGeneric()->setType(IQ::Result);
}
else if (type->second == "error") {
getStanzaGeneric()->setType(IQ::Error);
}
else {
std::cerr << "Unknown IQ type: " << type->second << std::endl;
getStanzaGeneric()->setType(IQ::Get);
}
}
}
示例11: sendAttributes
void ManufacturingSchematic::sendAttributes(PlayerObject* playerObject)
{
if(playerObject->getConnectionState() != PlayerConnState_Connected)
return;
TangibleObject* tItem = this->getItem();
if(!tItem)
return;
AttributeMap::iterator mapIt;
AttributeMap* iAttributeMap = tItem->getAttributeMap();
AttributeOrderList* iAttributeOrderList = tItem->getAttributeOrder();
AttributeMap* rAttributeMap = getAttributeMap();
AttributeOrderList* rAttributeOrderList = getAttributeOrder();
//DraftSchematic* draftSchematic = gSchematicManager->getSchematicBySlotId(mDynamicInt32);
//DraftSlots* draftSlots = draftSchematic->getDraftSlots();
Message* newMessage;
string value,aStr;
BStringVector dataElements;
//uint32 amountSlots = draftSlots->size();
//uint8 i = 0;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opAttributeListMessage);
gMessageFactory->addUint64(mId);
//add slots and resource/item requirements
gMessageFactory->addUint32(iAttributeMap->size()+ rAttributeMap->size()+1);
AttributeOrderList::iterator orderIt = rAttributeOrderList->begin();
while(orderIt != rAttributeOrderList->end())
{
mapIt = rAttributeMap->find(*orderIt);
gMessageFactory->addString(gWorldManager->getAttributeKey((*mapIt).first));
value = (*mapIt).second.c_str();
value.convert(BSTRType_Unicode16);
gMessageFactory->addString(value);
++orderIt;
}
//attributes ....
gMessageFactory->addString(BString("manf_attribs"));
aStr = "\\#"SOE_RED" --------------";
aStr.convert(BSTRType_Unicode16);
gMessageFactory->addString(aStr);
orderIt = iAttributeOrderList->begin();
while(orderIt != iAttributeOrderList->end())
{
mapIt = iAttributeMap->find(*orderIt);
gMessageFactory->addString(gWorldManager->getAttributeKey((*mapIt).first));
value = (*mapIt).second.c_str();
value.convert(BSTRType_Unicode16);
gMessageFactory->addString(value);
++orderIt;
}
//gMessageFactory->addUint32(0xffffffff);
newMessage = gMessageFactory->EndMessage();
(playerObject->getClient())->SendChannelAUnreliable(newMessage, playerObject->getAccountId(),CR_Client,9);
}
示例12: sendAttributes
void FactoryCrate::sendAttributes(PlayerObject* playerObject)
{
if(!(playerObject->isConnected()))
return;
AttributeMap* iAttributeMap = this->getLinkedObject()->getAttributeMap();
AttributeOrderList* iAttributeOrderList = this->getLinkedObject()->getAttributeOrder();
Message* newMessage;
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opAttributeListMessage);
gMessageFactory->addUint64(mId);
gMessageFactory->addUint32(2 + mAttributeMap.size()+iAttributeMap->size());
BString tmpValueStr = BString(BSTRType_Unicode16,64);
BString value,aStr;
tmpValueStr.setLength(swprintf(tmpValueStr.getUnicode16(),50,L"%u/%u",mMaxCondition - mDamage,mMaxCondition));
gMessageFactory->addString(BString("condition"));
gMessageFactory->addString(tmpValueStr);
AttributeMap::iterator mapIt;
AttributeOrderList::iterator orderIt = mAttributeOrderList.begin();
while(orderIt != mAttributeOrderList.end())
{
mapIt = mAttributeMap.find(*orderIt);
gMessageFactory->addString(gWorldManager->getAttributeKey((*mapIt).first));
value = (*mapIt).second.c_str();
value.convert(BSTRType_Unicode16);
gMessageFactory->addString(value);
++orderIt;
}
gMessageFactory->addString(BString("factory_attribs"));
aStr = "\\#"SOE_RED" --------------";
aStr.convert(BSTRType_Unicode16);
gMessageFactory->addString(aStr);
orderIt = iAttributeOrderList->begin();
while(orderIt != iAttributeOrderList->end())
{
mapIt = iAttributeMap->find(*orderIt);
gMessageFactory->addString(gWorldManager->getAttributeKey((*mapIt).first));
value = (*mapIt).second.c_str();
value.convert(BSTRType_Unicode16);
gMessageFactory->addString(value);
++orderIt;
}
newMessage = gMessageFactory->EndMessage();
(playerObject->getClient())->SendChannelAUnreliable(newMessage, playerObject->getAccountId(), CR_Client, 9);
}