Support Class Library
A set of tools providing classes and utility
Public Types | Public Member Functions | Protected Attributes | List of all members
scl::stream::details::iterator::StlAdapter< T > Class Template Reference

An adapter for STL-like iterators from stream iterators. More...

#include "StlAdapter.h"

Collaboration diagram for scl::stream::details::iterator::StlAdapter< T >:
Collaboration graph
[legend]

Public Types

using iterator_type = StreamIterator< T >
 The type of stream iterator handled. More...
 
using payload_type = typename iterator_type::payload_type
 The type of stream iterator payload. More...
 
using iterator_category = std::forward_iterator_tag
 The category of this iterator type. More...
 
using value_type = payload_type
 The type of value provided by the iterators. More...
 
using difference_type = std::ptrdiff_t
 The type of the difference in size between iterators. More...
 
using pointer = value_type *
 Pointer type for the value type. More...
 
using reference = value_type &
 Reference type for the value type. More...
 

Public Member Functions

 StlAdapter (iterator_type *sit=nullptr)
 Construct an adapter from an iterator. More...
 
 StlAdapter (iterator_type *sit, payload_type payload)
 Construt an adapter from an iterator and a specific payload. More...
 
StlAdapteroperator++ ()
 Pre-increment operator. More...
 
StlAdapter operator++ (int)
 Post-increment operator. More...
 
bool operator== (const StlAdapter &rhs) const
 Equality operator. More...
 
bool operator!= (const StlAdapter &rhs) const
 Difference operator. More...
 
payload_type operator* () const
 Dereference operator. More...
 

Protected Attributes

iterator_typeit
 A pointer to the iterator handled by this adapter. More...
 
payload_type payload
 The current payload. More...
 

Detailed Description

template<class T>
class scl::stream::details::iterator::StlAdapter< T >

An adapter for STL-like iterators from stream iterators.

Template Parameters
Tbeing the type of value handled

Definition at line 18 of file StlAdapter.h.

Member Typedef Documentation

◆ difference_type

The type of the difference in size between iterators.

Definition at line 49 of file StlAdapter.h.

◆ iterator_category

The category of this iterator type.

Definition at line 37 of file StlAdapter.h.

◆ iterator_type

The type of stream iterator handled.

Definition at line 24 of file StlAdapter.h.

◆ payload_type

The type of stream iterator payload.

Definition at line 30 of file StlAdapter.h.

◆ pointer

Pointer type for the value type.

Definition at line 55 of file StlAdapter.h.

◆ reference

Reference type for the value type.

Definition at line 61 of file StlAdapter.h.

◆ value_type

The type of value provided by the iterators.

Definition at line 43 of file StlAdapter.h.

Constructor & Destructor Documentation

◆ StlAdapter() [1/2]

template<class T >
scl::stream::details::iterator::StlAdapter< T >::StlAdapter ( iterator_type sit = nullptr)
inlineexplicit

Construct an adapter from an iterator.

Parameters
sitbeing the stream iterator to construct from (nullptr for end iterator)

Definition at line 84 of file StlAdapter.h.

◆ StlAdapter() [2/2]

template<class T >
scl::stream::details::iterator::StlAdapter< T >::StlAdapter ( iterator_type sit,
payload_type  payload 
)
inline

Construt an adapter from an iterator and a specific payload.

Parameters
sitbeing the stream iterator to construct from (nullptr for end iterator)
payloadbeing the initial payload

Definition at line 92 of file StlAdapter.h.

Member Function Documentation

◆ operator!=()

template<class T >
bool scl::stream::details::iterator::StlAdapter< T >::operator!= ( const StlAdapter< T > &  rhs) const
inline

Difference operator.

Parameters
rhsbeing the adapter to compare to
Returns
TRUE if different, FALSE otherwise
See also
scl::stream::details::iterator::StlAdapter::operator==

Definition at line 145 of file StlAdapter.h.

◆ operator*()

template<class T >
payload_type scl::stream::details::iterator::StlAdapter< T >::operator* ( ) const
inline

Dereference operator.

Returns
the current payload

Definition at line 154 of file StlAdapter.h.

◆ operator++() [1/2]

template<class T >
StlAdapter& scl::stream::details::iterator::StlAdapter< T >::operator++ ( )
inline

Pre-increment operator.

Returns
a reference to this adapter

Definition at line 100 of file StlAdapter.h.

◆ operator++() [2/2]

template<class T >
StlAdapter scl::stream::details::iterator::StlAdapter< T >::operator++ ( int  )
inline

Post-increment operator.

Returns
a copy of this adapter before increment

Definition at line 115 of file StlAdapter.h.

◆ operator==()

template<class T >
bool scl::stream::details::iterator::StlAdapter< T >::operator== ( const StlAdapter< T > &  rhs) const
inline

Equality operator.

Parameters
rhsbeing the adapter to compare to
Returns
TRUE if equal, FALSE otherwise
Warning
adapters are considered equal only if they both have no value (i.e. they are both the end iterator)

Definition at line 129 of file StlAdapter.h.

Member Data Documentation

◆ it

template<class T >
scl::stream::details::iterator::StlAdapter< T >::it
protected

A pointer to the iterator handled by this adapter.

Warning
this does not manage its lifetime, the pointer must outlive the adapter

Definition at line 71 of file StlAdapter.h.

◆ payload

template<class T >
scl::stream::details::iterator::StlAdapter< T >::payload
protected

The current payload.

Definition at line 77 of file StlAdapter.h.


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