Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:18

0001 // ----------------------------------------------------------------------------
0002 // Copyright (C) 2009 Sebastian Redl
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. 
0005 // (See accompanying file LICENSE_1_0.txt or copy at 
0006 // http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // For more information, see www.boost.org
0009 // ----------------------------------------------------------------------------
0010 
0011 #ifndef BOOST_PROPERTY_TREE_ID_TRANSLATOR_HPP_INCLUDED
0012 #define BOOST_PROPERTY_TREE_ID_TRANSLATOR_HPP_INCLUDED
0013 
0014 #include <boost/property_tree/ptree_fwd.hpp>
0015 
0016 #include <boost/optional/optional.hpp>
0017 #include <string>
0018 
0019 namespace boost { namespace property_tree
0020 {
0021 
0022     /// Simple implementation of the Translator concept. It does no translation.
0023     template <typename T>
0024     struct id_translator
0025     {
0026         typedef T internal_type;
0027         typedef T external_type;
0028 
0029         boost::optional<T> get_value(const T &v) { return v; }
0030         boost::optional<T> put_value(const T &v) { return v; }
0031     };
0032 
0033     // This is the default translator whenever you get two equal types.
0034     template <typename T>
0035     struct translator_between<T, T>
0036     {
0037         typedef id_translator<T> type;
0038     };
0039 
0040     // A more specific specialization for std::basic_string. Otherwise,
0041     // stream_translator's specialization wins.
0042     template <typename Ch, typename Traits, typename Alloc>
0043     struct translator_between< std::basic_string<Ch, Traits, Alloc>,
0044                                std::basic_string<Ch, Traits, Alloc> >
0045     {
0046         typedef id_translator< std::basic_string<Ch, Traits, Alloc> > type;
0047     };
0048 
0049 }}
0050 
0051 #endif