Qore Programming Language
0.9.0
|
For use on the stack only: iterates through a the elements of a QoreListNode. More...
#include <QoreListNode.h>
Public Member Methods | |
DLLEXPORT | ListIterator (QoreListNode *lst, size_t n_pos=-1) |
initializes the iterator to the position given or, if omitted, just before the first element More... | |
DLLEXPORT | ListIterator (QoreListNode &lst, size_t n_pos=-1) |
initializes the iterator to the position given or, if omitted, just before the first element More... | |
DLLLOCAL bool | empty () const |
returns true if the list is empty | |
DLLEXPORT bool | first () const |
returns true when the iterator is pointing to the first element in the list | |
DLLLOCAL QoreListNode * | getList () |
returns the list | |
DLLEXPORT QoreValue | getReferencedValue () const |
returns the referenced value of the list element More... | |
DLLEXPORT QoreValue | getValue () const |
returns a pointer to the value of the list element More... | |
DLLLOCAL size_t | index () const |
returns the current iterator position in the list or -1 if not pointing at a valid element | |
DLLEXPORT bool | last () const |
returns true when the iterator is pointing to the last element in the list | |
DLLLOCAL size_t | max () const |
returns the number of elements in the list | |
DLLEXPORT bool | next () |
moves the iterator to the next element, returns true if the iterator is pointing to an element of the list More... | |
DLLEXPORT bool | prev () |
moves the iterator to the previous element, returns true if the iterator is pointing to an element of the list More... | |
DLLEXPORT int | set (size_t n_pos) |
sets the iterator to a specific position in the list More... | |
DLLLOCAL bool | valid () const |
returns true if the iterator is pointing to a valid element | |
Private Member Methods | |
DLLLOCAL void * | operator new (size_t) |
this function is not implemented; it is here as a private function in order to prohibit it from being used | |
For use on the stack only: iterates through a the elements of a QoreListNode.
DLLEXPORT ListIterator::ListIterator | ( | QoreListNode * | lst, |
size_t | n_pos = -1 |
||
) |
DLLEXPORT ListIterator::ListIterator | ( | QoreListNode & | lst, |
size_t | n_pos = -1 |
||
) |
DLLEXPORT QoreValue ListIterator::getReferencedValue | ( | ) | const |
returns the referenced value of the list element
DLLEXPORT QoreValue ListIterator::getValue | ( | ) | const |
returns a pointer to the value of the list element
DLLEXPORT bool ListIterator::next | ( | ) |
moves the iterator to the next element, returns true if the iterator is pointing to an element of the list
if the iterator is on the last element, it moves to an invalid position before the first element and returns false note that a subsequent call to next() after it returns false will move the iterator to the first element again (assuming there is at least one element in the list)
DLLEXPORT bool ListIterator::prev | ( | ) |
moves the iterator to the previous element, returns true if the iterator is pointing to an element of the list
if the iterator is on the first element, it moves to an invalid position before the first element and returns false note that a subsequent call to prev() after it returns false will move the iterator to the last element again (assuming there is at least one element in the list)
DLLEXPORT int ListIterator::set | ( | size_t | n_pos | ) |
sets the iterator to a specific position in the list
In the case an invalid position is given (element not present in the list), the iterator will not be pointing to a valid element in the list
n_pos | the position in the list to set (first element is position 0) |