Class xml_config_parser

Inheritance Relationships

Base Types

Class Documentation

class xml_config_parser : public rcppsw::er::client<xml_config_parser>, public rcppsw::config::base_parser

Interface specifying functionality for parsing XML into a base_config derived parameter structure.

Public Functions

xml_config_parser(void)
~xml_config_parser(void) override = default
void node_attr_get(const ticpp::Element &node, const std::string &attr, bool &buf) const

Get a boolean attribute inside a node (bools have to be handed specially, or at least I can’t figure out how to make them also work the template version).

template<typename T>
inline void node_attr_get(const ticpp::Element &node, const std::string &attr, T &buf) const

Get an attribute inside a node.

Parameters:
  • node – The node to search.

  • attr – The attribute name.

  • buf – The result buffer.

template<typename T, typename U = T, typename std::enable_if<!std::is_same<T, bool>::value, int>::type = 0>
inline void node_attr_get(const ticpp::Element &node, const std::string &attr, T &buf, const T &dflt) const

Get an attribute inside a node, or substitute a default value if the attribute does not exist.

Parameters:
  • node – The node to search.

  • attr – The attribute name.

  • buf – The result buffer.

  • dflt – The default value to use if the attribute does not exist.

template<typename T, typename U = T, typename std::enable_if<std::is_same<U, bool>::value, int>::type = 0>
inline void node_attr_get(const ticpp::Element &node, const std::string &attr, T &buf, const T &dflt) const

Get a boolean attribute inside a node (bools have to be handed specially, or at least I can’t figure out how to make them also work in the template version).

ticpp::Element &node_get(const ticpp::Element &node, const std::string &tag) const

Get the node that is inside the specified one, designated by the specified tag.

If no such node exists, an assertion halts the program.

virtual void parse(const ticpp::Element &node) = 0

Parse the provided XML node into an internal representation (should be a class/struct derived from base_config).

Parameters:

node – The XML tag that the root (i.e. the value returned by xml_root()) for the parser can be found under.

virtual std::string xml_root(void) const = 0

Return the root XML tag that all parameters for the specified parser should be found/placed under.