Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
GenericMemberIterator< Const, Encoding, Allocator > Class Template Reference

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

#include <document.h>

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 99 of file document.h.

Member Typedef Documentation

template<bool Const, typename Encoding , typename Allocator >
typedef GenericMemberIterator<true,Encoding,Allocator> GenericMemberIterator< Const, Encoding, Allocator >::ConstIterator

Constant iterator type.

Definition at line 111 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef std::ptrdiff_t GenericMemberIterator< Const, Encoding, Allocator >::difference_type

Definition at line 120 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef difference_type GenericMemberIterator< Const, Encoding, Allocator >::DifferenceType

Signed integer type (e.g. ptrdiff_t)

Definition at line 129 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef GenericMemberIterator GenericMemberIterator< Const, Encoding, Allocator >::Iterator

Iterator type itself.

Definition at line 109 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef std::random_access_iterator_tag GenericMemberIterator< Const, Encoding, Allocator >::iterator_category

Definition at line 121 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef GenericMemberIterator<false,Encoding,Allocator> GenericMemberIterator< Const, Encoding, Allocator >::NonConstIterator

Non-constant iterator type.

Definition at line 113 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef GenericMember<Encoding,Allocator> GenericMemberIterator< Const, Encoding, Allocator >::PlainType
private

Definition at line 104 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef ValueType* GenericMemberIterator< Const, Encoding, Allocator >::pointer

Definition at line 118 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef pointer GenericMemberIterator< Const, Encoding, Allocator >::Pointer

Pointer to (const) GenericMember.

Definition at line 125 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef ValueType& GenericMemberIterator< Const, Encoding, Allocator >::reference

Definition at line 119 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef reference GenericMemberIterator< Const, Encoding, Allocator >::Reference

Reference to (const) GenericMember.

Definition at line 127 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef ValueType GenericMemberIterator< Const, Encoding, Allocator >::value_type

Definition at line 117 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
typedef internal::MaybeAddConst<Const,PlainType>::Type GenericMemberIterator< Const, Encoding, Allocator >::ValueType
private

Definition at line 105 of file document.h.

Constructor & Destructor Documentation

template<bool Const, typename Encoding , typename Allocator >
GenericMemberIterator< Const, Encoding, Allocator >::GenericMemberIterator ( )
inline

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 135 of file document.h.

135 : ptr_() {}
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
GenericMemberIterator< Const, Encoding, Allocator >::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 153 of file document.h.

153 : ptr_(it.ptr_) {}
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
GenericMemberIterator< Const, Encoding, Allocator >::GenericMemberIterator ( Pointer  p)
inlineexplicitprivate

Internal constructor from plain pointer.

Definition at line 195 of file document.h.

195 : ptr_(p) {}
Pointer ptr_
raw pointer
Definition: document.h:197

Member Function Documentation

template<bool Const, typename Encoding , typename Allocator >
bool GenericMemberIterator< Const, Encoding, Allocator >::operator!= ( ConstIterator  that) const
inline

Definition at line 176 of file document.h.

