From 927b97baaaf69e318ff7a0ce76d096375ec09da2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 Mar 2013 08:22:58 +0200 Subject: Add support for returning XML attributes as map --- cutl/xml/value-traits.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 cutl/xml/value-traits.cxx (limited to 'cutl/xml/value-traits.cxx') diff --git a/cutl/xml/value-traits.cxx b/cutl/xml/value-traits.cxx new file mode 100644 index 0000000..7598645 --- /dev/null +++ b/cutl/xml/value-traits.cxx @@ -0,0 +1,25 @@ +// file : cutl/xml/value-traits.cxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include +#include + +using namespace std; + +namespace cutl +{ + namespace xml + { + bool default_value_traits:: + parse (string s, const parser& p) + { + if (s == "true" || s == "1" || s == "True" || s == "TRUE") + return true; + else if (s == "false" || s == "0" || s == "False" || s == "FALSE") + return false; + else + throw parsing (p, "invalid bool value '" + s + "'"); + } + } +} -- cgit v1.1