Ejemplo n.º 1
0
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_;
}
Ejemplo n.º 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;
}
Ejemplo n.º 3
0
        void testGetBoolAttribute_UnknownWithDefaultFalse() {
            AttributeMap testling;

            CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", false));
        }
Ejemplo n.º 4
0
        void testGetBoolAttribute_UnknownWithDefaultTrue() {
            AttributeMap testling;

            CPPUNIT_ASSERT(testling.getBoolAttribute("foo", true));
        }
Ejemplo n.º 5
0
        void testGetBoolAttribute_Invalid() {
            AttributeMap testling;
            testling.addAttribute("foo", "", "bla");

            CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true));
        }
Ejemplo n.º 6
0
        void testGetBoolAttribute_False() {
            AttributeMap testling;
            testling.addAttribute("foo", "", "false");

            CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true));
        }
Ejemplo n.º 7
0
        void testGetBoolAttribute_1() {
            AttributeMap testling;
            testling.addAttribute("foo", "", "1");

            CPPUNIT_ASSERT(testling.getBoolAttribute("foo"));
        }
Ejemplo n.º 8
0
		void testGetBoolAttribute_0() {
			AttributeMap testling;
			testling["foo"] = "0";

			CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true));
		}
Ejemplo n.º 9
0
		void testGetBoolAttribute_1() {
			AttributeMap testling;
			testling["foo"] = "1";

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