A basic parser for general property value definitions in XML. Parses a single XML element where a property is defined by a list of values. These values can be numeric or strings. It fills a vector with these values and returns a pointer to it. The parser can handle any number of values.
More...
#include <property_parser.h>
|
| PropertyParser () |
|
void | print (std::ostream &os) override |
|
bool | empty () const override |
|
void | clear () override |
|
const char * | getTypename () override |
|
bool | isA (const char *name) override |
|
void | parse (const tinyxml2::XMLElement *xml) |
|
std::shared_ptr< std::unordered_map< std::string, T > > | get () override |
|
| ~PropertyParser () |
|
const char * | getNameOf (const tinyxml2::XMLElement *xml) |
|
void | parse (const tinyxml2::XMLElement *xml) |
|
void | parse (const tinyxml2::XMLElement *xml) |
|
template<typename T>
class PropertyParser< T >
A basic parser for general property value definitions in XML. Parses a single XML element where a property is defined by a list of values. These values can be numeric or strings. It fills a vector with these values and returns a pointer to it. The parser can handle any number of values.
- Returns
- An unordered map where keys are the attribute names (stored as std::string for safety by default) and values are of type T (which can be std::string, const char*, or double—only these types are acceptable).
<density value="1.0" />
...
<controller kP="10" kI="15" Kd="-2.0" ... />
- Template Parameters
-
T | Accepts either std::string or double. |
- Warning
- This parser does not support mixed property type parsing at once. It can handle an XML element with either all string or all double values. Mixed parsing of attributes will be addressed in future versions.
- Note
- A conversion error from str2double will occur when parsing mixed attribute properties with a propertyParser<double> instance. This issue is currently ignored.
- Todo:
- Fix the bug related to mixed attribute property parsing.
◆ PropertyParser()
◆ ~PropertyParser()
◆ clear()
◆ empty()
◆ get()
template<typename T >
std::shared_ptr< std::unordered_map< std::string, T > > PropertyParser< T >::get |
( |
| ) |
|
|
inlineoverridevirtual |
◆ getTypename()
◆ isA()
◆ parse()
◆ print()
The documentation for this class was generated from the following file: