コード例 #1
0
ファイル: MAMFinParser.cpp プロジェクト: pedrosorren/swift
void MAMFinParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
	if (level_ == TopLevel) {
		getPayloadInternal()->setComplete(attributes.getBoolAttribute("complete", false));
		getPayloadInternal()->setStable(attributes.getBoolAttribute("stable", true));
		boost::optional<std::string> attributeValue;
		if ((attributeValue = attributes.getAttributeValue("queryid"))) {
			getPayloadInternal()->setQueryID(*attributeValue);
		}
	} 
	else if (level_ == PayloadLevel) {
		if (element == "set" && ns == "http://jabber.org/protocol/rsm") {
			resultSetParser_ = boost::make_shared<ResultSetParser>();
		}
	}

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

	++level_;
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: AttributeMapTest.cpp プロジェクト: jakjothi/swift
        void testGetBoolAttribute_UnknownWithDefaultFalse() {
            AttributeMap testling;

            CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", false));
        }
コード例 #4
0
ファイル: AttributeMapTest.cpp プロジェクト: jakjothi/swift
        void testGetBoolAttribute_UnknownWithDefaultTrue() {
            AttributeMap testling;

            CPPUNIT_ASSERT(testling.getBoolAttribute("foo", true));
        }
コード例 #5
0
ファイル: AttributeMapTest.cpp プロジェクト: jakjothi/swift
        void testGetBoolAttribute_Invalid() {
            AttributeMap testling;
            testling.addAttribute("foo", "", "bla");

            CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true));
        }
コード例 #6
0
ファイル: AttributeMapTest.cpp プロジェクト: jakjothi/swift
        void testGetBoolAttribute_False() {
            AttributeMap testling;
            testling.addAttribute("foo", "", "false");

            CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true));
        }
コード例 #7
0
ファイル: AttributeMapTest.cpp プロジェクト: jakjothi/swift
        void testGetBoolAttribute_1() {
            AttributeMap testling;
            testling.addAttribute("foo", "", "1");

            CPPUNIT_ASSERT(testling.getBoolAttribute("foo"));
        }
コード例 #8
0
		void testGetBoolAttribute_0() {
			AttributeMap testling;
			testling["foo"] = "0";

			CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true));
		}
コード例 #9
0
		void testGetBoolAttribute_1() {
			AttributeMap testling;
			testling["foo"] = "1";

			CPPUNIT_ASSERT(testling.getBoolAttribute("foo"));
		}