Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::IteratorRange Class Reference

Iterator is an range that references a location in another range. More...

#include <kanzi/core.ui/binding/iterator_range.hpp>

Inheritance diagram for kanzi::IteratorRange:
[legend]

Classes

class  IteratorRangeLocation
 Location implementation for iterator range. More...
 

Public Types

using const_iterator = vector< Variant >::const_iterator
 Const iterator type for values. More...
 
using iterator = vector< Variant >::iterator
 Iterator type for values. More...
 

Public Member Functions

void adapt (AbstractRange &range)
 Adapt another range. More...
 
PropertyObjectSharedPtr getPropertyObject ()
 Gets a property object from the current iterator location. More...
 
bool getPropertyValue (AbstractPropertyType propertyType, Variant &value)
 Gets a property value from the property object at current location. More...
 
bool getValue (Variant &value)
 Gets the value at current location. More...
 
- Public Member Functions inherited from kanzi::AbstractIndexedRange
PropertyObjectSharedPtr getPropertyObjectByIndex (size_t index)
 Gets a property object by index. More...
 
bool getPropertyValueByIndex (size_t index, AbstractPropertyType propertyType, Variant &value)
 Access a property in a property object at an index. More...
 
size_t getSize ()
 Gets the size of the indexed range. More...
 
bool getValueByIndex (size_t index, Variant &value)
 Reads a value by index and writes it to a variant. More...
 
- Public Member Functions inherited from kanzi::AbstractRange
AbstractRangeIterator beginIteration ()
 Gets an iterator to the beginning of this range. More...
 
AbstractRangeSharedPtr createView (size_t length)
 Creates a view over this range. More...
 
AbstractRangeSharedPtr evaluate ()
 Evaluate the abstract range. More...
 
AbstractRangeLocationPtr locationBegin ()
 Gets an iteratable location to beginning of the range. More...
 
virtual ~AbstractRange ()=default
 Destructor. More...
 

Static Public Member Functions

static IteratorRangeSharedPtr create (AbstractRangeSharedPtr sourceRange)
 Creates a new iterator range. More...
 
static IteratorRangeSharedPtr create (const AbstractRangeIterator &sourceIterator)
 Creates a new iterator range. More...
 
static IteratorRangeSharedPtr create (AbstractRangeIterator &&sourceIterator)
 Creates a new iterator range. More...
 

Protected Member Functions

AbstractRangeSharedPtr evaluateOverride () override
 AbstractRange::evaluateOverride() implementation. More...
 
PropertyObjectSharedPtr getPropertyObjectByIndexOverride (size_t index) override
 AbstractIndexedRange::getPropertyObjectByIndexOverride() implementation. More...
 
bool getPropertyValueByIndexOverride (size_t index, AbstractPropertyType propertyType, Variant &value) override
 AbstractIndexedRange::getPropertyValueByIndexOverride() implementation. More...
 
size_t getSizeOverride () override
 AbstractIndexedRange::getSizeOverride() implementation. More...
 
bool getValueByIndexOverride (size_t index, Variant &value) override
 AbstractIndexedRange::getValueByIndexeOverride() implementation. More...
 
 IteratorRange (const AbstractRangeIterator &sourceIterator)
 Constructor. More...
 
 IteratorRange (AbstractRangeIterator &&sourceIterator)
 Constructor. More...
 
AbstractRangeLocationPtr locationBeginOverride () override
 AbstractRange::locationBeginOverride() implementation. More...
 
- Protected Member Functions inherited from kanzi::AbstractIndexedRange
AbstractRangeSharedPtr createViewOverride (size_t length) override
 AbstractRange::createViewOverride() implementation. More...
 
- Protected Member Functions inherited from kanzi::AbstractRange
 AbstractRange ()=default
 Constructor. More...
 

Protected Attributes

AbstractRangeIterator m_iter
 Iterator into a source range. More...
 
AbstractRangeSharedPtr m_sourceRangeReference
 Reference to the source range. More...
 

Detailed Description

Iterator is an range that references a location in another range.

Iterator range combines a weak reference to another range and an iterator to that range. There is only one readable value, which is the current iteration location.

Evaluating the iterator range yields a new iterator range that advances the iterator one step. If the iteration has already reached the end of the source range, the evaluation returns a shared pointer to the same range (the same as default result of range evaluation).

