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


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

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


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

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

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

示例3: handleStartElement

void SearchPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
    if (level == TopLevel) {
    }
    else if (level == PayloadLevel) {
        if (element == "x" && ns == "jabber:x:data") {
            assert(!formParser);
            formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser());
        }
        else if (element == "item") {
            assert(!currentItem);
            currentItem.reset(SearchPayload::Item());
            currentItem->jid = JID(attributes.getAttribute("jid"));
        }
        else {
            currentText.clear();
        }
    }
    else if (level == ItemLevel && currentItem) {
        currentText.clear();
    }

    if (formParser) {
        formParser->handleStartElement(element, ns, attributes);
    }

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

示例4: handleStartElement

void IdleParser::handleStartElement(const std::string& /*element*/, const std::string& /*ns*/, const AttributeMap& attributes) {
	if (level_ == 0) {
		boost::posix_time::ptime since = stringToDateTime(attributes.getAttribute("since"));
		getPayloadInternal()->setSince(since);
	}
	++level_;
}
开发者ID:pedrosorren,项目名称:swift,代码行数:7,代码来源:IdleParser.cpp

示例5: handleStartElement

	void ReplaceParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
		if (level_ == 0) {
			std::string id = attributes.getAttribute("id");
			getPayloadInternal()->setID(id);
		}
		level_++;
	}
开发者ID:pedrosorren,项目名称:swift,代码行数:7,代码来源:ReplaceParser.cpp

示例6: handleStartElement

void RosterParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level_ == PayloadLevel) {
		if (element == "item") {
			inItem_ = true;
			currentItem_ = RosterItemPayload();

			currentItem_.setJID(JID(attributes.getAttribute("jid")));
			currentItem_.setName(attributes.getAttribute("name"));

			std::string subscription = attributes.getAttribute("subscription");
			if (subscription == "both") {
				currentItem_.setSubscription(RosterItemPayload::Both);
			}
			else if (subscription == "to") {
				currentItem_.setSubscription(RosterItemPayload::To);
			}
			else if (subscription == "from") {
				currentItem_.setSubscription(RosterItemPayload::From);
			}
			else if (subscription == "remove") {
				currentItem_.setSubscription(RosterItemPayload::Remove);
			}
			else {
				currentItem_.setSubscription(RosterItemPayload::None);
			}

			if (attributes.getAttribute("ask") == "subscribe") {
				currentItem_.setSubscriptionRequested();
			}
		}
	}
	else if (level_ == ItemLevel) {
		if (element == "group") {
			currentText_ = "";
		}
		else {
			assert(!unknownContentParser_);
			unknownContentParser_ = new SerializingParser();
			unknownContentParser_->handleStartElement(element, ns, attributes);
		}
	}
	else if (unknownContentParser_) {
		unknownContentParser_->handleStartElement(element, ns, attributes);
	}
	++level_;
}
开发者ID:bessey,项目名称:picnic-doc-server,代码行数:46,代码来源:RosterParser.cpp

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

示例8: handleStartElement

void BytestreamsParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
    if (level == TopLevel) {
        getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
    }
    else if (level == PayloadLevel) {
        if (element == "streamhost") {
            try {
                getPayloadInternal()->addStreamHost(Bytestreams::StreamHost(attributes.getAttribute("host"), JID(attributes.getAttribute("jid")), boost::lexical_cast<int>(attributes.getAttribute("port"))));
            }
            catch (boost::bad_lexical_cast&) {
            }
        }
        else if (element == "streamhost-used") {
            getPayloadInternal()->setUsedStreamHost(JID(attributes.getAttribute("jid")));
        }
    }
    ++level;
}
开发者ID:swift,项目名称:swift,代码行数:18,代码来源:BytestreamsParser.cpp

示例9: handleStartElement

void DiscoInfoParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level_ == PayloadLevel) {
		if (element == "identity") {
			getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang", "http://www.w3.org/XML/1998/namespace")));
		}
		else if (element == "feature") {
			getPayloadInternal()->addFeature(attributes.getAttribute("var"));
		}
		else if (element == "x" && ns == "jabber:x:data") {
			assert(!formParser_);
			formParser_ = new FormParser();
		}
	}
	if (formParser_) {
		formParser_->handleStartElement(element, ns, attributes);
	}
	++level_;
}
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:18,代码来源:DiscoInfoParser.cpp

示例10: handleStartElement

void StanzaAckParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
	if (depth == 0) {
		std::string handledStanzasString = attributes.getAttribute("h");
		try {
			getElementGeneric()->setHandledStanzasCount(boost::lexical_cast<int>(handledStanzasString));
		}
		catch (const boost::bad_lexical_cast &) {
		}
	}
	++depth;
}
开发者ID:bessey,项目名称:picnic-doc-server,代码行数:11,代码来源:StanzaAckParser.cpp

示例11: handleStartElement

void StorageParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
	if (level == BookmarkLevel) {
		if (element == "conference") {
			assert(!room);
			room = Storage::Room();
			room->autoJoin = attributes.getBoolAttribute("autojoin", false);
			room->jid = JID(attributes.getAttribute("jid"));
			room->name = attributes.getAttribute("name");
		}
		else if (element == "url") {
			assert(!url);
			url = Storage::URL();
			url->name = attributes.getAttribute("name");
			url->url = attributes.getAttribute("url");
		}
	}
	else if (level == DetailLevel) {
		currentText = "";
	}
	++level;
}
开发者ID:bessey,项目名称:picnic-doc-server,代码行数:21,代码来源:StorageParser.cpp

示例12: handleStartElement

void LastParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
	if (level_ == 0) {
		int seconds = 0;
		try {
			seconds = boost::lexical_cast<int>(attributes.getAttribute("seconds"));
		}
		catch (boost::bad_lexical_cast&) {
		}
		getPayloadInternal()->setSeconds(seconds);
	}
	++level_;

}
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:13,代码来源:LastParser.cpp

示例13: handleStartElement

void SecurityLabelParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
    ++level_;
    if (level_ == DisplayMarkingOrLabelLevel) {
        if (element == "displaymarking") {
            currentText_ = "";
            getPayloadInternal()->setBackgroundColor(attributes.getAttribute("bgcolor"));
            getPayloadInternal()->setForegroundColor(attributes.getAttribute("fgcolor"));
        }
        else if (element == "label" || element == "equivalentlabel") {
            assert(!labelParser_);
            labelParser_ = new SerializingParser();
        }
    }
    else if (level_ >= SecurityLabelLevel && labelParser_) {
        labelParser_->handleStartElement(element, ns, attributes);
    }
}
开发者ID:swift,项目名称:swift,代码行数:17,代码来源:SecurityLabelParser.cpp

示例14: handleStartElement

void AuthRequestParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attribute) {
    if (depth_ == 0) {
        getElementGeneric()->setMechanism(attribute.getAttribute("mechanism"));
    }
    ++depth_;
}
开发者ID:jakjothi,项目名称:swift,代码行数:6,代码来源:AuthRequestParser.cpp

示例15: handleStartElement

void FormParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
	if (level_ == TopLevel) {
		std::string type = attributes.getAttribute("type");
		if (type == "form") {
			getPayloadInternal()->setType(Form::FormType);
		}
		else if (type == "submit") {
			getPayloadInternal()->setType(Form::SubmitType);
		}
		else if (type == "cancel") {
			getPayloadInternal()->setType(Form::CancelType);
		}
		else if (type == "result") {
			getPayloadInternal()->setType(Form::ResultType);
		}
	}
	else if (level_ == PayloadLevel) {
		if (element == "title") {
			currentText_.clear();
		}
		else if (element == "instructions") {
			currentText_.clear();
		}
		else if (element == "field") {
			std::string type;
			FormField::ref correspondingReportedField;
			if (!parsingItem_) {
				type = attributes.getAttribute("type");
			} else {
				foreach(FormField::ref field, getPayloadInternal()->getReportedFields()) {
					if (field->getName() == attributes.getAttribute("var")) {
						correspondingReportedField = field;
						break;
					}
				}
			}
			if (type == "boolean" || boost::dynamic_pointer_cast<BooleanFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = BooleanFormFieldParseHelper::create();
			}
			else if (type == "fixed" || boost::dynamic_pointer_cast<FixedFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = FixedFormFieldParseHelper::create();
			}
			else if (type == "hidden" || boost::dynamic_pointer_cast<HiddenFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = HiddenFormFieldParseHelper::create();
			}
			else if (type == "jid-multi" || boost::dynamic_pointer_cast<JIDMultiFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = JIDMultiFormFieldParseHelper::create();
			}
			else if (type == "jid-single" || boost::dynamic_pointer_cast<JIDSingleFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = JIDSingleFormFieldParseHelper::create();
			}
			else if (type == "list-multi" || boost::dynamic_pointer_cast<ListMultiFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = ListMultiFormFieldParseHelper::create();
			}
			else if (type == "list-single" || boost::dynamic_pointer_cast<ListSingleFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = ListSingleFormFieldParseHelper::create();
			}
			else if (type == "text-multi" || boost::dynamic_pointer_cast<TextMultiFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = TextMultiFormFieldParseHelper::create();
			}
			else if (type == "text-private" || boost::dynamic_pointer_cast<TextPrivateFormField>(correspondingReportedField)) {
				currentFieldParseHelper_ = TextPrivateFormFieldParseHelper::create();
			}
			else /*if (type == "text-single") || undefined */ {
				currentFieldParseHelper_ = TextSingleFormFieldParseHelper::create();
			}
			if (currentFieldParseHelper_) {
				currentFieldParseHelper_->getField()->setName(attributes.getAttribute("var"));
				currentFieldParseHelper_->getField()->setLabel(attributes.getAttribute("label"));
			}
		}
		else if (element == "reported") {
开发者ID:marosi,项目名称:SocialDesktopClient,代码行数:72,代码来源:FormParser.cpp


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