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


C++ AttributeMap::getAttributeValue方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: handleStartElement

void DeliveryReceiptParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributeMap) {
	if (level_ == 0) {
		if (element == "received") {
			if (attributeMap.getAttributeValue("id").is_initialized()) {
				getPayloadInternal()->setReceivedID(attributeMap.getAttributeValue("id").get());
			}
		}
	}
	++level_;
}
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:10,代码来源:DeliveryReceiptParser.cpp

示例9: handleStartElement

void JingleFileTransferFileInfoParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
    charData.clear();
    if (element == "hash") {
        hashAlg = attributes.getAttributeValue("algo").get_value_or("");
    }
    else if (element == "range") {
        rangeOffset = safeLexicalCast<boost::uintmax_t>(attributes.getAttributeValue("offset").get_value_or(""));
    }

    ++level;
}
开发者ID:jakjothi,项目名称:swift,代码行数:11,代码来源:JingleFileTransferFileInfoParser.cpp

示例10: handleStanzaAttributes

void PresenceParser::handleStanzaAttributes(const AttributeMap& attributes) {
	boost::optional<std::string> type = attributes.getAttributeValue("type");
	if (type) {
		if (*type == "unavailable") {
			getStanzaGeneric()->setType(Presence::Unavailable);
		}
		else if (*type == "probe") {
			getStanzaGeneric()->setType(Presence::Probe);
		}
		else if (*type == "subscribe") {
			getStanzaGeneric()->setType(Presence::Subscribe);
		}
		else if (*type == "subscribed") {
			getStanzaGeneric()->setType(Presence::Subscribed);
		}
		else if (*type == "unsubscribe") {
			getStanzaGeneric()->setType(Presence::Unsubscribe);
		}
		else if (*type == "unsubscribed") {
			getStanzaGeneric()->setType(Presence::Unsubscribed);
		}
		else if (*type == "error") {
			getStanzaGeneric()->setType(Presence::Error);
		}
		else {
			std::cerr << "Unknown Presence type: " << *type << std::endl;
			getStanzaGeneric()->setType(Presence::Available);
		}
	}
	else {
		getStanzaGeneric()->setType(Presence::Available);
	}
}
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:33,代码来源:PresenceParser.cpp

示例11: handleStartElement

void PubSubSubscribeParser::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 (level >= 1 && currentPayloadParser) {
        currentPayloadParser->handleStartElement(element, ns, attributes);
    }
    ++level;
}
开发者ID:swift,项目名称:swift,代码行数:17,代码来源:PubSubSubscribeParser.cpp

示例12: handleStartElement

void PubSubDefaultParser::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("type")) {
			if (boost::optional<PubSubDefault::Type> value = EnumParser<PubSubDefault::Type>()(PubSubDefault::None, "none")(PubSubDefault::Collection, "collection")(PubSubDefault::Leaf, "leaf").parse(*attributeValue)) {
				getPayloadInternal()->setType(*value);
			}
		}
	}

	

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

示例13: handleStartElement

void PubSubEventRedirectParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
    if (level == 0) {
        if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("uri")) {
            getPayloadInternal()->setURI(*attributeValue);
        }
    }

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

示例14: handleStartElement

void PubSubOwnerAffiliationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level == 0) {
		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("affiliation")) {
			if (boost::optional<PubSubOwnerAffiliation::Type> value = EnumParser<PubSubOwnerAffiliation::Type>()(PubSubOwnerAffiliation::None, "none")(PubSubOwnerAffiliation::Member, "member")(PubSubOwnerAffiliation::Outcast, "outcast")(PubSubOwnerAffiliation::Owner, "owner")(PubSubOwnerAffiliation::Publisher, "publisher")(PubSubOwnerAffiliation::PublishOnly, "publish-only").parse(*attributeValue)) {
				getPayloadInternal()->setType(*value);
			}
		}
	}

	

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

示例15: handleStartElement

	void JingleParser::handleStartElement(const std::string& element, const std::string &ns, const AttributeMap& attributes) {
		if (level == 0) {
			// <jingle > tag
			JinglePayload::ref payload = getPayloadInternal();
			payload->setAction(stringToAction(attributes.getAttributeValue("action").get_value_or("")));
			payload->setInitiator(JID(attributes.getAttributeValue("initiator").get_value_or("")));
			payload->setResponder(JID(attributes.getAttributeValue("responder").get_value_or("")));
			payload->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
		}
		
		if (level == 1) {
			PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
			if (payloadParserFactory) {
				currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
			}
		}
		
		if (level >= 1 && currentPayloadParser) {
			currentPayloadParser->handleStartElement(element, ns, attributes);
		}
		
		++level;
	}
开发者ID:pedrosorren,项目名称:swift,代码行数:23,代码来源:JingleParser.cpp


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