+class CategoryParser : public ElementParser
+{
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"name") {
+ if (attribute.value.size() > 0) {
+ m_name = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& /*element*/)
+ {
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ if (m_name.IsNull()) {
+ LogWarning("name attribute of category element is mandatory - ignoring");
+ return;
+ }
+
+ if (m_data.categoryList.find(*m_name) ==
+ m_data.categoryList.end()) {
+ m_data.categoryList.insert(*m_name);
+ }
+ }
+
+ explicit CategoryParser(ConfigParserData& data) :
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::OptionalString m_name;
+ ConfigParserData& m_data;
+};
+