1 #ifndef Fireworks_Core_FWXMLConfigParser 2 #define Fireworks_Core_FWXMLConfigParser 55 for (
size_t i = 0,
e = attributes.size();
i !=
e; ++
i)
58 if (attr.
key ==
"name")
60 else if (attr.
key ==
"version")
63 version = strtol(attr.
value.c_str(), &endptr, 10);
64 if (endptr == attr.
value.c_str())
83 throw ParserError(
"Expecting toplevel <config> tag");
92 else if (tag ==
"string")
105 throw ParserError(
"Wrong opening tag found " + tag);
122 throw ParserError(
"Wrong closing tag found " + tag);
128 m_configs.back().second->addKeyValue(key, *current);
139 throw ParserError(
"Wrong closing tag found " + tag);
157 else if (strspn(data.c_str(),
" \t\n") != data.size())
173 #ifdef FW_CONFIG_PARSER_DEBUG 174 static char *debug_states[] = {
182 std::cerr <<
" " << where <<
" tag/data " << tag <<
"in state " << debug_states[state] << std::endl;
187 std::vector<std::pair<std::string, FWConfiguration *> >
m_configs;
FWXMLConfigParser(std::istream &f)
std::string m_currentConfigName
std::vector< Attribute > Attributes
std::auto_ptr< FWConfiguration > m_first
std::vector< std::pair< std::string, FWConfiguration * > > m_configs
FWConfiguration * config(void)
virtual void startElement(const std::string &tag, Attributes &attributes) override
void pushConfig(Attributes &attributes)
void debug_config_state_machine(const char *where, const std::string &tag, int state)
virtual void endElement(const std::string &tag) override
virtual void data(const std::string &data) override