\doxysection{Qore\+::List\+Iterator Class Reference}
\hypertarget{class_qore_1_1_list_iterator}{}\label{class_qore_1_1_list_iterator}\index{Qore::ListIterator@{Qore::ListIterator}}


This class an iterator class for lists.  




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



Inheritance diagram for Qore\+::List\+Iterator\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{class_qore_1_1_list_iterator__inherit__graph}
\end{center}
\end{figure}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_list_iterator_ac972b8fe8ce44162e0ce66643eee1a55}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{softlist}}$<$ \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{auto}} $>$ \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{l}})
\begin{DoxyCompactList}\small\item\em Creates the list iterator object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_list_iterator_aa3cbb3687629780c170afdeb81d4c32a}{copy}} ()
\begin{DoxyCompactList}\small\item\em Creates a copy of the \doxylink{class_qore_1_1_list_iterator}{List\+Iterator} object, iterating the same object as the original and in the same position. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a6b122999ed1d5270b799d08389d6a4b8}{empty}} ()
\begin{DoxyCompactList}\small\item\em returns \doxysectlink{basic_data_types_True}{True}{2} if the list is empty; \doxysectlink{basic_data_types_False}{False}{2} if not \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a93b82a5f331015eacbc41114005af1c0}{first}} ()
\begin{DoxyCompactList}\small\item\em returns \doxysectlink{basic_data_types_True}{True}{2} if on the first element of the list \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{auto}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a0aa20310feee37f5816721c79fed2b9e}{get\+Value}} ()
\begin{DoxyCompactList}\small\item\em returns the current value or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a60f50a3f482803ef6f8b7488a27edf4e}{index}} ()
\begin{DoxyCompactList}\small\item\em returns the current iterator position in the list or -\/1 if not pointing at a valid element \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_list_iterator_ab42d03f4202ae21cbf50732c93a206c2}{last}} ()
\begin{DoxyCompactList}\small\item\em returns \doxysectlink{basic_data_types_True}{True}{2} if on the last element of the list \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a61f6434a2697fa752a5a8bdf8bc4c5bd}{max}} ()
\begin{DoxyCompactList}\small\item\em returns the number of elements in the list \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16}{next}} ()
\begin{DoxyCompactList}\small\item\em Moves the current position to the next element in the list; returns \doxysectlink{basic_data_types_False}{False}{2} if there are no more elements; if the iterator is not pointing at a valid element before this call, the iterator will be positioned on the first element in the list if the list is not empty. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a32ad9cb8256759fdf8ac4dd3af183222}{prev}} ()
\begin{DoxyCompactList}\small\item\em Moves the current position to the previous element in the list; returns \doxysectlink{basic_data_types_False}{False}{2} if there are no more elements; if the iterator is not pointing at a valid element before this call, the iterator will be positioned on the last element in the list if the list is not empty. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_list_iterator_a66980079141ffb2814c5e34f8b728a4f}{reset}} ()
\begin{DoxyCompactList}\small\item\em Reset the iterator instance to its initial state. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_list_iterator_a24f641c512ab95856379c3e7609bda57}{set}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{pos}})
\begin{DoxyCompactList}\small\item\em sets the new position in the list; if the position is invalid then the method returns \doxysectlink{basic_data_types_False}{False}{2}, meaning the iterator is not valid, otherwise it returns \doxysectlink{basic_data_types_True}{True}{2} \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_list_iterator_ad880f2e3e193c708b28d753ae6646bfb}{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*{Public Member Functions inherited from \mbox{\hyperlink{class_qore_1_1_abstract_bidirectional_iterator}{Qore\+::\+Abstract\+Bidirectional\+Iterator}}}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_abstract_bidirectional_iterator_a8ca43ac8bffc78178f61e3cca9b6323e}{prev}} ()
\begin{DoxyCompactList}\small\item\em Moves the current position to the previous element; returns \doxysectlink{basic_data_types_False}{False}{2} if there are no more elements. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \mbox{\hyperlink{class_qore_1_1_abstract_iterator}{Qore\+::\+Abstract\+Iterator}}}
\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*{Public Member Functions inherited from \mbox{\hyperlink{class_qore_1_1_abstract_quantified_iterator}{Qore\+::\+Abstract\+Quantified\+Iterator}}}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{abstract}} \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} \mbox{\hyperlink{class_qore_1_1_abstract_quantified_iterator_aa859f2f4a719f955b100cde8b65b3277}{empty}} ()
\begin{DoxyCompactList}\small\item\em returns \doxysectlink{basic_data_types_True}{True}{2} if the object to iterate is empty; \doxysectlink{basic_data_types_False}{False}{2} if not \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_quantified_iterator_a4264e42010fa08a8099692e2876c3241}{first}} ()
\begin{DoxyCompactList}\small\item\em returns \doxysectlink{basic_data_types_True}{True}{2} if on the first element \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_quantified_iterator_aa7bef0cd843ced4319fd5f0d7647ef8e}{last}} ()
\begin{DoxyCompactList}\small\item\em returns \doxysectlink{basic_data_types_True}{True}{2} if on the last element \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This class an iterator class for lists. 

