Qore Programming Language Reference Manual 2.0.0
|
This class defines a simple iterator to be used to iterate single values (or complex objects where no iterator has been implemented yet) More...
#include <QC_SingleValueIterator.dox.h>
Public Member Methods | |
constructor (auto v) | |
creates the single value iterator with the value passed as an argument | |
copy () | |
Creates a copy of the SingleValueIterator object, iterating the same object as the original and in the same position. | |
auto | getValue () |
returns the current value or throws an INVALID-ITERATOR exception if the iterator is invalid | |
bool | next () |
This method returns True and False alternately unless it has no value to iterate, in which case it returns only False. | |
reset () | |
Reset the iterator instance to its initial state. | |
bool | valid () |
returns True if the iterator is currently pointing at a valid element, False if not | |
Public Member Methods inherited from Qore::AbstractIterator | |
abstract auto | getValue () |
returns the current value | |
abstract bool | next () |
Moves the current position to the next element; returns False if there are no more elements. | |
abstract bool | valid () |
returns True if the iterator is currently pointing at a valid element, False if not | |
This class defines a simple iterator to be used to iterate single values (or complex objects where no iterator has been implemented yet)
Remember that input value is taken as a single token so result of the code above for a list as an input argument will be like this:
Qore::SingleValueIterator::constructor | ( | auto | v | ) |
creates the single value iterator with the value passed as an argument
v | the value to iterate |
Qore::SingleValueIterator::copy | ( | ) |
Creates a copy of the SingleValueIterator object, iterating the same object as the original and in the same position.
auto Qore::SingleValueIterator::getValue | ( | ) |
returns the current value or throws an INVALID-ITERATOR
exception if the iterator is invalid
INVALID-ITERATOR
exception if the iterator is invalidINVALID-ITERATOR | the iterator is not pointing at a valid element |
bool Qore::SingleValueIterator::next | ( | ) |
This method returns True and False alternately unless it has no value to iterate, in which case it returns only False.
The iterator object should not be used after this method returns False
ITERATOR-THREAD-ERROR | this exception is thrown if this method is called from any thread other than the thread that created the object |
Qore::SingleValueIterator::reset | ( | ) |
Reset the iterator instance to its initial state.
Reset the iterator instance to its initial state
ITERATOR-THREAD-ERROR | this exception is thrown if this method is called from any thread other than the thread that created the object |