summaryrefslogtreecommitdiff
path: root/src/xml.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml.cc')
-rw-r--r--src/xml.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/xml.cc b/src/xml.cc
index 08a43ea9..bc42ebce 100644
--- a/src/xml.cc
+++ b/src/xml.cc
@@ -174,6 +174,21 @@ XMLNode::optional_int64_attribute (string name)
return lexical_cast<int64_t> (s);
}
+optional<bool>
+XMLNode::optional_bool_attribute (string name)
+{
+ string const s = string_attribute (name);
+ if (s.empty ()) {
+ return optional<bool> ();
+ }
+
+ if (s == "1" || s == "yes") {
+ return optional<bool> (true);
+ }
+
+ return optional<bool> (false);
+}
+
void
XMLNode::done ()
{