annotate DEPENDENCIES/generic/include/boost/property_tree/id_translator.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // ----------------------------------------------------------------------------
Chris@16 2 // Copyright (C) 2009 Sebastian Redl
Chris@16 3 //
Chris@16 4 // Distributed under the Boost Software License, Version 1.0.
Chris@16 5 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 // For more information, see www.boost.org
Chris@16 9 // ----------------------------------------------------------------------------
Chris@16 10
Chris@16 11 #ifndef BOOST_PROPERTY_TREE_ID_TRANSLATOR_HPP_INCLUDED
Chris@16 12 #define BOOST_PROPERTY_TREE_ID_TRANSLATOR_HPP_INCLUDED
Chris@16 13
Chris@16 14 #include <boost/property_tree/ptree_fwd.hpp>
Chris@16 15
Chris@16 16 #include <boost/optional.hpp>
Chris@16 17 #include <string>
Chris@16 18
Chris@16 19 namespace boost { namespace property_tree
Chris@16 20 {
Chris@16 21
Chris@16 22 /// Simple implementation of the Translator concept. It does no translation.
Chris@16 23 template <typename T>
Chris@16 24 struct id_translator
Chris@16 25 {
Chris@16 26 typedef T internal_type;
Chris@16 27 typedef T external_type;
Chris@16 28
Chris@16 29 boost::optional<T> get_value(const T &v) { return v; }
Chris@16 30 boost::optional<T> put_value(const T &v) { return v; }
Chris@16 31 };
Chris@16 32
Chris@16 33 // This is the default translator whenever you get two equal types.
Chris@16 34 template <typename T>
Chris@16 35 struct translator_between<T, T>
Chris@16 36 {
Chris@16 37 typedef id_translator<T> type;
Chris@16 38 };
Chris@16 39
Chris@16 40 // A more specific specialization for std::basic_string. Otherwise,
Chris@16 41 // stream_translator's specialization wins.
Chris@16 42 template <typename Ch, typename Traits, typename Alloc>
Chris@16 43 struct translator_between< std::basic_string<Ch, Traits, Alloc>,
Chris@16 44 std::basic_string<Ch, Traits, Alloc> >
Chris@16 45 {
Chris@16 46 typedef id_translator< std::basic_string<Ch, Traits, Alloc> > type;
Chris@16 47 };
Chris@16 48
Chris@16 49 }}
Chris@16 50
Chris@16 51 #endif