From 424e315dfa9a78aebf0653c95f83fe6ed452dd8e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 2 May 2017 21:26:58 +0300 Subject: Add hxx extension for headers and libstud prefix for library dir --- libstudxml/value-traits.hxx | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 libstudxml/value-traits.hxx (limited to 'libstudxml/value-traits.hxx') diff --git a/libstudxml/value-traits.hxx b/libstudxml/value-traits.hxx new file mode 100644 index 0000000..08590e2 --- /dev/null +++ b/libstudxml/value-traits.hxx @@ -0,0 +1,69 @@ +// file : libstudxml/value-traits.hxx -*- C++ -*- +// copyright : Copyright (c) 2013-2017 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef LIBSTUDXML_VALUE_TRAITS_HXX +#define LIBSTUDXML_VALUE_TRAITS_HXX + +#include + +#include +#include // std::size_t + +#include + +#include + +namespace xml +{ + template + struct default_value_traits + { + static T + parse (std::string, const parser&); + + static std::string + serialize (const T&, const serializer&); + }; + + template <> + struct LIBSTUDXML_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 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 + +#include + +#endif // LIBSTUDXML_VALUE_TRAITS_HXX -- cgit v1.1