1 #ifndef Fireworks_Core_FWXMLConfigParser 2 #define Fireworks_Core_FWXMLConfigParser 42 for (
size_t i = 0,
e = attributes.size();
i !=
e; ++
i) {
44 if (attr.
key ==
"name")
46 else if (attr.
key ==
"version") {
48 version = strtol(attr.
value.c_str(), &endptr, 10);
49 if (endptr == attr.
value.c_str())
64 throw ParserError(
"Expecting toplevel <config> tag");
71 else if (tag ==
"string")
81 throw ParserError(
"Wrong opening tag found " + tag);
96 throw ParserError(
"Wrong closing tag found " + tag);
102 m_configs.back().second->addKeyValue(key, *current);
107 }
else if (
m_state == IN_STORED_STRING && tag ==
"string")
110 throw ParserError(
"Wrong closing tag found " + tag);
125 }
else if (strspn(data.c_str(),
" \t\n") != data.size())
135 #ifdef FW_CONFIG_PARSER_DEBUG 136 static char *debug_states[] = {
137 "IN_BEGIN_DOCUMENT",
"IN_PUSHED_CONFIG",
"IN_POPPED_CONFIG",
"IN_BEGIN_STRING",
"IN_STORED_STRING"};
139 std::cerr <<
" " << where <<
" tag/data " << tag <<
"in state " << debug_states[state] << std::endl;
144 std::vector<std::pair<std::string, FWConfiguration *> >
m_configs;
FWXMLConfigParser(std::istream &f)
std::string m_currentConfigName
std::vector< Attribute > Attributes
std::vector< std::pair< std::string, FWConfiguration * > > m_configs
FWConfiguration * config(void)
void pushConfig(Attributes &attributes)
void debug_config_state_machine(const char *where, const std::string &tag, int state)
std::unique_ptr< FWConfiguration > m_first
void startElement(const std::string &tag, Attributes &attributes) override
void data(const std::string &data) override
void endElement(const std::string &tag) override