\doxysection{Qore\+::Abstract\+Iterator Class Reference}
\hypertarget{class_qore_1_1_abstract_iterator}{}\label{class_qore_1_1_abstract_iterator}\index{Qore::AbstractIterator@{Qore::AbstractIterator}}


This class defines an abstract interface for iterators.  




{\ttfamily \#include $<$QC\+\_\+\+Abstract\+Iterator.\+dox.\+h$>$}



Inheritance diagram for Qore\+::Abstract\+Iterator\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{class_qore_1_1_abstract_iterator__inherit__graph}
\end{center}
\end{figure}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{auto}} \mbox{\hyperlink{class_qore_1_1_abstract_iterator_aa01374b285003faa21b045082063ac12}{get\+Value}} ()
\begin{DoxyCompactList}\small\item\em returns the current value \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_abstract_iterator_ab10d5694cc2fcd3b6689ea7494da79de}{next}} ()
\begin{DoxyCompactList}\small\item\em Moves the current position to the next element; returns \doxysectlink{basic_data_types_False}{False}{2} if there are no more elements. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_abstract_iterator_aee1def5d872b487b8917a166d9b263e8}{valid}} ()
\begin{DoxyCompactList}\small\item\em returns \doxysectlink{basic_data_types_True}{True}{2} if the iterator is currently pointing at a valid element, \doxysectlink{basic_data_types_False}{False}{2} if not \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This class defines an abstract interface for iterators. 

Classes inheriting this class can be used to iterate abstract or complex objects with \doxysectlink{statements_while}{while Statements}{1} (using \doxylink{class_qore_1_1_abstract_iterator_ab10d5694cc2fcd3b6689ea7494da79de}{Abstract\+Iterator\+::next()}) or directly in the following language constructs\+:
\begin{DoxyItemize}
\item \doxysectlink{operators_map}{Map Operator (map)}{2}
\item \doxysectlink{operators_foldr}{Fold Right Operator (foldr)}{2} and \doxysectlink{operators_foldl}{Fold Left Operator (foldl)}{2}
\item \doxysectlink{operators_select}{Select From List Operator (select)}{2}
\item \doxysectlink{statements_foreach}{foreach Statements}{1} 
\end{DoxyItemize}

\doxysubsection{Member Function Documentation}
\Hypertarget{class_qore_1_1_abstract_iterator_aa01374b285003faa21b045082063ac12}\label{class_qore_1_1_abstract_iterator_aa01374b285003faa21b045082063ac12} 
\index{Qore::AbstractIterator@{Qore::AbstractIterator}!getValue@{getValue}}
\index{getValue@{getValue}!Qore::AbstractIterator@{Qore::AbstractIterator}}
\doxysubsubsection{\texorpdfstring{getValue()}{getValue()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{auto}} Qore\+::\+Abstract\+Iterator\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the current value 

\begin{DoxyReturn}{Returns}
the current value
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while}\ (i.next())\ \{}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}+\ \%y\(\backslash\)n"{}},\ i.getValue());}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\doxylink{class_qore_1_1_abstract_iterator_aee1def5d872b487b8917a166d9b263e8}{Abstract\+Iterator\+::valid()} 
\end{DoxySeeAlso}
\Hypertarget{class_qore_1_1_abstract_iterator_ab10d5694cc2fcd3b6689ea7494da79de}\label{class_qore_1_1_abstract_iterator_ab10d5694cc2fcd3b6689ea7494da79de} 
\index{Qore::AbstractIterator@{Qore::AbstractIterator}!next@{next}}
\index{next@{next}!Qore::AbstractIterator@{Qore::AbstractIterator}}
\doxysubsubsection{\texorpdfstring{next()}{next()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+Abstract\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Moves the current position to the next element; returns \doxysectlink{basic_data_types_False}{False}{2} if there are no more elements. 

This method will return \doxysectlink{basic_data_types_True}{True}{2} again after it returns \doxysectlink{basic_data_types_False}{False}{2} once if the object being iterated is not empty, otherwise it will always return \doxysectlink{basic_data_types_False}{False}{2}. The iterator object should not be used after this method returns \doxysectlink{basic_data_types_False}{False}{2}

\begin{DoxyReturn}{Returns}
\doxysectlink{basic_data_types_False}{False}{2} if there are no more elements (in which case the iterator object is invalid and should not be used); \doxysectlink{basic_data_types_True}{True}{2} if successful (meaning that the iterator object is valid)
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while}\ (i.next())\ \{}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}\ +\ \%y\(\backslash\)n"{}},\ i.getValue());}
\DoxyCodeLine{\}}

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_abstract_iterator_aee1def5d872b487b8917a166d9b263e8}\label{class_qore_1_1_abstract_iterator_aee1def5d872b487b8917a166d9b263e8} 
\index{Qore::AbstractIterator@{Qore::AbstractIterator}!valid@{valid}}
\index{valid@{valid}!Qore::AbstractIterator@{Qore::AbstractIterator}}
\doxysubsubsection{\texorpdfstring{valid()}{valid()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+Abstract\+Iterator\+::valid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns \doxysectlink{basic_data_types_True}{True}{2} if the iterator is currently pointing at a valid element, \doxysectlink{basic_data_types_False}{False}{2} if not 

\begin{DoxyReturn}{Returns}
\doxysectlink{basic_data_types_True}{True}{2} if the iterator is currently pointing at a valid element, \doxysectlink{basic_data_types_False}{False}{2} if not
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if}\ (i.valid())}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}current\ value:\ \%y\(\backslash\)n"{}},\ i.getValue());}

\end{DoxyCode}
 
\end{DoxyParagraph}
