| 1 |
// file : cutl/xml/serializer.ixx |
| 2 |
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC |
| 3 |
// license : MIT; see accompanying LICENSE file |
| 4 |
|
| 5 |
#include <cutl/xml/value-traits.hxx> |
| 6 |
|
| 7 |
namespace cutl |
| 8 |
{ |
| 9 |
namespace xml |
| 10 |
{ |
| 11 |
inline void serializer:: |
| 12 |
start_element (const qname_type& qname) |
| 13 |
{ |
| 14 |
start_element (qname.namespace_ (), qname.name ()); |
| 15 |
} |
| 16 |
|
| 17 |
inline void serializer:: |
| 18 |
start_element (const std::string& name) |
| 19 |
{ |
| 20 |
start_element (std::string (), name); |
| 21 |
} |
| 22 |
|
| 23 |
inline void serializer:: |
| 24 |
start_attribute (const qname_type& qname) |
| 25 |
{ |
| 26 |
start_attribute (qname.namespace_ (), qname.name ()); |
| 27 |
} |
| 28 |
|
| 29 |
inline void serializer:: |
| 30 |
start_attribute (const std::string& name) |
| 31 |
{ |
| 32 |
start_attribute (std::string (), name); |
| 33 |
} |
| 34 |
|
| 35 |
inline void serializer:: |
| 36 |
attribute (const qname_type& qname, const std::string& value) |
| 37 |
{ |
| 38 |
attribute (qname.namespace_ (), qname.name (), value); |
| 39 |
} |
| 40 |
|
| 41 |
template <typename T> |
| 42 |
inline void serializer:: |
| 43 |
attribute (const qname_type& qname, const T& value) |
| 44 |
{ |
| 45 |
attribute (qname, value_traits<T>::serialize (value, *this)); |
| 46 |
} |
| 47 |
|
| 48 |
inline void serializer:: |
| 49 |
attribute (const std::string& name, const std::string& value) |
| 50 |
{ |
| 51 |
attribute (std::string (), name, value); |
| 52 |
} |
| 53 |
|
| 54 |
template <typename T> |
| 55 |
inline void serializer:: |
| 56 |
attribute (const std::string& name, const T& value) |
| 57 |
{ |
| 58 |
attribute (name, value_traits<T>::serialize (value, *this)); |
| 59 |
} |
| 60 |
|
| 61 |
template <typename T> |
| 62 |
inline void serializer:: |
| 63 |
attribute (const std::string& ns, const std::string& name, const T& value) |
| 64 |
{ |
| 65 |
attribute (ns, name, value_traits<T>::serialize (value, *this)); |
| 66 |
} |
| 67 |
|
| 68 |
template <typename T> |
| 69 |
inline void serializer:: |
| 70 |
characters (const T& value) |
| 71 |
{ |
| 72 |
characters (value_traits<T>::serialize (value, *this)); |
| 73 |
} |
| 74 |
} |
| 75 |
} |