Call \doxylink{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16}{List\+Iterator\+::next()} to iterate through the list; do not use the iterator if \doxylink{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16}{List\+Iterator\+::next()} returns \doxysectlink{basic_data_types_False}{False}{2}. A list can be iterated in reverse order by calling \doxylink{class_qore_1_1_list_iterator_a32ad9cb8256759fdf8ac4dd3af183222}{List\+Iterator\+::prev()} instead of \doxylink{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16}{List\+Iterator\+::next()}

\begin{DoxyParagraph}{Example\+: List\+Iterator basic usage}

\begin{DoxyCode}{0}
\DoxyCodeLine{list\ data\ =\ (1,\ \textcolor{stringliteral}{"{}foo"{}},\ 2);}
\DoxyCodeLine{ListIterator\ it(data);}
\DoxyCodeLine{\textcolor{keywordflow}{while}\ (it.next())\ \{}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}iter:\ \%n\(\backslash\)n"{}},\ it.getValue());}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{iter:\ 1}
\DoxyCodeLine{iter:\ \textcolor{stringliteral}{"{}foo"{}}}
\DoxyCodeLine{iter:\ 2}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item In general, the \doxylink{class_qore_1_1_list_iterator}{List\+Iterator} class is not designed to be accessed from multiple threads; it was created without locking for fast and efficient use when used from a single thread. For methods that would be unsafe to use in another thread, any use of such methods in threads other than the thread where the constructor was called will cause an {\ttfamily ITERATOR-\/\+THREAD-\/\+ERROR} to be thrown.
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\doxylink{class_qore_1_1_list_reverse_iterator}{List\+Reverse\+Iterator} 
\end{DoxySeeAlso}


\doxysubsection{Member Function Documentation}
\Hypertarget{class_qore_1_1_list_iterator_ac972b8fe8ce44162e0ce66643eee1a55}\label{class_qore_1_1_list_iterator_ac972b8fe8ce44162e0ce66643eee1a55} 
\index{Qore::ListIterator@{Qore::ListIterator}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+List\+Iterator\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{softlist}}$<$ \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{auto}} $>$}]{l }\end{DoxyParamCaption})}



Creates the list iterator object. 


