From ce3dfdff0d03697bf0c9e0cc9fb45dc6ef7c4ba9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 13 Mar 2013 12:42:37 +0200 Subject: Add support for XML serializing values other than std::string --- cutl/xml/serializer.ixx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'cutl/xml/serializer.ixx') 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 + namespace cutl { namespace xml @@ -36,10 +38,38 @@ namespace cutl attribute (qname.namespace_ (), qname.name (), value); } + template + inline void serializer:: + attribute (const qname_type& qname, const T& value) + { + attribute (qname, value_traits::serialize (value, *this)); + } + inline void serializer:: attribute (const std::string& name, const std::string& value) { attribute (std::string (), name, value); } + + template + inline void serializer:: + attribute (const std::string& name, const T& value) + { + attribute (name, value_traits::serialize (value, *this)); + } + + template + inline void serializer:: + attribute (const std::string& ns, const std::string& name, const T& value) + { + attribute (ns, name, value_traits::serialize (value, *this)); + } + + template + inline void serializer:: + characters (const T& value) + { + characters (value_traits::serialize (value, *this)); + } } } -- cgit v1.1