123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- #ifndef BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
- #define BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
- #include <boost/property_tree/ptree_fwd.hpp>
- #include <boost/property_tree/string_path.hpp>
- #include <boost/property_tree/stream_translator.hpp>
- #include <boost/property_tree/exceptions.hpp>
- #include <boost/property_tree/detail/ptree_utils.hpp>
- #include <boost/multi_index_container.hpp>
- #include <boost/multi_index/indexed_by.hpp>
- #include <boost/multi_index/sequenced_index.hpp>
- #include <boost/multi_index/ordered_index.hpp>
- #include <boost/multi_index/member.hpp>
- #include <boost/utility/enable_if.hpp>
- #include <boost/throw_exception.hpp>
- #include <boost/optional.hpp>
- #include <utility>
- namespace boost { namespace property_tree
- {
-
- template<class Key, class Data, class KeyCompare>
- class basic_ptree
- {
- #if defined(BOOST_PROPERTY_TREE_DOXYGEN_INVOKED)
- public:
- #endif
-
-
- typedef basic_ptree<Key, Data, KeyCompare> self_type;
- public:
-
- typedef Key key_type;
- typedef Data data_type;
- typedef KeyCompare key_compare;
-
- typedef std::pair<const Key, self_type> value_type;
- typedef std::size_t size_type;
-
-
- class iterator;
- class const_iterator;
- class reverse_iterator;
- class const_reverse_iterator;
-
- class assoc_iterator;
- class const_assoc_iterator;
-
- typedef typename path_of<Key>::type path_type;
-
-
- basic_ptree();
-
- explicit basic_ptree(const data_type &data);
- basic_ptree(const self_type &rhs);
- ~basic_ptree();
-
- self_type &operator =(const self_type &rhs);
-
- void swap(self_type &rhs);
-
-
- size_type size() const;
- size_type max_size() const;
-
- bool empty() const;
- iterator begin();
- const_iterator begin() const;
- iterator end();
- const_iterator end() const;
- reverse_iterator rbegin();
- const_reverse_iterator rbegin() const;
- reverse_iterator rend();
- const_reverse_iterator rend() const;
- value_type &front();
- const value_type &front() const;
- value_type &back();
- const value_type &back() const;
-
- iterator insert(iterator where, const value_type &value);
-
- template<class It> void insert(iterator where, It first, It last);
-
- iterator erase(iterator where);
-
- iterator erase(iterator first, iterator last);
-
- iterator push_front(const value_type &value);
-
- iterator push_back(const value_type &value);
-
- void pop_front();
-
- void pop_back();
-
- void reverse();
-
- template<class Compare> void sort(Compare comp);
-
- void sort();
-
-
- bool operator ==(const self_type &rhs) const;
- bool operator !=(const self_type &rhs) const;
-
-
- assoc_iterator ordered_begin();
-
- const_assoc_iterator ordered_begin() const;
-
- assoc_iterator not_found();
-
- const_assoc_iterator not_found() const;
-
- assoc_iterator find(const key_type &key);
-
- const_assoc_iterator find(const key_type &key) const;
-
- std::pair<assoc_iterator, assoc_iterator>
- equal_range(const key_type &key);
-
- std::pair<const_assoc_iterator, const_assoc_iterator>
- equal_range(const key_type &key) const;
-
- size_type count(const key_type &key) const;
-
- size_type erase(const key_type &key);
-
- iterator to_iterator(assoc_iterator it);
-
- const_iterator to_iterator(const_assoc_iterator it) const;
-
-
- data_type &data();
-
- const data_type &data() const;
-
- void clear();
-
- self_type &get_child(const path_type &path);
-
- const self_type &get_child(const path_type &path) const;
-
- self_type &get_child(const path_type &path, self_type &default_value);
-
- const self_type &get_child(const path_type &path,
- const self_type &default_value) const;
-
- optional<self_type &> get_child_optional(const path_type &path);
-
- optional<const self_type &>
- get_child_optional(const path_type &path) const;
-
- self_type &put_child(const path_type &path, const self_type &value);
-
- self_type &add_child(const path_type &path, const self_type &value);
-
- template<class Type, class Translator>
- typename boost::enable_if<detail::is_translator<Translator>, Type>::type
- get_value(Translator tr) const;
-
- template<class Type>
- Type get_value() const;
-
- template<class Type, class Translator>
- Type get_value(const Type &default_value, Translator tr) const;
-
- template <class Ch, class Translator>
- typename boost::enable_if<
- detail::is_character<Ch>,
- std::basic_string<Ch>
- >::type
- get_value(const Ch *default_value, Translator tr) const;
-
- template<class Type>
- typename boost::disable_if<detail::is_translator<Type>, Type>::type
- get_value(const Type &default_value) const;
-
- template <class Ch>
- typename boost::enable_if<
- detail::is_character<Ch>,
- std::basic_string<Ch>
- >::type
- get_value(const Ch *default_value) const;
-
- template<class Type, class Translator>
- optional<Type> get_value_optional(Translator tr) const;
-
- template<class Type>
- optional<Type> get_value_optional() const;
-
- template<class Type, class Translator>
- void put_value(const Type &value, Translator tr);
-
- template<class Type>
- void put_value(const Type &value);
-
- template<class Type, class Translator>
- typename boost::enable_if<detail::is_translator<Translator>, Type>::type
- get(const path_type &path, Translator tr) const;
-
- template<class Type>
- Type get(const path_type &path) const;
-
- template<class Type, class Translator>
- Type get(const path_type &path,
- const Type &default_value,
- Translator tr) const;
-
- template <class Ch, class Translator>
- typename boost::enable_if<
- detail::is_character<Ch>,
- std::basic_string<Ch>
- >::type
- get(const path_type &path, const Ch *default_value, Translator tr)const;
-
- template<class Type>
- typename boost::disable_if<detail::is_translator<Type>, Type>::type
- get(const path_type &path, const Type &default_value) const;
-
- template <class Ch>
- typename boost::enable_if<
- detail::is_character<Ch>,
- std::basic_string<Ch>
- >::type
- get(const path_type &path, const Ch *default_value) const;
-
- template<class Type, class Translator>
- optional<Type> get_optional(const path_type &path, Translator tr) const;
-
- template<class Type>
- optional<Type> get_optional(const path_type &path) const;
-
- template<class Type, class Translator>
- self_type &put(const path_type &path, const Type &value, Translator tr);
-
- template<class Type>
- self_type &put(const path_type &path, const Type &value);
-
- template<class Type, class Translator>
- self_type &add(const path_type &path,
- const Type &value,
- Translator tr);
-
- template<class Type>
- self_type &add(const path_type &path, const Type &value);
- private:
-
- data_type m_data;
-
-
- void* m_children;
-
-
- self_type* walk_path(path_type& p) const;
-
-
-
- self_type& force_path(path_type& p);
-
- struct subs;
- friend struct subs;
- friend class iterator;
- friend class const_iterator;
- friend class reverse_iterator;
- friend class const_reverse_iterator;
- };
- }}
- #include <boost/property_tree/detail/ptree_implementation.hpp>
- #endif
|