ptree.hpp
Go to the documentation of this file.
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 
12 #ifndef BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
13 #define BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
14 
20 
28 #include <boost/optional.hpp>
29 #include <utility> // for std::pair
30 
31 namespace boost { namespace property_tree
32 {
33 
47  template<class Key, class Data, class KeyCompare>
49  {
50 #if defined(BOOST_PROPERTY_TREE_DOXYGEN_INVOKED)
51  public:
52 #endif
53  // Internal types
59 
60  public:
61  // Basic types
62  typedef Key key_type;
63  typedef Data data_type;
64  typedef KeyCompare key_compare;
65 
66  // Container view types
67  typedef std::pair<const Key, self_type> value_type;
68  typedef std::size_t size_type;
69 
70  // The problem with the iterators is that I can't make them complete
71  // until the container is complete. Sucks. Especially for the reverses.
72  class iterator;
73  class const_iterator;
74  class reverse_iterator;
76 
77  // Associative view types
78  class assoc_iterator;
80 
81  // Property tree view types
82  typedef typename path_of<Key>::type path_type;
83 
84 
85  // The big five
86 
88  basic_ptree();
90  explicit basic_ptree(const data_type &data);
91  basic_ptree(const self_type &rhs);
92  ~basic_ptree();
94  self_type &operator =(const self_type &rhs);
95 
99  void swap(self_type &rhs);
100 
101  // Container view functions
102 
104  size_type size() const;
105  size_type max_size() const;
107  bool empty() const;
108 
109  iterator begin();
110  const_iterator begin() const;
111  iterator end();
112  const_iterator end() const;
117 
118  value_type &front();
119  const value_type &front() const;
120  value_type &back();
121  const value_type &back() const;
122 
127  iterator insert(iterator where, const value_type &value);
128 
134  template<class It> void insert(iterator where, It first, It last);
135 
141  iterator erase(iterator where);
142 
148  iterator erase(iterator first, iterator last);
149 
151  iterator push_front(const value_type &value);
152 
154  iterator push_back(const value_type &value);
155 
157  void pop_front();
158 
160  void pop_back();
161 
163  void reverse();
164 
168  template<class Compare> void sort(Compare comp);
169 
171  void sort();
172 
173  // Equality
174 
179  bool operator ==(const self_type &rhs) const;
180  bool operator !=(const self_type &rhs) const;
181 
182  // Associative view
183 
188 
197 
202  assoc_iterator find(const key_type &key);
203 
208  const_assoc_iterator find(const key_type &key) const;
209 
211  std::pair<assoc_iterator, assoc_iterator>
212  equal_range(const key_type &key);
213 
215  std::pair<const_assoc_iterator, const_assoc_iterator>
216  equal_range(const key_type &key) const;
217 
219  size_type count(const key_type &key) const;
220 
223  size_type erase(const key_type &key);
224 
230 
236 
237  // Property tree view
238 
240  data_type &data();
241 
243  const data_type &data() const;
244 
246  void clear();
247 
262 
264  const self_type &get_child(const path_type &path) const;
265 
267  self_type &get_child(const path_type &path, self_type &default_value);
268 
270  const self_type &get_child(const path_type &path,
271  const self_type &default_value) const;
272 
275 
278  get_child_optional(const path_type &path) const;
279 
288  self_type &put_child(const path_type &path, const self_type &value);
289 
298  self_type &add_child(const path_type &path, const self_type &value);
299 
304  template<class Type, class Translator>
306  get_value(Translator tr) const;
307 
312  template<class Type>
313  Type get_value() const;
314 
319  template<class Type, class Translator>
320  Type get_value(const Type &default_value, Translator tr) const;
321 
323  template <class Ch, class Translator>
324  typename boost::enable_if<
326  std::basic_string<Ch>
327  >::type
328  get_value(const Ch *default_value, Translator tr) const;
329 
334  template<class Type>
336  get_value(const Type &default_value) const;
337 
339  template <class Ch>
340  typename boost::enable_if<
342  std::basic_string<Ch>
343  >::type
344  get_value(const Ch *default_value) const;
345 
350  template<class Type, class Translator>
351  optional<Type> get_value_optional(Translator tr) const;
352 
357  template<class Type>
359 
364  template<class Type, class Translator>
365  void put_value(const Type &value, Translator tr);
366 
371  template<class Type>
372  void put_value(const Type &value);
373 
375  template<class Type, class Translator>
377  get(const path_type &path, Translator tr) const;
378 
380  template<class Type>
381  Type get(const path_type &path) const;
382 
388  template<class Type, class Translator>
389  Type get(const path_type &path,
390  const Type &default_value,
391  Translator tr) const;
392 
394  template <class Ch, class Translator>
395  typename boost::enable_if<
397  std::basic_string<Ch>
398  >::type
399  get(const path_type &path, const Ch *default_value, Translator tr)const;
400 
406  template<class Type>
408  get(const path_type &path, const Type &default_value) const;
409 
411  template <class Ch>
412  typename boost::enable_if<
414  std::basic_string<Ch>
415  >::type
416  get(const path_type &path, const Ch *default_value) const;
417 
426  template<class Type, class Translator>
427  optional<Type> get_optional(const path_type &path, Translator tr) const;
428 
437  template<class Type>
439 
446  template<class Type, class Translator>
447  self_type &put(const path_type &path, const Type &value, Translator tr);
448 
455  template<class Type>
456  self_type &put(const path_type &path, const Type &value);
457 
470  template<class Type, class Translator>
471  self_type &add(const path_type &path,
472  const Type &value,
473  Translator tr);
474 
486  template<class Type>
487  self_type &add(const path_type &path, const Type &value);
488 
489  private:
490  // Hold the data of this node
492  // Hold the children - this is a void* because we can't complete the
493  // container type within the class.
494  void* m_children;
495 
496  // Getter tree-walk. Not const-safe! Gets the node the path refers to,
497  // or null. Destroys p's value.
498  self_type* walk_path(path_type& p) const;
499 
500  // Modifer tree-walk. Gets the parent of the node referred to by the
501  // path, creating nodes as necessary. p is the path to the remaining
502  // child.
504 
505  // This struct contains typedefs for the concrete types.
506  struct subs;
507  friend struct subs;
508  friend class iterator;
509  friend class const_iterator;
510  friend class reverse_iterator;
512  };
513 
514 }}
515 
517 
518 #endif
boost::property_tree::basic_ptree::to_iterator
iterator to_iterator(assoc_iterator it)
Definition: ptree_implementation.hpp:532
boost::property_tree::basic_ptree::size
size_type size() const
Definition: ptree_implementation.hpp:223
boost::property_tree::basic_ptree::get
boost::enable_if< detail::is_translator< Translator >, Type >::type get(const path_type &path, Translator tr) const
Definition: ptree_implementation.hpp:741
boost::property_tree::basic_ptree::const_reverse_iterator
Definition: ptree_implementation.hpp:121
boost::property_tree::basic_ptree::get_value_optional
optional< Type > get_value_optional() const
Definition: ptree_implementation.hpp:732
exceptions.hpp
boost::property_tree::basic_ptree::pop_back
void pop_back()
Definition: ptree_implementation.hpp:374
boost::property_tree::path_of
Definition: ptree_fwd.hpp:73
boost::property_tree::basic_ptree::max_size
size_type max_size() const
Definition: ptree_implementation.hpp:230
boost::property_tree::basic_ptree::walk_path
self_type * walk_path(path_type &p) const
Definition: ptree_implementation.hpp:885
boost::property_tree::basic_ptree::begin
iterator begin()
Definition: ptree_implementation.hpp:243
ptree_utils.hpp
boost::property_tree::basic_ptree::reverse_iterator
Definition: ptree_implementation.hpp:111
boost::property_tree::basic_ptree::get_value
Type get_value() const
Definition: ptree_implementation.hpp:677
boost::type
Definition: type.hpp:14
boost::property_tree::basic_ptree::get_optional
optional< Type > get_optional(const path_type &path, Translator tr) const
Definition: ptree_implementation.hpp:798
boost::property_tree::basic_ptree::m_data
data_type m_data
Definition: ptree.hpp:491
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::property_tree::basic_ptree::equal_range
std::pair< assoc_iterator, assoc_iterator > equal_range(const key_type &key)
Definition: ptree_implementation.hpp:494
boost::property_tree::basic_ptree::erase
iterator erase(iterator where)
Definition: ptree_implementation.hpp:341
boost::property_tree::basic_ptree::m_children
void * m_children
Definition: ptree.hpp:494
boost::property_tree::basic_ptree::push_back
iterator push_back(const value_type &value)
Definition: ptree_implementation.hpp:362
boost::property_tree::basic_ptree::get_child_optional
optional< self_type & > get_child_optional(const path_type &path)
Definition: ptree_implementation.hpp:610
boost::property_tree::basic_ptree::rend
reverse_iterator rend()
Definition: ptree_implementation.hpp:285
boost::property_tree::basic_ptree::not_found
assoc_iterator not_found()
Definition: ptree_implementation.hpp:464
boost::property_tree::basic_ptree::count
size_type count(const key_type &key) const
Definition: ptree_implementation.hpp:518
boost::property_tree::basic_ptree::subs
Definition: ptree_implementation.hpp:30
indexed_by.hpp
boost::property_tree::detail::is_character
Definition: ptree_utils.hpp:41
boost::property_tree::basic_ptree::path_type
path_of< Key >::type path_type
Definition: ptree.hpp:79
boost::property_tree::basic_ptree::put
self_type & put(const path_type &path, const Type &value, Translator tr)
boost::disable_if
Definition: core/enable_if.hpp:64
boost::property_tree::basic_ptree::force_path
self_type & force_path(path_type &p)
Definition: ptree_implementation.hpp:903
boost::property_tree::basic_ptree::ordered_begin
assoc_iterator ordered_begin()
Definition: ptree_implementation.hpp:450
boost::property_tree::basic_ptree::clear
void clear()
Definition: ptree_implementation.hpp:563
boost::property_tree::basic_ptree::reverse
void reverse()
Definition: ptree_implementation.hpp:380
stream_translator.hpp
boost::property_tree::basic_ptree::operator!=
bool operator!=(const self_type &rhs) const
Definition: ptree_implementation.hpp:440
boost::property_tree::basic_ptree::front
value_type & front()
Definition: ptree_implementation.hpp:299
boost::property_tree::basic_ptree::end
iterator end()
Definition: ptree_implementation.hpp:257
boost::property_tree::basic_ptree::key_compare
KeyCompare key_compare
Definition: ptree.hpp:64
boost::property_tree::basic_ptree::empty
bool empty() const
Definition: ptree_implementation.hpp:236
boost::property_tree::basic_ptree::swap
void swap(self_type &rhs)
Definition: ptree_implementation.hpp:212
boost::property_tree::basic_ptree::data
data_type & data()
Definition: ptree_implementation.hpp:550
boost::property_tree::basic_ptree::insert
iterator insert(iterator where, const value_type &value)
Definition: ptree_implementation.hpp:327
enable_if.hpp
boost::property_tree::basic_ptree::operator=
self_type & operator=(const self_type &rhs)
Definition: ptree_implementation.hpp:199
boost::property_tree::basic_ptree::back
value_type & back()
Definition: ptree_implementation.hpp:313
boost::enable_if
Definition: core/enable_if.hpp:41
boost::property_tree::basic_ptree::put_child
self_type & put_child(const path_type &path, const self_type &value)
Definition: ptree_implementation.hpp:634
ptree_implementation.hpp
boost::property_tree::basic_ptree::self_type
basic_ptree< Key, Data, KeyCompare > self_type
Definition: ptree.hpp:58
boost::property_tree::basic_ptree::key_type
Key key_type
Definition: ptree.hpp:62
sequenced_index.hpp
boost::property_tree::string_path
Definition: ptree_fwd.hpp:36
boost::property_tree::basic_ptree::sort
void sort()
Definition: ptree_implementation.hpp:416
boost::property_tree::basic_ptree::add_child
self_type & add_child(const path_type &path, const self_type &value)
Definition: ptree_implementation.hpp:652
boost::property_tree::basic_ptree::data_type
Data data_type
Definition: ptree.hpp:63
boost::property_tree::basic_ptree::const_iterator
Definition: ptree_implementation.hpp:98
member.hpp
Ch
#define Ch(x, y, z)
Definition: SHA256.cpp:47
boost::property_tree::basic_ptree::value_type
std::pair< const Key, self_type > value_type
Definition: ptree.hpp:67
boost::property_tree::basic_ptree::size_type
std::size_t size_type
Definition: ptree.hpp:68
boost::property_tree::basic_ptree::iterator
Definition: ptree_implementation.hpp:75
boost::property_tree::basic_ptree::push_front
iterator push_front(const value_type &value)
Definition: ptree_implementation.hpp:355
ordered_index.hpp
boost::property_tree::basic_ptree::const_assoc_iterator
Definition: ptree_implementation.hpp:157
boost::property_tree::basic_ptree::~basic_ptree
~basic_ptree()
Definition: ptree_implementation.hpp:206
boost::property_tree::basic_ptree
Definition: ptree.hpp:48
boost::property_tree::basic_ptree::assoc_iterator
Definition: ptree_implementation.hpp:135
throw_exception.hpp
string_path.hpp
boost::property_tree::basic_ptree::get_child
self_type & get_child(const path_type &path)
Definition: ptree_implementation.hpp:571
boost::property_tree::basic_ptree::basic_ptree
basic_ptree()
Definition: ptree_implementation.hpp:179
multi_index_container.hpp
ptree_fwd.hpp
boost::property_tree::basic_ptree::pop_front
void pop_front()
Definition: ptree_implementation.hpp:368
boost::property_tree::basic_ptree::put_value
void put_value(const Type &value, Translator tr)
Definition: ptree_implementation.hpp:821
boost::property_tree::basic_ptree::operator==
bool operator==(const self_type &rhs) const
Definition: ptree_implementation.hpp:431
boost::optional
Definition: old_optional_implementation.hpp:646
boost::property_tree::basic_ptree::find
assoc_iterator find(const key_type &key)
Definition: ptree_implementation.hpp:478
boost::property_tree::basic_ptree::add
self_type & add(const path_type &path, const Type &value, Translator tr)
boost::property_tree::basic_ptree::rbegin
reverse_iterator rbegin()
Definition: ptree_implementation.hpp:271
optional.hpp


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:45:47