Debian Codegraph @

cutl/xml/value-traits.cxx

raw
1 // file : cutl/xml/value-traits.cxx
2 // copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
3 // license : MIT; see accompanying LICENSE file
4
5 #include <cutl/xml/parser.hxx>
6 #include <cutl/xml/serializer.hxx>
7
8 using namespace std;
9
10 namespace cutl
11 {
12 namespace xml
13 {
14 bool default_value_traits<bool>::
15 parse (string s, const parser& p)
16 {
17 if (s == "true" || s == "1" || s == "True" || s == "TRUE")
18 return true;
19 else if (s == "false" || s == "0" || s == "False" || s == "FALSE")
20 return false;
21 else
22 throw parsing (p, "invalid bool value '" + s + "'");
23 }
24 }
25 }