176 { return ptr_ != that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
Reference GenericMemberIterator< Const, Encoding, Allocator >::operator* ( ) const
inline

Definition at line 185 of file document.h.

185 { return *ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
Iterator GenericMemberIterator< Const, Encoding, Allocator >::operator+ ( DifferenceType  n) const
inline

Definition at line 166 of file document.h.

166 { return Iterator(ptr_+n); }
Pointer ptr_
raw pointer
Definition: document.h:197
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:109
std::void_t< T > n
template<bool Const, typename Encoding , typename Allocator >
Iterator& GenericMemberIterator< Const, Encoding, Allocator >::operator++ ( )
inline

Definition at line 158 of file document.h.

158 { ++ptr_; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
Iterator GenericMemberIterator< Const, Encoding, Allocator >::operator++ ( int  )
inline

Definition at line 160 of file document.h.

160 { Iterator old(*this); ++ptr_; return old; }
Pointer ptr_
raw pointer
Definition: document.h:197
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:109
template<bool Const, typename Encoding , typename Allocator >
Iterator& GenericMemberIterator< Const, Encoding, Allocator >::operator+= ( DifferenceType  n)
inline

Definition at line 169 of file document.h.

169 { ptr_+=n; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:197
std::void_t< T > n
template<bool Const, typename Encoding , typename Allocator >
Iterator GenericMemberIterator< Const, Encoding, Allocator >::operator- ( DifferenceType  n) const
inline

Definition at line 167 of file document.h.

167 { return Iterator(ptr_-n); }
Pointer ptr_
raw pointer
Definition: document.h:197
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:109
std::void_t< T > n
template<bool Const, typename Encoding , typename Allocator >
DifferenceType GenericMemberIterator< Const, Encoding, Allocator >::operator- ( ConstIterator  that) const
inline

Distance.

Definition at line 191 of file document.h.

191 { return ptr_-that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
Iterator& GenericMemberIterator< Const, Encoding, Allocator >::operator-- ( )
inline

Definition at line 159 of file document.h.

159 { --ptr_; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
Iterator GenericMemberIterator< Const, Encoding, Allocator >::operator-- ( int  )
inline

Definition at line 161 of file document.h.

161 { Iterator old(*this); --ptr_; return old; }
Pointer ptr_
raw pointer
Definition: document.h:197
GenericMemberIterator Iterator
Iterator type itself.
Definition: document.h:109
template<bool Const, typename Encoding , typename Allocator >
Iterator& GenericMemberIterator< Const, Encoding, Allocator >::operator-= ( DifferenceType  n)
inline

Definition at line 170 of file document.h.

170 { ptr_-=n; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:197
std::void_t< T > n
template<bool Const, typename Encoding , typename Allocator >
Pointer GenericMemberIterator< Const, Encoding, Allocator >::operator-> ( ) const
inline

Definition at line 186 of file document.h.

186 { return ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
bool GenericMemberIterator< Const, Encoding, Allocator >::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:197
template<bool Const, typename Encoding , typename Allocator >
bool GenericMemberIterator< Const, Encoding, Allocator >::operator<= ( ConstIterator  that) const
inline

Definition at line 177 of file document.h.

177 { return ptr_ <= that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
Iterator& GenericMemberIterator< Const, Encoding, Allocator >::operator= ( const NonConstIterator it)
inline

Definition at line 154 of file document.h.

154 { ptr_ = it.ptr_; return *this; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
bool GenericMemberIterator< Const, Encoding, Allocator >::operator== ( ConstIterator  that) const
inline

Definition at line 175 of file document.h.

175 { return ptr_ == that.ptr_; }
Pointer ptr_
raw pointer
Definition: document.h:197
template<bool Const, typename Encoding , typename Allocator >
bool GenericMemberIterator< Const, Encoding, Allocator >::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:197
template<bool Const, typename Encoding , typename Allocator >
bool GenericMemberIterator< Const, Encoding, Allocator >::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:197
template<bool Const, typename Encoding , typename Allocator >
Reference GenericMemberIterator< Const, Encoding, Allocator >::operator[] ( DifferenceType  n) const
inline

Definition at line 187 of file document.h.

187 { return ptr_[n]; }
Pointer ptr_
raw pointer
Definition: document.h:197
std::void_t< T > n

Friends And Related Function Documentation

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

Definition at line 102 of file document.h.

template<bool Const, typename Encoding , typename Allocator >
friend class GenericValue< Encoding, Allocator >
friend

Definition at line 101 of file document.h.

Member Data Documentation

template<bool Const, typename Encoding , typename Allocator >
Pointer GenericMemberIterator< Const, Encoding, Allocator >::ptr_
private

raw pointer

Definition at line 197 of file document.h.


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