11#include "XMLPropertyHandler.h"
23XMLPropertyHandler::XMLPropertyHandler() : m_currentProp(
NONE) {}
25XMLPropertyHandler::~XMLPropertyHandler() {}
30bool XMLPropertyHandler::endDocument()
34bool XMLPropertyHandler::endElement(
const QString & namespaceURI,
const QString & name,
const QString & qName)
38 const QString& stringName = name;
39 if (m_currentProp==PROP && stringName ==
"property")
43 else if (m_currentProp==SUBPROP && stringName ==
"subproperty")
50bool XMLPropertyHandler::startElement(
const QString & namespaceURI,
const QString & name,
const QString & qName,
const QXmlAttributes & attributes)
57 const QString& stringName = name;
58 if (stringName ==
"property")
61 m_properties.push_back(PropertyDescription());
62 m_properties.back().name = attributes.value(
"name").toUtf8().data();
64 LDEBUG <<
"read property " << m_properties.back().name;
67 else if (stringName ==
"subproperty")
69 m_currentProp=SUBPROP;
70 m_subproperties.push_back(SubPropertyDescription());
71 m_subproperties.back().name = attributes.value(
"name").toUtf8().data();
72 m_subproperties.back().parentName = attributes.value(
"parent").toUtf8().data();
74 LDEBUG <<
"read subproperty " << m_subproperties.back().name <<
" of parent property " << m_subproperties.back().parentName;
77 else if (stringName ==
"value")
79 string value=attributes.value(
"name").toUtf8().data();
81 LDEBUG <<
"read value " << value;
83 if (m_currentProp == PROP)
85 m_properties.back().values.push_back(value);
87 else if (m_currentProp == SUBPROP)
89 m_subproperties.back().values.back().second.push_back(value);
94 LERROR <<
"Don't know what to do with value " << value <<
" !";
97 else if (stringName ==
"subvalues")
99 string value=attributes.value(
"value").toUtf8().data();
101 LDEBUG <<
"read subvalues " << value;
103 if (m_currentProp == SUBPROP)
105 m_subproperties.back().values.push_back(make_pair(value,vector<string>()));
110 LERROR <<
"Don't know what to do with subvalues " << value <<
" !";
117const std::vector<XMLPropertyHandler::PropertyDescription>& XMLPropertyHandler::getProperties()
122const std::vector<XMLPropertyHandler::SubPropertyDescription>& XMLPropertyHandler::getSubProperties()
124 return m_subproperties;
#define PROPERTYCODELOGINIT