diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-13 12:42:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-13 12:42:37 +0200 |
commit | ce3dfdff0d03697bf0c9e0cc9fb45dc6ef7c4ba9 (patch) | |
tree | 8aee46f0a3382e300f5970322933edb638709e52 /cutl/xml/serializer.ixx | |
parent | 29aff5bf19aa23c784bb09b74dc388ccb5f495e2 (diff) |
Add support for XML serializing values other than std::string
Diffstat (limited to 'cutl/xml/serializer.ixx')
-rw-r--r-- | cutl/xml/serializer.ixx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cutl/xml/serializer.ixx b/cutl/xml/serializer.ixx index 115b77b..11ff33a 100644 --- a/cutl/xml/serializer.ixx +++ b/cutl/xml/serializer.ixx @@ -2,6 +2,8 @@ // copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file +#include <cutl/xml/value-traits.hxx> + namespace cutl { namespace xml @@ -36,10 +38,38 @@ namespace cutl attribute (qname.namespace_ (), qname.name (), value); } + template <typename T> + inline void serializer:: + attribute (const qname_type& qname, const T& value) + { + attribute (qname, value_traits<T>::serialize (value, *this)); + } + inline void serializer:: attribute (const std::string& name, const std::string& value) { attribute (std::string (), name, value); } + + template <typename T> + inline void serializer:: + attribute (const std::string& name, const T& value) + { + attribute (name, value_traits<T>::serialize (value, *this)); + } + + template <typename T> + inline void serializer:: + attribute (const std::string& ns, const std::string& name, const T& value) + { + attribute (ns, name, value_traits<T>::serialize (value, *this)); + } + + template <typename T> + inline void serializer:: + characters (const T& value) + { + characters (value_traits<T>::serialize (value, *this)); + } } } |