\begin{DoxyParams}{Parameters}
{\em l} & the list to iterate\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ListIterator\ li(l);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
the constructor\textquotesingle{}s argument is \doxysectlink{data_type_declarations_softlist_type}{softlist}{1} so that it can also accept \doxysectlink{basic_data_types_nothing}{NOTHING}{1} 
\end{DoxyNote}
\Hypertarget{class_qore_1_1_list_iterator_aa3cbb3687629780c170afdeb81d4c32a}\label{class_qore_1_1_list_iterator_aa3cbb3687629780c170afdeb81d4c32a} 
\index{Qore::ListIterator@{Qore::ListIterator}!copy@{copy}}
\index{copy@{copy}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+List\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Creates a copy of the \doxylink{class_qore_1_1_list_iterator}{List\+Iterator} object, iterating the same object as the original and in the same position. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{ListIterator\ ni\ =\ i.copy();}

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_list_iterator_a6b122999ed1d5270b799d08389d6a4b8}\label{class_qore_1_1_list_iterator_a6b122999ed1d5270b799d08389d6a4b8} 
\index{Qore::ListIterator@{Qore::ListIterator}!empty@{empty}}
\index{empty@{empty}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{empty()}{empty()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+List\+Iterator\+::empty (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns \doxysectlink{basic_data_types_True}{True}{2} if the list is empty; \doxysectlink{basic_data_types_False}{False}{2} if not 

\begin{DoxyReturn}{Returns}
\doxysectlink{basic_data_types_True}{True}{2} if the list is empty; \doxysectlink{basic_data_types_False}{False}{2} if not
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\doxysectlink{code_flags_CONSTANT}{CONSTANT}{1}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if}\ (i.empty())}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}the\ list\ is\ empty\(\backslash\)n"{}});}

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_list_iterator_a93b82a5f331015eacbc41114005af1c0}\label{class_qore_1_1_list_iterator_a93b82a5f331015eacbc41114005af1c0} 
\index{Qore::ListIterator@{Qore::ListIterator}!first@{first}}
\index{first@{first}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{first()}{first()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+List\+Iterator\+::first (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns \doxysectlink{basic_data_types_True}{True}{2} if on the first element of the list 

\begin{DoxyReturn}{Returns}
\doxysectlink{basic_data_types_True}{True}{2} if on the first element of the list
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\doxysectlink{code_flags_CONSTANT}{CONSTANT}{1}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while}\ (i.next())\ \{}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}\ (i.first())}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}START:\(\backslash\)n"{}});}
\DoxyCodeLine{\}}

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_list_iterator_a0aa20310feee37f5816721c79fed2b9e}\label{class_qore_1_1_list_iterator_a0aa20310feee37f5816721c79fed2b9e} 
\index{Qore::ListIterator@{Qore::ListIterator}!getValue@{getValue}}
\index{getValue@{getValue}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{getValue()}{getValue()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{auto}} Qore\+::\+List\+Iterator\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the current value or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid 

\begin{DoxyReturn}{Returns}
the current value or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\doxysectlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}{1}
\end{DoxyParagraph}
\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
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\Hypertarget{class_qore_1_1_list_iterator_a60f50a3f482803ef6f8b7488a27edf4e}\label{class_qore_1_1_list_iterator_a60f50a3f482803ef6f8b7488a27edf4e} 
\index{Qore::ListIterator@{Qore::ListIterator}!index@{index}}
\index{index@{index}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{index()}{index()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+List\+Iterator\+::index (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the current iterator position in the list or -\/1 if not pointing at a valid element 

\begin{DoxyReturn}{Returns}
the current iterator position in the list or -\/1 if not pointing at a valid element
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\doxysectlink{code_flags_CONSTANT}{CONSTANT}{1}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_list_iterator_ab42d03f4202ae21cbf50732c93a206c2}\label{class_qore_1_1_list_iterator_ab42d03f4202ae21cbf50732c93a206c2} 
\index{Qore::ListIterator@{Qore::ListIterator}!last@{last}}
\index{last@{last}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{last()}{last()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+List\+Iterator\+::last (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns \doxysectlink{basic_data_types_True}{True}{2} if on the last element of the list 

\begin{DoxyReturn}{Returns}
\doxysectlink{basic_data_types_True}{True}{2} if on the last element of the list
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\doxysectlink{code_flags_CONSTANT}{CONSTANT}{1}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while}\ (i.next())\ \{}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}\ (i.last())}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}END.\(\backslash\)n"{}});}
\DoxyCodeLine{\}}

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_list_iterator_a61f6434a2697fa752a5a8bdf8bc4c5bd}\label{class_qore_1_1_list_iterator_a61f6434a2697fa752a5a8bdf8bc4c5bd} 
\index{Qore::ListIterator@{Qore::ListIterator}!max@{max}}
\index{max@{max}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{max()}{max()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+List\+Iterator\+::max (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the number of elements in the list 

\begin{DoxyReturn}{Returns}
the number of elements in the list
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\doxysectlink{code_flags_CONSTANT}{CONSTANT}{1}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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

\end{DoxyCode}
 
\end{DoxyParagraph}
\Hypertarget{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16}\label{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16} 
\index{Qore::ListIterator@{Qore::ListIterator}!next@{next}}
\index{next@{next}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{next()}{next()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+List\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Moves the current position to the next element in the list; returns \doxysectlink{basic_data_types_False}{False}{2} if there are no more elements; if the iterator is not pointing at a valid element before this call, the iterator will be positioned on the first element in the list if the list is not empty. 

This method will return \doxysectlink{basic_data_types_True}{True}{2} again after it returns \doxysectlink{basic_data_types_False}{False}{2} once if list 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 the list (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}

\begin{DoxyExceptions}{Exceptions}
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\Hypertarget{class_qore_1_1_list_iterator_a32ad9cb8256759fdf8ac4dd3af183222}\label{class_qore_1_1_list_iterator_a32ad9cb8256759fdf8ac4dd3af183222} 
\index{Qore::ListIterator@{Qore::ListIterator}!prev@{prev}}
\index{prev@{prev}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{prev()}{prev()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+List\+Iterator\+::prev (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Moves the current position to the previous element in the list; returns \doxysectlink{basic_data_types_False}{False}{2} if there are no more elements; if the iterator is not pointing at a valid element before this call, the iterator will be positioned on the last element in the list if the list is not empty. 

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 list 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 the list (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.prev())\ \{}
\DoxyCodeLine{\ \ \ \ printf(\textcolor{stringliteral}{"{}\ +\ \%y\(\backslash\)n"{}},\ i.getValue());}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\Hypertarget{class_qore_1_1_list_iterator_a66980079141ffb2814c5e34f8b728a4f}\label{class_qore_1_1_list_iterator_a66980079141ffb2814c5e34f8b728a4f} 
\index{Qore::ListIterator@{Qore::ListIterator}!reset@{reset}}
\index{reset@{reset}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{reset()}{reset()}}
{\footnotesize\ttfamily Qore\+::\+List\+Iterator\+::reset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reset the iterator instance to its initial state. 

Reset the iterator instance to its initial state

\begin{DoxyParagraph}{Example}

\begin{DoxyCode}{0}
\DoxyCodeLine{i.reset();}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\Hypertarget{class_qore_1_1_list_iterator_a24f641c512ab95856379c3e7609bda57}\label{class_qore_1_1_list_iterator_a24f641c512ab95856379c3e7609bda57} 
\index{Qore::ListIterator@{Qore::ListIterator}!set@{set}}
\index{set@{set}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{set()}{set()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+List\+Iterator\+::set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{pos }\end{DoxyParamCaption})}



sets the new position in the list; if the position is invalid then the method returns \doxysectlink{basic_data_types_False}{False}{2}, meaning the iterator is not valid, otherwise it returns \doxysectlink{basic_data_types_True}{True}{2} 


\begin{DoxyParams}{Parameters}
{\em pos} & the new position for the iterator with 0 as the first element\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\doxysectlink{basic_data_types_False}{False}{2}, meaning the iterator is not valid, otherwise it returns \doxysectlink{basic_data_types_True}{True}{2}
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{if}\ (!i.set(pos))}
\DoxyCodeLine{\ \ \ \ throw\ \textcolor{stringliteral}{"{}INVALID-\/POSITION"{}},\ sprintf(\textcolor{stringliteral}{"{}\%d\ is\ an\ invalid\ position"{}},\ pos);}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em ITERATOR-\/\+THREAD-\/\+ERROR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\Hypertarget{class_qore_1_1_list_iterator_ad880f2e3e193c708b28d753ae6646bfb}\label{class_qore_1_1_list_iterator_ad880f2e3e193c708b28d753ae6646bfb} 
\index{Qore::ListIterator@{Qore::ListIterator}!valid@{valid}}
\index{valid@{valid}!Qore::ListIterator@{Qore::ListIterator}}
\doxysubsubsection{\texorpdfstring{valid()}{valid()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga9a401e5112c58f63c05e7ee1e15968ef}{bool}} Qore\+::\+List\+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}{Code Flags\+:}
\doxysectlink{code_flags_CONSTANT}{CONSTANT}{1}
\end{DoxyParagraph}
\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}
