1// ----------------------------------------------------------------------------
2// Copyright (C) 2002-2006 Marcin Kalicinski
3// Copyright (C) 2009 Sebastian Redl
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// For more information, see www.boost.org
10// ----------------------------------------------------------------------------
11#ifndef BOOST_PROPERTY_TREE_PTREE_FWD_HPP_INCLUDED
12#define BOOST_PROPERTY_TREE_PTREE_FWD_HPP_INCLUDED
13
14#include <boost/config.hpp>
15#include <boost/optional/optional_fwd.hpp>
16#include <boost/throw_exception.hpp>
17#include <functional> // for std::less
18#include <memory> // for std::allocator
19#include <string>
20
21namespace boost { namespace property_tree
22{
23 namespace detail {
24 template <typename T> struct less_nocase;
25 }
26
27 // Classes
28
29 template < class Key, class Data, class KeyCompare = std::less<Key> >
30 class basic_ptree;
31
32 template <typename T>
33 struct id_translator;
34
35 template <typename String, typename Translator>
36 class string_path;
37
38 // Texas-style concepts for documentation only.
39#if 0
40 concept PropertyTreePath<class Path> {
41 // The key type for which this path works.
42 typename key_type;
43 // Return the key that the first segment of the path names.
44 // Split the head off the state.
45 key_type Path::reduce();
46
47 // Return true if the path is empty.
48 bool Path::empty() const;
49
50 // Return true if the path contains a single element.
51 bool Path::single() const;
52
53 // Dump as a std::string, for exception messages.
54 std::string Path::dump() const;
55 }
56 concept PropertyTreeKey<class Key> {
57 PropertyTreePath path;
58 requires SameType<Key, PropertyTreePath<path>::key_type>;
59 }
60 concept PropertyTreeTranslator<class Tr> {
61 typename internal_type;
62 typename external_type;
63
64 boost::optional<external_type> Tr::get_value(internal_type);
65 boost::optional<internal_type> Tr::put_value(external_type);
66 }
67#endif
68 /// If you want to use a custom key type, specialize this struct for it
69 /// and give it a 'type' typedef that specifies your path type. The path
70 /// type must conform to the Path concept described in the documentation.
71 /// This is already specialized for std::basic_string.
72 template <typename Key>
73 struct path_of;
74
75 /// Specialize this struct to specify a default translator between the data
76 /// in a tree whose data_type is Internal, and the external data_type
77 /// specified in a get_value, get, put_value or put operation.
78 /// This is already specialized for Internal being std::basic_string.
79 template <typename Internal, typename External>
80 struct translator_between;
81
82 class ptree_error;
83 class ptree_bad_data;
84 class ptree_bad_path;
85
86 // Typedefs
87
88 /** Implements a path using a std::string as the key. */
89 typedef string_path<std::string, id_translator<std::string> > path;
90
91 /**
92 * A property tree with std::string for key and data, and default
93 * comparison.
94 */
95 typedef basic_ptree<std::string, std::string> ptree;
96
97 /**
98 * A property tree with std::string for key and data, and case-insensitive
99 * comparison.
100 */
101 typedef basic_ptree<std::string, std::string,
102 detail::less_nocase<std::string> >
103 iptree;
104
105#ifndef BOOST_NO_STD_WSTRING
106 /** Implements a path using a std::wstring as the key. */
107 typedef string_path<std::wstring, id_translator<std::wstring> > wpath;
108
109 /**
110 * A property tree with std::wstring for key and data, and default
111 * comparison.
112 * @note The type only exists if the platform supports @c wchar_t.
113 */
114 typedef basic_ptree<std::wstring, std::wstring> wptree;
115
116 /**
117 * A property tree with std::wstring for key and data, and case-insensitive
118 * comparison.
119 * @note The type only exists if the platform supports @c wchar_t.
120 */
121 typedef basic_ptree<std::wstring, std::wstring,
122 detail::less_nocase<std::wstring> >
123 wiptree;
124#endif
125
126 // Free functions
127
128 /**
129 * Swap two property tree instances.
130 */
131 template<class K, class D, class C>
132 void swap(basic_ptree<K, D, C> &pt1,
133 basic_ptree<K, D, C> &pt2);
134
135} }
136
137
138#if !defined(BOOST_PROPERTY_TREE_DOXYGEN_INVOKED)
139 // Throwing macro to avoid no return warnings portably
140# define BOOST_PROPERTY_TREE_THROW(e) BOOST_THROW_EXCEPTION(e)
141#endif
142
143#endif
144

source code of boost/libs/property_tree/include/boost/property_tree/ptree_fwd.hpp