cartobase  5.1.2
carto::IteratorInterface Class Referenceabstract

An iterator object is a reference to another object. More...

#include <cartobase/object/object.h>

Inheritance diagram for carto::IteratorInterface:
Collaboration diagram for carto::IteratorInterface:

Public Member Functions

virtual ~IteratorInterface ()
 
virtual bool isIterator () const
 Returns false if the stored object doesn't actually implement the IteratorInterface API (needed since all GenericObject inherit this interface whatever they actually contain) More...
 
virtual bool isValid () const =0
 true if the iterator points to a valid value, false when the end of the iterable container has been reached More...
 
virtual Object currentValue () const =0
 Access the value of the element pointed to by the iterator. More...
 
virtual void next ()=0
 Point to the next element of the iterable container. More...
 
- Public Member Functions inherited from carto::Interface
virtual ~Interface ()
 

Detailed Description

An iterator object is a reference to another object.

They are used to iterate on a container Iterable object (like a pointer in an array).

Example:

Object iterable = Object::value( vector<int>( 10 ) );
Object iterator = iterable->objectIterator();
while( iterator->isValid() )
{
Object value = iterator->currentValue();
cout << value->getScalar() << endl;
}
static Object value()
factory function: builds an Object by using the default constructor
Definition: object.h:1496

Definition at line 235 of file object.h.

Constructor & Destructor Documentation

◆ ~IteratorInterface()

virtual carto::IteratorInterface::~IteratorInterface ( )
virtual

Member Function Documentation

◆ currentValue()

virtual Object carto::IteratorInterface::currentValue ( ) const
pure virtual

Access the value of the element pointed to by the iterator.

Implemented in carto::PropertySet::iterator, and carto::TypedObject< T >.

◆ isIterator()

virtual bool carto::IteratorInterface::isIterator ( ) const
virtual

Returns false if the stored object doesn't actually implement the IteratorInterface API (needed since all GenericObject inherit this interface whatever they actually contain)

Reimplemented in carto::TypedObject< T >.

◆ isValid()

virtual bool carto::IteratorInterface::isValid ( ) const
pure virtual

true if the iterator points to a valid value, false when the end of the iterable container has been reached

Implemented in carto::PropertySet::iterator, and carto::TypedObject< T >.

◆ next()

virtual void carto::IteratorInterface::next ( )
pure virtual

Point to the next element of the iterable container.

Implemented in carto::PropertySet::iterator, and carto::TypedObject< T >.


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