IN2OSM  1.0.1
GenericMemberIterator< Const, Encoding, Allocator >

(Constant) member iterator for a JSON object value More...

#include <document.h>

Collaboration diagram for GenericMemberIterator< Const, Encoding, Allocator >:
Collaboration graph

Public Types

typedef GenericMemberIterator Iterator
 Iterator type itself. More...
 
typedef GenericMemberIterator< true, Encoding, Allocator > ConstIterator
 Constant iterator type. More...
 
typedef GenericMemberIterator< false, Encoding, Allocator > NonConstIterator
 Non-constant iterator type. More...
 
typedef pointer Pointer
 Pointer to (const) GenericMember. More...
 
typedef reference Reference
 Reference to (const) GenericMember. More...
 
typedef difference_type DifferenceType
 Signed integer type (e.g. ptrdiff_t) More...
 
std::iterator_traits support
typedef ValueType value_type
 
typedef ValueTypepointer
 
typedef ValueTypereference
 
typedef std::ptrdiff_t difference_type
 
typedef std::random_access_iterator_tag iterator_category
 

Public Member Functions

 GenericMemberIterator ()
 Default constructor (singular value) More...
 
 GenericMemberIterator (const NonConstIterator &it)
 Iterator conversions to more const. More...
 
Iteratoroperator= (const NonConstIterator &it)
 
DifferenceType operator- (ConstIterator that) const
 Distance. More...
 
stepping
Iteratoroperator++ ()
 
Iteratoroperator-- ()
 
Iterator operator++ (int)
 
Iterator operator-- (int)
 
increment/decrement
Iterator operator+ (DifferenceType n) const
 
Iterator operator- (DifferenceType n) const
 
Iteratoroperator+= (DifferenceType n)
 
Iteratoroperator-= (DifferenceType n)
 
relations
bool operator== (ConstIterator that) const
 
bool operator!= (ConstIterator that) const
 
bool operator<= (ConstIterator that) const
 
bool operator>= (ConstIterator that) const
 
bool operator< (ConstIterator that) const
 
bool operator> (ConstIterator that) const
 
dereference
Reference operator* () const
 
Pointer operator-> () const
 
Reference operator[] (DifferenceType n) const
 

Private Types

typedef GenericMember< Encoding, Allocator > PlainType
 
typedef internal::MaybeAddConst< Const, PlainType >::Type ValueType
 

Private Member Functions

 GenericMemberIterator (Pointer p)
 Internal constructor from plain pointer. More...
 

Private Attributes

Pointer ptr_
 raw pointer More...
 

Friends

class GenericValue< Encoding, Allocator >
 
template<bool , typename , typename >
class GenericMemberIterator
 

Detailed Description

template<bool Const, typename Encoding, typename Allocator>
class GenericMemberIterator< Const, Encoding, Allocator >

(Constant) member iterator for a JSON object value

Template Parameters
ConstIs this a constant iterator?
EncodingEncoding of the value. (Even non-string values need to have the same encoding in a document)
AllocatorAllocator type for allocating memory of object, array and string.

This class implements a Random Access Iterator for GenericMember elements of a GenericValue, see ISO/IEC 14882:2003(E) C++ standard, 24.1 [lib.iterator.requirements].

Note
This iterator implementation is mainly intended to avoid implicit conversions from iterator values to NULL, e.g. from GenericValue::FindMember.
Define RAPIDJSON_NOMEMBERITERATORCLASS to fall back to a pointer-based implementation, if your platform doesn't provide the C++ <iterator> header.
See also
GenericMember, GenericValue::MemberIterator, GenericValue::ConstMemberIterator

Definition at line 102 of file document.h.

Member Typedef Documentation

◆ ConstIterator

typedef GenericMemberIterator<true,Encoding,Allocator> ConstIterator

Constant iterator type.

Definition at line 114 of file document.h.

◆ difference_type

typedef std::ptrdiff_t difference_type

Definition at line 123 of file document.h.

◆ DifferenceType

Signed integer type (e.g. ptrdiff_t)

Definition at line 132 of file document.h.

◆ Iterator

Iterator type itself.

Definition at line 112 of file document.h.

◆ iterator_category

typedef std::random_access_iterator_tag iterator_category

Definition at line 124 of file document.h.

◆ NonConstIterator

typedef GenericMemberIterator<false,Encoding,Allocator> NonConstIterator

Non-constant iterator type.

Definition at line 116 of file document.h.

◆ PlainType

typedef GenericMember<Encoding,Allocator> PlainType
private

Definition at line 107 of file document.h.

◆ pointer

typedef ValueType* pointer

Definition at line 121 of file document.h.

◆ Pointer

typedef pointer Pointer

Pointer to (const) GenericMember.

Definition at line 128 of file document.h.

◆ reference

typedef ValueType& reference

Definition at line 122 of file document.h.

◆ Reference

Reference to (const) GenericMember.

