1
// ----------------------------------------------------------------------------
2
// Copyright (C) 2009 Sebastian Redl
4
// Distributed under the Boost Software License, Version 1.0.
5
// (See accompanying file LICENSE_1_0.txt or copy at
6
// http://www.boost.org/LICENSE_1_0.txt)
8
// For more information, see www.boost.org
9
// ----------------------------------------------------------------------------
11
#ifndef BOOST_PROPERTY_TREE_ID_TRANSLATOR_HPP_INCLUDED
12
#define BOOST_PROPERTY_TREE_ID_TRANSLATOR_HPP_INCLUDED
14
#include <boost/property_tree/ptree_fwd.hpp>
16
#include <boost/optional.hpp>
19
namespace boost { namespace property_tree
22
/// Simple implementation of the Translator concept. It does no translation.
26
typedef T internal_type;
27
typedef T external_type;
29
boost::optional<T> get_value(const T &v) { return v; }
30
boost::optional<T> put_value(const T &v) { return v; }
33
// This is the default translator whenever you get two equal types.
35
struct translator_between<T, T>
37
typedef id_translator<T> type;
40
// A more specific specialization for std::basic_string. Otherwise,
41
// stream_translator's specialization wins.
42
template <typename Ch, typename Traits, typename Alloc>
43
struct translator_between< std::basic_string<Ch, Traits, Alloc>,
44
std::basic_string<Ch, Traits, Alloc> >
46
typedef id_translator< std::basic_string<Ch, Traits, Alloc> > type;