A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JsonIterator< U > Class Template Reference

#include <genesis/utils/formats/json/document.hpp>

Inherits iterator< std::random_access_iterator_tag, U >.

Detailed Description

template<typename U>
class genesis::utils::JsonIterator< U >

Template for a random access iterator for the JsonDocument class.

This class implements a both iterators (iterator and const_iterator) for the JsonDocument class.

The class satisfies the following concept requirements: RandomAccessIterator. The iterator that can be moved to point (forward and backward) to any element in constant time.

Note
An iterator is called initialized when a pointer to a JSON value has been set (e.g., by a constructor or a copy assignment). If the iterator is default-constructed, it is uninitialized and most methods are undefined. We use assertions to detect calls on uninitialized iterators.

This class is a heavily altered adaption of the excellent JSON for Modern C++ library by Niels Lohmann, see also Acknowledgements.

Definition at line 88 of file json/document.hpp.

Public Member Functions

 JsonIterator ()=default
 
 JsonIterator (pointer object)
 Constructor for a given JSON instance. More...
 
 JsonIterator (const JsonIterator &other) noexcept
 Copy constructor. More...
 
JsonDocument::ObjectType::key_type key () const
 return the key of an object iterator More...
 
bool operator!= (const JsonIterator &other) const
 comparison: not equal More...
 
reference operator* () const
 Return a reference to the value pointed to by the iterator. More...
 
JsonIterator operator+ (difference_type i)
 add to iterator More...
 
JsonIterator operator++ (int)
 Post-increment (it++). More...
 
JsonIteratoroperator++ ()
 Pre-increment (++it). More...
 
JsonIteratoroperator+= (difference_type i)
 add to iterator More...
 
JsonIterator operator- (difference_type i)
 subtract from iterator More...
 
difference_type operator- (const JsonIterator &other) const
 return difference More...
 
JsonIterator operator-- (int)
 Post-decrement (it–). More...
 
JsonIteratoroperator-- ()
 pre-decrement (–it) More...
 
JsonIteratoroperator-= (difference_type i)
 subtract from iterator More...
 
pointer operator-> () const
 Dereference the Iterator. More...
 
bool operator< (const JsonIterator &other) const
 comparison: smaller More...
 
bool operator<= (const JsonIterator &other) const
 comparison: less than or equal More...
 
JsonIteratoroperator= (JsonIterator other) noexcept(std::is_nothrow_move_constructible< pointer >::value andstd::is_nothrow_move_assignable< pointer >::value andstd::is_nothrow_move_constructible< InternalIterator >::value andstd::is_nothrow_move_assignable< InternalIterator >::value)
 Copy assignment. More...
 
bool operator== (const JsonIterator &other) const
 comparison: equal More...
 
bool operator> (const JsonIterator &other) const
 comparison: greater than More...
 
bool operator>= (const JsonIterator &other) const
 comparison: greater than or equal More...
 
reference operator[] (difference_type n) const
 access to successor More...
 
reference value () const
 return the value of an iterator More...
 

Public Types

using difference_type = typename JsonDocument::difference_type
 
using iterator_category = std::bidirectional_iterator_tag
 
using pointer = typename std::conditional< std::is_const< U >::value, typename JsonDocument::const_pointer, typename JsonDocument::pointer >::type
 
using reference = typename std::conditional< std::is_const< U >::value, typename JsonDocument::const_reference, typename JsonDocument::reference >::type
 
using value_type = typename JsonDocument::value_type
 

Classes

struct  InternalIterator
 an iterator value More...
 
class  PrimitiveIterator
 an iterator for primitive JSON types More...
 

Friends

class JsonDocument
 

Constructor & Destructor Documentation

JsonIterator ( )
default
JsonIterator ( pointer  object)
inlineexplicit

Constructor for a given JSON instance.

Definition at line 239 of file iterator.hpp.

JsonIterator ( const JsonIterator< U > &  other)
inlinenoexcept

Copy constructor.

Definition at line 265 of file iterator.hpp.

Member Function Documentation

JsonDocument::ObjectType::key_type key ( ) const
inline

return the key of an object iterator

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 627 of file iterator.hpp.

bool operator!= ( const JsonIterator< U > &  other) const
inline

comparison: not equal

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 451 of file iterator.hpp.

reference operator* ( ) const
inline

Return a reference to the value pointed to by the iterator.

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 294 of file iterator.hpp.

JsonIterator operator+ ( difference_type  i)
inline

add to iterator

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 547 of file iterator.hpp.

JsonIterator operator++ ( int  )
inline

Post-increment (it++).

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 351 of file iterator.hpp.

JsonIterator& operator++ ( )
inline

Pre-increment (++it).

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 362 of file iterator.hpp.

JsonIterator& operator+= ( difference_type  i)
inline

add to iterator

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 513 of file iterator.hpp.

JsonIterator operator- ( difference_type  i)
inline

subtract from iterator

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 558 of file iterator.hpp.

difference_type operator- ( const JsonIterator< U > &  other) const
inline

return difference

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 569 of file iterator.hpp.

JsonIterator operator-- ( int  )
inline

Post-decrement (it–).

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 388 of file iterator.hpp.

JsonIterator& operator-- ( )
inline

pre-decrement (–it)

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 399 of file iterator.hpp.

JsonIterator& operator-= ( difference_type  i)
inline

subtract from iterator

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 538 of file iterator.hpp.

pointer operator-> ( ) const
inline

Dereference the Iterator.

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 324 of file iterator.hpp.

bool operator< ( const JsonIterator< U > &  other) const
inline

comparison: smaller

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 460 of file iterator.hpp.

bool operator<= ( const JsonIterator< U > &  other) const
inline

comparison: less than or equal

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 486 of file iterator.hpp.

JsonIterator& operator= ( JsonIterator< U >  other)
inlinenoexcept

Copy assignment.

Definition at line 273 of file iterator.hpp.

bool operator== ( const JsonIterator< U > &  other) const
inline

comparison: equal

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 425 of file iterator.hpp.

bool operator> ( const JsonIterator< U > &  other) const
inline

comparison: greater than

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 495 of file iterator.hpp.

bool operator>= ( const JsonIterator< U > &  other) const
inline

comparison: greater than or equal

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 504 of file iterator.hpp.

reference operator[] ( difference_type  n) const
inline

access to successor

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 592 of file iterator.hpp.

reference value ( ) const
inline

return the value of an iterator

Precondition
The iterator is initialized; i.e. object_ != nullptr.

Definition at line 642 of file iterator.hpp.

Friends And Related Function Documentation

friend class JsonDocument
friend

Definition at line 109 of file iterator.hpp.

Member Typedef Documentation

Definition at line 125 of file iterator.hpp.

using iterator_category = std::bidirectional_iterator_tag

Definition at line 136 of file iterator.hpp.

using pointer = typename std::conditional<std::is_const<U>::value, typename JsonDocument::const_pointer, typename JsonDocument::pointer >::type

Definition at line 130 of file iterator.hpp.

using reference = typename std::conditional<std::is_const<U>::value, typename JsonDocument::const_reference, typename JsonDocument::reference >::type

Definition at line 134 of file iterator.hpp.

Definition at line 124 of file iterator.hpp.


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