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_; }
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; }
void testGetBoolAttribute_UnknownWithDefaultFalse() { AttributeMap testling; CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", false)); }
void testGetBoolAttribute_UnknownWithDefaultTrue() { AttributeMap testling; CPPUNIT_ASSERT(testling.getBoolAttribute("foo", true)); }
void testGetBoolAttribute_Invalid() { AttributeMap testling; testling.addAttribute("foo", "", "bla"); CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true)); }
void testGetBoolAttribute_False() { AttributeMap testling; testling.addAttribute("foo", "", "false"); CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true)); }
void testGetBoolAttribute_1() { AttributeMap testling; testling.addAttribute("foo", "", "1"); CPPUNIT_ASSERT(testling.getBoolAttribute("foo")); }
void testGetBoolAttribute_0() { AttributeMap testling; testling["foo"] = "0"; CPPUNIT_ASSERT(!testling.getBoolAttribute("foo", true)); }
void testGetBoolAttribute_1() { AttributeMap testling; testling["foo"] = "1"; CPPUNIT_ASSERT(testling.getBoolAttribute("foo")); }