|
hemocell
|
#include <config.h>
Public Member Functions | |
| XMLElement (tinyxml2::XMLElement *orig_) | |
| XMLElement | operator[] (std::string name) const |
| template<typename T > | |
| T | read () |
| Read the text of this element as a value of type T. | |
| tinyxml2::XMLElement * | getOrig () |
| std::string | path () const |
Path of this element from the root, e.g. hemocell/sim/tmax. | |
Private Member Functions | |
| std::string | where () const |
| "<file>, line <n>: <path>" of this element, for error messages. | |
Static Private Member Functions | |
| template<typename V > | |
| static bool | parseValue (const std::string &text, V &value) |
| static bool | parseValue (const std::string &text, bool &value) |
| static bool | parseValue (const std::string &text, std::string &value) |
Private Attributes | |
| tinyxml2::XMLElement * | orig |
|
inline |
|
inline |
| XMLElement hemo::XMLElement::operator[] | ( | std::string | name | ) | const |
The child element name.
| std::invalid_argument | if there is none; the message names the file, the element path (e.g. hemocell/sim) and its line. |
|
staticprivate |
|
staticprivate |
|
inlinestaticprivate |
| string hemo::XMLElement::path | ( | ) | const |
Path of this element from the root, e.g. hemocell/sim/tmax.
Read the text of this element as a value of type T.
Numbers are parsed with stream extraction and must make up the whole text (surrounding whitespace is ignored), e.g. "1e6" is rejected for an integer instead of silently becoming 1. Booleans accept 0/1/true/false. Strings return the whole text with surrounding whitespace removed.
| std::invalid_argument | if the element is empty or its text cannot be converted. Callers that treat a value as optional catch this exception (the same one that is thrown for a missing element) and use a default. |
|
private |
"<file>, line <n>: <path>" of this element, for error messages.
|
private |