diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-08-21 21:38:37 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-08-21 21:38:37 +0100 |
| commit | fd23bf276facab3892a00f010ac7e991bc79af09 (patch) | |
| tree | 2ee3c0e6cfd318bfc14c5fca7c29c9031a570a69 /src/xml.cc | |
| parent | 3541f4c9bd91169e55a82b9fa46767b46ca06188 (diff) | |
Pick up effect and effect color.
Diffstat (limited to 'src/xml.cc')
| -rw-r--r-- | src/xml.cc | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -140,6 +140,22 @@ XMLNode::string_attribute (string name) { xmlpp::Element const * e = dynamic_cast<const xmlpp::Element *> (_node); if (!e) { + throw XMLError ("missing attribute"); + } + + xmlpp::Attribute* a = e->get_attribute (name); + if (!a) { + throw XMLError ("missing attribute"); + } + + return a->get_value (); +} + +string +XMLNode::optional_string_attribute (string name) +{ + xmlpp::Element const * e = dynamic_cast<const xmlpp::Element *> (_node); + if (!e) { return ""; } @@ -166,7 +182,7 @@ XMLNode::int64_attribute (string name) int64_t XMLNode::optional_int64_attribute (string name) { - string const s = string_attribute (name); + string const s = optional_string_attribute (name); if (s.empty ()) { return 0; } @@ -177,7 +193,7 @@ XMLNode::optional_int64_attribute (string name) optional<bool> XMLNode::optional_bool_attribute (string name) { - string const s = string_attribute (name); + string const s = optional_string_attribute (name); if (s.empty ()) { return optional<bool> (); } @@ -192,7 +208,7 @@ XMLNode::optional_bool_attribute (string name) optional<Color> XMLNode::optional_color_attribute (string name) { - string const s = string_attribute (name); + string const s = optional_string_attribute (name); if (s.empty ()) { return optional<Color> (); } |
