diff options
Diffstat (limited to 'cutl/xml/value-traits.txx')
-rw-r--r-- | cutl/xml/value-traits.txx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cutl/xml/value-traits.txx b/cutl/xml/value-traits.txx new file mode 100644 index 0000000..000d6be --- /dev/null +++ b/cutl/xml/value-traits.txx @@ -0,0 +1,24 @@ +// file : cutl/xml/value-traits.txx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include <sstream> + +#include <cutl/xml/parser.hxx> +#include <cutl/xml/serializer.hxx> + +namespace cutl +{ + namespace xml + { + template <typename T> + std::string default_value_traits<T>:: + serialize (const T& v, const serializer& s) + { + std::ostringstream os; + if (!(os << v)) + throw serialization (s.output_name (), "invalid value"); + return os.str (); + } + } +} |