/* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #ifndef ATTRIBUTEMAP_H #define ATTRIBUTEMAP_H #include #include "Swiften/Base/String.h" namespace Swift { class AttributeMap : public std::map { public: AttributeMap() {} String getAttribute(const String& attribute) const { AttributeMap::const_iterator i = find(attribute); if (i == end()) { return ""; } else { return i->second; } } bool getBoolAttribute(const String& attribute, bool defaultValue = false) const { AttributeMap::const_iterator i = find(attribute); if (i == end()) { return defaultValue; } else { return i->second == "true" || i->second == "1"; } } }; } #endif