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


C++ AttributeMap类代码示例

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


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

示例1: onobserve

void onobserve()
{

    oicappData *ad = g_oicObserveAd;

    AttributeMap attributeMap = g_curAttributeMap;

    std::string tmpStr[2];
    int index = 0;
    for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
    {
        tmpStr[index] = it->first;
        tmpStr[index].append(" : ");
        for(auto value = it->second.begin() ; value != it->second.end() ; ++value)
        {
            tmpStr[index].append(*value);
        }
        index++;
    }

    DBG("%s" , tmpStr[0].c_str());
    DBG("%s" , tmpStr[1].c_str());
    _gl_update_item(ad , strdup(tmpStr[0].c_str()) , ad->itemConsumerTemp);
    _gl_update_item(ad , strdup(tmpStr[1].c_str()) , ad->itemConsumerHumid);
}
开发者ID:tizenorg,项目名称:platform.upstream.iotivity,代码行数:25,代码来源:oicapp-client.cpp

示例2: handleStartElement

void PubSubEventSubscriptionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
    if (level == 0) {
        if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
            getPayloadInternal()->setNode(*attributeValue);
        }
        if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
            if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
                getPayloadInternal()->setJID(*jid);
            }
        }
        if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
            if (boost::optional<PubSubEventSubscription::SubscriptionType> value = EnumParser<PubSubEventSubscription::SubscriptionType>()(PubSubEventSubscription::None, "none")(PubSubEventSubscription::Pending, "pending")(PubSubEventSubscription::Subscribed, "subscribed")(PubSubEventSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
                getPayloadInternal()->setSubscription(*value);
            }
        }
        if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
            getPayloadInternal()->setSubscriptionID(*attributeValue);
        }
        if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("expiry")) {
                getPayloadInternal()->setExpiry(stringToDateTime(*attributeValue));
        }
    }



    if (level >= 1 && currentPayloadParser) {
        currentPayloadParser->handleStartElement(element, ns, attributes);
    }
    ++level;
}
开发者ID:jakjothi,项目名称:swift,代码行数:30,代码来源:PubSubEventSubscriptionParser.cpp

示例3: handleStartElement

void MAMQueryParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level_ == TopLevel) {
		boost::optional<std::string> attributeValue;
		if ((attributeValue = attributes.getAttributeValue("queryid"))) {
			getPayloadInternal()->setQueryID(*attributeValue);
		}
		if ((attributeValue = attributes.getAttributeValue("node"))) {
			getPayloadInternal()->setNode(*attributeValue);
		}
	} else if (level_ == PayloadLevel) {
		if (element == "x" && ns == "jabber:x:data") {
			formParser_ = boost::make_shared<FormParser>();
		} else if (element == "set" && ns == "http://jabber.org/protocol/rsm") {
			resultSetParser_ = boost::make_shared<ResultSetParser>();
		}
	}

	if (formParser_) { /* parsing a nested Form */
		formParser_->handleStartElement(element, ns, attributes);
	}

	if (resultSetParser_) { /* parsing a nested ResultSet */
		resultSetParser_->handleStartElement(element, ns, attributes);
	}

	++level_;
}
开发者ID:pedrosorren,项目名称:swift,代码行数:27,代码来源:MAMQueryParser.cpp

示例4: handleStartElement

void MUCUserPayloadParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
	if (level == ItemLevel) {
		if (element == "item") {
			MUCUserPayload::Item item;
			std::string affiliation = attributes.getAttribute("affiliation");
			std::string role = attributes.getAttribute("role");
			std::string nick = attributes.getAttribute("nick");
			std::string jid = attributes.getAttribute("jid");
			item.affiliation = parseAffiliation(affiliation);
			item.role = parseRole(role);
			if (!jid.empty()) {
				item.realJID = JID(jid);
			}
			if (!nick.empty()) {
				item.nick = nick;
			}
			getPayloadInternal()->addItem(item);
		} else if (element == "status") {
			MUCUserPayload::StatusCode status;
			try {
				status.code = boost::lexical_cast<int>(attributes.getAttribute("code").c_str());
				getPayloadInternal()->addStatusCode(status);
			} catch (boost::bad_lexical_cast&) {
			}
		}
	}
	++level;
}
开发者ID:bessey,项目名称:picnic-doc-server,代码行数:28,代码来源:MUCUserPayloadParser.cpp

示例5: handleStartElement

void PubSubItemsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level == 0) {
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
			getPayloadInternal()->setNode(*attributeValue);
		}
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("max_items")) {
			try {
				getPayloadInternal()->setMaximumItems(boost::lexical_cast<unsigned int>(*attributeValue));
			}
			catch (boost::bad_lexical_cast&) {
			}
		}
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
			getPayloadInternal()->setSubscriptionID(*attributeValue);
		}
	}

	if (level == 1) {
		if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
			currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers);
		}
	}

	if (level >= 1 && currentPayloadParser) {
		currentPayloadParser->handleStartElement(element, ns, attributes);
	}
	++level;
}
开发者ID:pedrosorren,项目名称:swift,代码行数:28,代码来源:PubSubItemsParser.cpp

示例6: handleStartElement

void XMPPParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (!parseErrorOccurred_) {
		if (level_ == TopLevel) {
			if (element == "stream" && ns == "http://etherx.jabber.org/streams") {
				ProtocolHeader header;
				header.setFrom(attributes.getAttribute("from"));
				header.setTo(attributes.getAttribute("to"));
				header.setID(attributes.getAttribute("id"));
				header.setVersion(attributes.getAttribute("version"));
				client_->handleStreamStart(header);
			}
			else {
				parseErrorOccurred_ = true;
			}
		}
		else {
			if (level_ == StreamLevel) {
				assert(!currentElementParser_);
				currentElementParser_ = createElementParser(element, ns);
			}
			currentElementParser_->handleStartElement(element, ns, attributes);
		}
	}
	++level_;
}
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:25,代码来源:XMPPParser.cpp

示例7: 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;
	}
}
开发者ID:2php,项目名称:FBReaderJ,代码行数:7,代码来源:StyleSheetTable.cpp

示例8:

bool
TemplateBuilder::hasAttribute(
  const AttributeMap& attributes,
  const std::string& name)
{
  return attributes.find(name) != attributes.end();
}
开发者ID:clearctvm,项目名称:MarketData.Quickfast,代码行数:7,代码来源:XMLTemplateParser.cpp

示例9: handleStartElement

void PubSubSubscriptionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level == 0) {
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
			getPayloadInternal()->setNode(*attributeValue);
		}
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
			getPayloadInternal()->setSubscriptionID(*attributeValue);
		}
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
			if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
				getPayloadInternal()->setJID(*jid);
			}
		}
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
			if (boost::optional<PubSubSubscription::SubscriptionType> value = EnumParser<PubSubSubscription::SubscriptionType>()(PubSubSubscription::None, "none")(PubSubSubscription::Pending, "pending")(PubSubSubscription::Subscribed, "subscribed")(PubSubSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
				getPayloadInternal()->setSubscription(*value);
			}
		}
	}

	if (level == 1) {
		if (element == "subscribe-options" && ns == "http://jabber.org/protocol/pubsub") {
			currentPayloadParser = boost::make_shared<PubSubSubscribeOptionsParser>(parsers);
		}
	}

	if (level >= 1 && currentPayloadParser) {
		currentPayloadParser->handleStartElement(element, ns, attributes);
	}
	++level;
}
开发者ID:pedrosorren,项目名称:swift,代码行数:31,代码来源:PubSubSubscriptionParser.cpp

示例10: handleStartElement

void PubSubOptionsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level == 0) {
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
			getPayloadInternal()->setNode(*attributeValue);
		}
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
			if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
				getPayloadInternal()->setJID(*jid);
			}
		}
		if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
			getPayloadInternal()->setSubscriptionID(*attributeValue);
		}
	}

	if (level == 1) {
		if (element == "x" && ns == "jabber:x:data") {
			currentPayloadParser = boost::make_shared<FormParser>();
		}
	}

	if (level >= 1 && currentPayloadParser) {
		currentPayloadParser->handleStartElement(element, ns, attributes);
	}
	++level;
}
开发者ID:pedrosorren,项目名称:swift,代码行数:26,代码来源:PubSubOptionsParser.cpp

示例11: handleStartElement

void StanzaParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (inStanza()) {
		if (!inPayload()) {
			assert(!currentPayloadParser_);
			PayloadParserFactory* payloadParserFactory = factories_->getPayloadParserFactory(element, ns, attributes);
			if (payloadParserFactory) {
				currentPayloadParser_.reset(payloadParserFactory->createPayloadParser());
			}
			else {
				currentPayloadParser_.reset(new UnknownPayloadParser());
			}
		}
		assert(currentPayloadParser_);
		currentPayloadParser_->handleStartElement(element, ns, attributes);
	}
	else {
		boost::optional<std::string> from = attributes.getAttributeValue("from");
		if (from) {
			getStanza()->setFrom(JID(*from));
		}
		boost::optional<std::string> to = attributes.getAttributeValue("to");
		if (to) {
			getStanza()->setTo(JID(*to));
		}
		boost::optional<std::string> id = attributes.getAttributeValue("id");
		if (id) {
			getStanza()->setID(*id);
		}
		handleStanzaAttributes(attributes);
	}
	++currentDepth_;
}
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:32,代码来源:StanzaParser.cpp

示例12: 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);
}
开发者ID:aleph7,项目名称:mxml,代码行数:8,代码来源:PartHandler.cpp

示例13: testGetAttribute_Namespaced

        void testGetAttribute_Namespaced() {
            AttributeMap testling;
            testling.addAttribute("lang", "", "nl");
            testling.addAttribute("lang", "http://www.w3.org/XML/1998/namespace", "en");
            testling.addAttribute("lang", "", "fr");

            CPPUNIT_ASSERT_EQUAL(std::string("en"), testling.getAttribute("lang", "http://www.w3.org/XML/1998/namespace"));
        }
开发者ID:jakjothi,项目名称:swift,代码行数:8,代码来源:AttributeMapTest.cpp

示例14: handleStartElement

	void JingleIBBTransportMethodPayloadParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
		try {
			getPayloadInternal()->setBlockSize(boost::lexical_cast<int>(attributes.getAttributeValue("block-size").get_value_or("0")));
		} catch (boost::bad_lexical_cast &) {
			getPayloadInternal()->setBlockSize(0);
		}
		getPayloadInternal()->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
		++level;
	}
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:9,代码来源:JingleIBBTransportMethodPayloadParser.cpp

示例15: int

int ArchiveMan::archivePos( int archDocId, KraftDoc *doc )
{
    /*
      mysql> describe archdocpos;
      +-----------+--------------+------+-----+---------+----------------+
      | Field     | Type         | Null | Key | Default | Extra          |
      +-----------+--------------+------+-----+---------+----------------+
      | archPosID | int(11)      | NO   | PRI | NULL    | auto_increment |
      | archDocID | int(11)      | NO   | MUL |         |                |
      | ordNumber | int(11)      | NO   |     |         |                |
      | text      | text         | YES  |     | NULL    |                |
      | amount    | decimal(6,2) | YES  |     | NULL    |                |
      | unit      | varchar(64)  | YES  |     | NULL    |                |
      | price     | decimal(6,2) | YES  |     | NULL    |                |
      | vat       | decimal(3,1) | YES  |     | 0.0     |                |
      +-----------+--------------+------+-----+---------+----------------+
    */
    if( ! doc ) return -1;

    QSqlTableModel model;
    model.setTable("archdocpos");
    QSqlRecord record = model.record();

    int cnt = 0;

    DocPositionList posList = doc->positions();
    DocPositionListIterator it( posList );

    kDebug() << "Archiving pos for " << archDocId << endl;
    while ( it.hasNext() ) {
        DocPosition *dp = static_cast<DocPosition*>( it.next() );

        record.setValue( "archDocID", archDocId );
        record.setValue( "ordNumber", 1+cnt /* dp->position() */ );
        record.setValue( "kind", dp->attribute( DocPosition::Kind ) );
        record.setValue( "text", dp->text() ); // expandItemText( dp ) );
        record.setValue( "amount", dp->amount() );
        record.setValue( "unit", dp->unit().einheit( dp->amount() ) );
        record.setValue( "price", dp->unitPrice().toDouble() );
        record.setValue( "overallPrice", dp->overallPrice().toDouble() );
        record.setValue( "taxType", dp->taxTypeNumeric() );

        if(!model.insertRecord(-1, record)) {
            kDebug() << model.lastError();
        }
        dbID id = KraftDB::self()->getLastInsertID();
        // kDebug() << "Inserted for id " << id.toString() << endl;
        cnt++;

        // save the attributes of the positions in the attributes
        // table but with a new host type which reflects the arch state
        AttributeMap attribs = dp->attributes();
        attribs.setHost( "ArchPosition" );
        attribs.save( id );
    }
    return cnt;
}
开发者ID:salt4pommes,项目名称:kraft-4.2,代码行数:57,代码来源:archiveman.cpp


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