Definition at line 130 of file document.h.

◆ value_type

Definition at line 120 of file document.h.

◆ ValueType

typedef internal::MaybeAddConst<Const,PlainType>::Type ValueType
private

Definition at line 108 of file document.h.

Constructor & Destructor Documentation

◆ GenericMemberIterator() [1/3]

Default constructor (singular value)

Creates an iterator pointing to no element.

Note
All operations, except for comparisons, are undefined on such values.

Definition at line 138 of file document.h.

138 : ptr_() {}
Pointer ptr_
raw pointer
Definition: document.h:200

◆ GenericMemberIterator() [2/3]

GenericMemberIterator ( const NonConstIterator it)
inline

Iterator conversions to more const.

Parameters
it(Non-const) iterator to copy from

Allows the creation of an iterator from another GenericMemberIterator that is "less const". Especially, creating a non-constant iterator from a constant iterator are disabled:

  • const -> non-const (not ok)
  • const -> const (ok)
  • non-const -> const (ok)
  • non-const -> non-const (ok)
Note
If the Const template parameter is already false, this constructor effectively defines a regular copy-constructor. Otherwise, the copy constructor is implicitly defined.

Definition at line 156 of file document.h.

156 : ptr_(it.ptr_) {}
Pointer ptr_
raw pointer
Definition: document.h:200

◆ GenericMemberIterator() [3/3]

GenericMemberIterator ( Pointer  p)
inlineexplicitprivate

Internal constructor from plain pointer.

Definition at line 198 of file document.h.

198 : ptr_(p) {}
Pointer ptr_
raw pointer
Definition: document.h:200

Member Function Documentation

◆ operator!=()

bool operator!= ( ConstIterator  that) const
inline

Definition at line 179 of file document.h.

179 { return ptr_ != that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator*()

Reference operator* ( ) const
inline

Definition at line 188 of file document.h.

188 { return *ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator+()

Iterator operator+ ( DifferenceType  n) const
inline

Definition at line 169 of file document.h.

169 { return Iterator(ptr_+n); }
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:112
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator++() [1/2]

Iterator& operator++ ( )
inline

Definition at line 161 of file document.h.

161 { ++ptr_; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator++() [2/2]

Iterator operator++ ( int  )
inline

Definition at line 163 of file document.h.

163 { Iterator old(*this); ++ptr_; return old; }
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:112
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator+=()

Iterator& operator+= ( DifferenceType  n)
inline

Definition at line 172 of file document.h.

172 { ptr_+=n; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator-() [1/2]

Iterator operator- ( DifferenceType  n) const
inline

Definition at line 170 of file document.h.

170 { return Iterator(ptr_-n); }
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:112
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator-() [2/2]

DifferenceType operator- ( ConstIterator  that) const
inline

Distance.

Definition at line 194 of file document.h.

194 { return ptr_-that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator--() [1/2]

Iterator& operator-- ( )
inline

Definition at line 162 of file document.h.

162 { --ptr_; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator--() [2/2]

Iterator operator-- ( int  )
inline

Definition at line 164 of file document.h.

164 { Iterator old(*this); --ptr_; return old; }
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:112
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator-=()

Iterator& operator-= ( DifferenceType  n)
inline

Definition at line 173 of file document.h.

173 { ptr_-=n; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator->()

Pointer operator-> ( ) const
inline

Definition at line 189 of file document.h.

189 { return ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator<()

bool operator< ( ConstIterator  that) const
inline

Definition at line 182 of file document.h.

182 { return ptr_ < that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator<=()

bool operator<= ( ConstIterator  that) const
inline

Definition at line 180 of file document.h.

180 { return ptr_ <= that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator=()

Iterator& operator= ( const NonConstIterator it)
inline

Definition at line 157 of file document.h.

157 { ptr_ = it.ptr_; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator==()

bool operator== ( ConstIterator  that) const
inline

Definition at line 178 of file document.h.

178 { return ptr_ == that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator>()

bool operator> ( ConstIterator  that) const
inline

Definition at line 183 of file document.h.

183 { return ptr_ > that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator>=()

bool operator>= ( ConstIterator  that) const
inline

Definition at line 181 of file document.h.

181 { return ptr_ >= that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:200

◆ operator[]()

Reference operator[] ( DifferenceType  n) const
inline

Definition at line 190 of file document.h.

190 { return ptr_[n]; }
Pointer ptr_
raw pointer
Definition: document.h:200

Friends And Related Function Documentation

◆ GenericMemberIterator

friend class GenericMemberIterator
friend

Definition at line 105 of file document.h.

◆ GenericValue< Encoding, Allocator >

friend class GenericValue< Encoding, Allocator >
friend

Definition at line 104 of file document.h.

Member Data Documentation

◆ ptr_

Pointer ptr_
private

raw pointer

Definition at line 200 of file document.h.


The documentation for this class was generated from the following file: