// file : cutl/xml/value-traits.hxx // copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file #ifndef CUTL_XML_VALUE_TRAITS_HXX #define CUTL_XML_VALUE_TRAITS_HXX #include #include // std::size_t #include namespace cutl { namespace xml { class parser; class serializer; template struct default_value_traits { static T parse (std::string, const parser&); static std::string serialize (const T&, const serializer&); }; template <> struct LIBCUTL_EXPORT default_value_traits { static bool parse (std::string, const parser&); static std::string serialize (bool v, const serializer&) { return v ? "true" : "false"; } }; template <> struct LIBCUTL_EXPORT default_value_traits { static std::string parse (std::string s, const parser&) { return s; } static std::string serialize (const std::string& v, const serializer&) { return v; } }; template struct value_traits: default_value_traits {}; template struct value_traits: default_value_traits {}; } } #include #endif // CUTL_XML_VALUE_TRAITS_HXX