Chris@16: // ---------------------------------------------------------------------------- Chris@16: // Copyright (C) 2002-2006 Marcin Kalicinski Chris@16: // Copyright (C) 2009 Sebastian Redl Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // For more information, see www.boost.org Chris@16: // ---------------------------------------------------------------------------- Chris@16: #ifndef BOOST_PROPERTY_TREE_PTREE_FWD_HPP_INCLUDED Chris@16: #define BOOST_PROPERTY_TREE_PTREE_FWD_HPP_INCLUDED Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include // for std::less Chris@16: #include // for std::allocator Chris@16: #include Chris@16: Chris@16: namespace boost { namespace property_tree Chris@16: { Chris@16: namespace detail { Chris@16: template struct less_nocase; Chris@16: } Chris@16: Chris@16: // Classes Chris@16: Chris@16: template < class Key, class Data, class KeyCompare = std::less > Chris@16: class basic_ptree; Chris@16: Chris@16: template Chris@16: struct id_translator; Chris@16: Chris@16: template Chris@16: class string_path; Chris@16: Chris@16: // Texas-style concepts for documentation only. Chris@16: #if 0 Chris@16: concept PropertyTreePath { Chris@16: // The key type for which this path works. Chris@16: typename key_type; Chris@16: // Return the key that the first segment of the path names. Chris@16: // Split the head off the state. Chris@16: key_type Path::reduce(); Chris@16: Chris@16: // Return true if the path is empty. Chris@16: bool Path::empty() const; Chris@16: Chris@16: // Return true if the path contains a single element. Chris@16: bool Path::single() const; Chris@16: Chris@16: // Dump as a std::string, for exception messages. Chris@16: std::string Path::dump() const; Chris@16: } Chris@16: concept PropertyTreeKey { Chris@16: PropertyTreePath path; Chris@16: requires SameType::key_type>; Chris@16: } Chris@16: concept PropertyTreeTranslator { Chris@16: typename internal_type; Chris@16: typename external_type; Chris@16: Chris@16: boost::optional Tr::get_value(internal_type); Chris@16: boost::optional Tr::put_value(external_type); Chris@16: } Chris@16: #endif Chris@16: /// If you want to use a custom key type, specialize this struct for it Chris@16: /// and give it a 'type' typedef that specifies your path type. The path Chris@16: /// type must conform to the Path concept described in the documentation. Chris@16: /// This is already specialized for std::basic_string. Chris@16: template Chris@16: struct path_of; Chris@16: Chris@16: /// Specialize this struct to specify a default translator between the data Chris@16: /// in a tree whose data_type is Internal, and the external data_type Chris@16: /// specified in a get_value, get, put_value or put operation. Chris@16: /// This is already specialized for Internal being std::basic_string. Chris@16: template Chris@16: struct translator_between; Chris@16: Chris@16: class ptree_error; Chris@16: class ptree_bad_data; Chris@16: class ptree_bad_path; Chris@16: Chris@16: // Typedefs Chris@16: Chris@16: /** Implements a path using a std::string as the key. */ Chris@16: typedef string_path > path; Chris@16: Chris@16: /** Chris@16: * A property tree with std::string for key and data, and default Chris@16: * comparison. Chris@16: */ Chris@16: typedef basic_ptree ptree; Chris@16: Chris@16: /** Chris@16: * A property tree with std::string for key and data, and case-insensitive Chris@16: * comparison. Chris@16: */ Chris@16: typedef basic_ptree > Chris@16: iptree; Chris@16: Chris@16: #ifndef BOOST_NO_STD_WSTRING Chris@16: /** Implements a path using a std::wstring as the key. */ Chris@16: typedef string_path > wpath; Chris@16: Chris@16: /** Chris@16: * A property tree with std::wstring for key and data, and default Chris@16: * comparison. Chris@16: * @note The type only exists if the platform supports @c wchar_t. Chris@16: */ Chris@16: typedef basic_ptree wptree; Chris@16: Chris@16: /** Chris@16: * A property tree with std::wstring for key and data, and case-insensitive Chris@16: * comparison. Chris@16: * @note The type only exists if the platform supports @c wchar_t. Chris@16: */ Chris@16: typedef basic_ptree > Chris@16: wiptree; Chris@16: #endif Chris@16: Chris@16: // Free functions Chris@16: Chris@16: /** Chris@16: * Swap two property tree instances. Chris@16: */ Chris@16: template Chris@16: void swap(basic_ptree &pt1, Chris@16: basic_ptree &pt2); Chris@16: Chris@16: } } Chris@16: Chris@16: Chris@16: #if !defined(BOOST_PROPERTY_TREE_DOXYGEN_INVOKED) Chris@16: // Throwing macro to avoid no return warnings portably Chris@16: # define BOOST_PROPERTY_TREE_THROW(e) BOOST_THROW_EXCEPTION(e) Chris@16: #endif Chris@16: Chris@16: #endif