OGS
BaseLib::ConfigTree::ValueIterator< ValueType > Class Template Reference

Detailed Description

template<typename ValueType>
class BaseLib::ConfigTree::ValueIterator< ValueType >

A wrapper around a Boost Iterator for iterating over ranges of values.

The methods of this class tell the associated (parent) ConfigTree object when a setting has been parsed.

Definition at line 198 of file ConfigTree.h.

#include <ConfigTree.h>

Collaboration diagram for BaseLib::ConfigTree::ValueIterator< ValueType >:
[legend]

Public Types

using iterator_category = std::input_iterator_tag
 
using value_type = ConfigTree
 
using difference_type = std::ptrdiff_t
 
using pointer = ConfigTree *
 
using reference = ConfigTree &
 
using Iterator = boost::property_tree::ptree::const_assoc_iterator
 

Public Member Functions

 ValueIterator (Iterator const &it, std::string const &root, ConfigTree const &parent)
 
ValueIterator< ValueType > & operator++ ()
 
ValueType operator* ()
 
bool operator== (ValueIterator< ValueType > const &other) const
 
bool operator!= (ValueIterator< ValueType > const &other) const
 

Private Attributes

bool has_incremented_ = true
 
Iterator it_
 
std::string const tagname_
 
ConfigTree const & parent_
 

Member Typedef Documentation

◆ difference_type

template<typename ValueType >
using BaseLib::ConfigTree::ValueIterator< ValueType >::difference_type = std::ptrdiff_t

Definition at line 203 of file ConfigTree.h.

◆ Iterator

template<typename ValueType >
using BaseLib::ConfigTree::ValueIterator< ValueType >::Iterator = boost::property_tree::ptree::const_assoc_iterator

Definition at line 207 of file ConfigTree.h.

◆ iterator_category

template<typename ValueType >
using BaseLib::ConfigTree::ValueIterator< ValueType >::iterator_category = std::input_iterator_tag

Definition at line 201 of file ConfigTree.h.

◆ pointer

template<typename ValueType >
using BaseLib::ConfigTree::ValueIterator< ValueType >::pointer = ConfigTree*

Definition at line 204 of file ConfigTree.h.

◆ reference

template<typename ValueType >
using BaseLib::ConfigTree::ValueIterator< ValueType >::reference = ConfigTree&

Definition at line 205 of file ConfigTree.h.

◆ value_type

template<typename ValueType >
using BaseLib::ConfigTree::ValueIterator< ValueType >::value_type = ConfigTree

Definition at line 202 of file ConfigTree.h.

Constructor & Destructor Documentation

◆ ValueIterator()

template<typename ValueType >
BaseLib::ConfigTree::ValueIterator< ValueType >::ValueIterator ( Iterator const &  it,
std::string const &  root,
ConfigTree const &  parent 
)
inlineexplicit

Definition at line 209 of file ConfigTree.h.

211 : it_(it), tagname_(root), parent_(parent)
212 {
213 }

Member Function Documentation

◆ operator!=()

template<typename ValueType >
bool BaseLib::ConfigTree::ValueIterator< ValueType >::operator!= ( ValueIterator< ValueType > const &  other) const
inline

Definition at line 240 of file ConfigTree.h.

241 {
242 return it_ != other.it_;
243 }

References BaseLib::ConfigTree::ValueIterator< ValueType >::it_.

◆ operator*()

template<typename ValueType >
ValueType BaseLib::ConfigTree::ValueIterator< ValueType >::operator* ( )
inline

Definition at line 222 of file ConfigTree.h.

223 {
224 // if this iterator has been incremented since the last dereference,
225 // tell the parent_ instance that a setting now has been parsed.
227 {
228 has_incremented_ = false;
229 parent_.markVisited<ValueType>(tagname_, Attr::TAG, false);
230 }
231 return ConfigTree(it_->second, parent_, tagname_)
232 .getValue<ValueType>();
233 }
CountType & markVisited(std::string const &key, Attr const is_attr, bool peek_only) const

References BaseLib::ConfigTree::getValue(), BaseLib::ConfigTree::ValueIterator< ValueType >::has_incremented_, BaseLib::ConfigTree::ValueIterator< ValueType >::it_, BaseLib::ConfigTree::markVisited(), BaseLib::ConfigTree::ValueIterator< ValueType >::parent_, BaseLib::ConfigTree::TAG, and BaseLib::ConfigTree::ValueIterator< ValueType >::tagname_.

◆ operator++()

template<typename ValueType >
ValueIterator< ValueType > & BaseLib::ConfigTree::ValueIterator< ValueType >::operator++ ( )
inline

Definition at line 215 of file ConfigTree.h.

216 {
217 ++it_;
218 has_incremented_ = true;
219 return *this;
220 }

References BaseLib::ConfigTree::ValueIterator< ValueType >::has_incremented_, and BaseLib::ConfigTree::ValueIterator< ValueType >::it_.

◆ operator==()

template<typename ValueType >
bool BaseLib::ConfigTree::ValueIterator< ValueType >::operator== ( ValueIterator< ValueType > const &  other) const
inline

Definition at line 235 of file ConfigTree.h.

236 {
237 return it_ == other.it_;
238 }

References BaseLib::ConfigTree::ValueIterator< ValueType >::it_.

Member Data Documentation

◆ has_incremented_

template<typename ValueType >
bool BaseLib::ConfigTree::ValueIterator< ValueType >::has_incremented_ = true
private

◆ it_

◆ parent_

template<typename ValueType >
ConfigTree const& BaseLib::ConfigTree::ValueIterator< ValueType >::parent_
private

◆ tagname_

template<typename ValueType >
std::string const BaseLib::ConfigTree::ValueIterator< ValueType >::tagname_
private

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