Since
Kanzi 3.9.0

Member Typedef Documentation

◆ iterator

Iterator type for values.

◆ const_iterator

Const iterator type for values.

Constructor & Destructor Documentation

◆ IteratorRange() [1/2]

kanzi::IteratorRange::IteratorRange ( const AbstractRangeIterator sourceIterator)
explicitprotected

Constructor.

Parameters
sourceIteratorIterator to another range.

◆ IteratorRange() [2/2]

kanzi::IteratorRange::IteratorRange ( AbstractRangeIterator &&  sourceIterator)
explicitprotected

Constructor.

Parameters
sourceIteratorIterator to another range.

Member Function Documentation

◆ create() [1/3]

static IteratorRangeSharedPtr kanzi::IteratorRange::create ( AbstractRangeSharedPtr  sourceRange)
static

Creates a new iterator range.

Parameters
sourceRangeRange to iterate.
Returns
Iterator range shared pointer.

◆ create() [2/3]

static IteratorRangeSharedPtr kanzi::IteratorRange::create ( const AbstractRangeIterator sourceIterator)
static

Creates a new iterator range.

Parameters
sourceIteratorSource iterator to advance.
Returns
Iterator range shared pointer.

◆ create() [3/3]

static IteratorRangeSharedPtr kanzi::IteratorRange::create ( AbstractRangeIterator &&  sourceIterator)
static

Creates a new iterator range.

Parameters
sourceIteratorSource iterator to advance.
Returns
Iterator range shared pointer.

◆ getPropertyObject()

PropertyObjectSharedPtr kanzi::IteratorRange::getPropertyObject ( )
inline

Gets a property object from the current iterator location.

Returns
Property object at current location or nullptr

◆ getPropertyValue()

bool kanzi::IteratorRange::getPropertyValue ( AbstractPropertyType  propertyType,
Variant value 
)
inline

Gets a property value from the property object at current location.

Parameters
propertyTypeProperty type to acquire.
valueVariant to store the value into.
Returns
If a property value was extracted, true, otherwise false.

◆ getValue()

bool kanzi::IteratorRange::getValue ( Variant value)
inline

Gets the value at current location.

Parameters
valueVariant to store the value into.
Returns
If a value was extracted, true, otherwise false.

◆ adapt()

void kanzi::IteratorRange::adapt ( AbstractRange range)
inline

Adapt another range.

This function is used internally by Kanzi to reuse an IteratorRange as opposed to creating a new one.

Parameters
rangeRange to adapt.

◆ evaluateOverride()

AbstractRangeSharedPtr kanzi::IteratorRange::evaluateOverride ( )
overrideprotectedvirtual

AbstractRange::evaluateOverride() implementation.

Reimplemented from kanzi::AbstractRange.

Reimplemented in kanzi::ImmutableIteratorRange.

◆ locationBeginOverride()

AbstractRangeLocationPtr kanzi::IteratorRange::locationBeginOverride ( )
overrideprotectedvirtual

◆ getSizeOverride()

size_t kanzi::IteratorRange::getSizeOverride ( )
overrideprotectedvirtual

◆ getPropertyObjectByIndexOverride()

PropertyObjectSharedPtr kanzi::IteratorRange::getPropertyObjectByIndexOverride ( size_t  index)
overrideprotectedvirtual

◆ getPropertyValueByIndexOverride()

bool kanzi::IteratorRange::getPropertyValueByIndexOverride ( size_t  index,
AbstractPropertyType  propertyType,
Variant value 
)
overrideprotectedvirtual

◆ getValueByIndexOverride()

bool kanzi::IteratorRange::getValueByIndexOverride ( size_t  index,
Variant value 
)
overrideprotectedvirtual

AbstractIndexedRange::getValueByIndexeOverride() implementation.

Implements kanzi::AbstractIndexedRange.

Member Data Documentation

◆ m_iter

AbstractRangeIterator kanzi::IteratorRange::m_iter
protected

Iterator into a source range.

◆ m_sourceRangeReference

AbstractRangeSharedPtr kanzi::IteratorRange::m_sourceRangeReference
protected

Reference to the source range.

AbstractRangeIterator does not hold a reference to the source range, so it falls to the IteratorRange.


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