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


This class an iterator class for lists.  




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}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_list_iterator_ac972b8fe8ce44162e0ce66643eee1a55}{constructor}} (softlist$<$ auto $>$ 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 \mbox{\hyperlink{class_qore_1_1_list_iterator}{List\+Iterator}} object, iterating the same object as the original and in the same position. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_list_iterator_a6b122999ed1d5270b799d08389d6a4b8}{empty}} ()
\begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if the list is empty; \mbox{\hyperlink{basic_data_types_False}{False}} if not \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_list_iterator_a93b82a5f331015eacbc41114005af1c0}{first}} ()
\begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element of the list \end{DoxyCompactList}\item 
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 I\+N\+V\+A\+L\+I\+D-\/\+I\+T\+E\+R\+A\+T\+OR} 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 
bool \mbox{\hyperlink{class_qore_1_1_list_iterator_ab42d03f4202ae21cbf50732c93a206c2}{last}} ()
\begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} 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 
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 \mbox{\hyperlink{basic_data_types_False}{False}} 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 
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 \mbox{\hyperlink{basic_data_types_False}{False}} 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 
bool \mbox{\hyperlink{class_qore_1_1_list_iterator_a24f641c512ab95856379c3e7609bda57}{set}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} pos)
\begin{DoxyCompactList}\small\item\em sets the new position in the list; if the position is invalid then the method returns \mbox{\hyperlink{basic_data_types_False}{False}}, meaning the iterator is not valid, otherwise it returns \mbox{\hyperlink{basic_data_types_True}{True}} \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_list_iterator_ad880f2e3e193c708b28d753ae6646bfb}{valid}} ()
\begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if the iterator is currently pointing at a valid element, \mbox{\hyperlink{basic_data_types_False}{False}} if not \end{DoxyCompactList}\end{DoxyCompactItemize}


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

Call \mbox{\hyperlink{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16}{List\+Iterator\+::next()}} to iterate through the list; do not use the iterator if \mbox{\hyperlink{class_qore_1_1_list_iterator_a6ec3a70d479bc98120d5da861a347d16}{List\+Iterator\+::next()}} returns \mbox{\hyperlink{basic_data_types_False}{False}}. A list can be iterated in reverse order by calling \mbox{\hyperlink{class_qore_1_1_list_iterator_a32ad9cb8256759fdf8ac4dd3af183222}{List\+Iterator\+::prev()}} instead of \mbox{\hyperlink{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{    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{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 \mbox{\hyperlink{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 I\+T\+E\+R\+A\+T\+O\+R-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} to be thrown.
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_list_reverse_iterator}{List\+Reverse\+Iterator}} 
\end{DoxySeeAlso}


\doxysubsection{Member Function Documentation}
\mbox{\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[{softlist$<$ 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 \mbox{\hyperlink{data_type_declarations_softlist_type}{softlist}} so that it can also accept \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} 
\end{DoxyNote}
\mbox{\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 \mbox{\hyperlink{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}
\mbox{\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 bool Qore\+::\+List\+Iterator\+::empty (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



returns \mbox{\hyperlink{basic_data_types_True}{True}} if the list is empty; \mbox{\hyperlink{basic_data_types_False}{False}} if not 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the list is empty; \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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


Implements \mbox{\hyperlink{class_qore_1_1_abstract_quantified_iterator_aa859f2f4a719f955b100cde8b65b3277}{Qore\+::\+Abstract\+Quantified\+Iterator}}.

\mbox{\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 bool Qore\+::\+List\+Iterator\+::first (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element of the list 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if on the first element of the list
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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


Implements \mbox{\hyperlink{class_qore_1_1_abstract_quantified_iterator_a4264e42010fa08a8099692e2876c3241}{Qore\+::\+Abstract\+Quantified\+Iterator}}.



Reimplemented in \mbox{\hyperlink{class_qore_1_1_list_reverse_iterator_a2e8154d62fdeb3d8f08b3b26c048f24b}{Qore\+::\+List\+Reverse\+Iterator}}.

\mbox{\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 auto Qore\+::\+List\+Iterator\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



returns the current value or throws an {\ttfamily I\+N\+V\+A\+L\+I\+D-\/\+I\+T\+E\+R\+A\+T\+OR} exception if the iterator is invalid 

\begin{DoxyReturn}{Returns}
the current value or throws an {\ttfamily I\+N\+V\+A\+L\+I\+D-\/\+I\+T\+E\+R\+A\+T\+OR} exception if the iterator is invalid
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em I\+N\+V\+A\+L\+I\+D-\/\+I\+T\+E\+R\+A\+T\+OR} & the iterator is not pointing at a valid element \\
\hline
{\em I\+T\+E\+R\+A\+T\+O\+R-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}


Implements \mbox{\hyperlink{class_qore_1_1_abstract_iterator_a1f7b94aa7237f59c4f959f4d33333d9a}{Qore\+::\+Abstract\+Iterator}}.

\mbox{\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\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{}
\DoxyCodeLine{    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"+ \%d/\%d: \%y\(\backslash\)n"}, i.index(), i.max(), i.getValue());}
\DoxyCodeLine{\}}
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\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 bool Qore\+::\+List\+Iterator\+::last (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the last element of the list 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if on the last element of the list
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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


Implements \mbox{\hyperlink{class_qore_1_1_abstract_quantified_iterator_aa7bef0cd843ced4319fd5f0d7647ef8e}{Qore\+::\+Abstract\+Quantified\+Iterator}}.



Reimplemented in \mbox{\hyperlink{class_qore_1_1_list_reverse_iterator_a33bf7f6114d76f5c1b8c80a5d7dc6fac}{Qore\+::\+List\+Reverse\+Iterator}}.

\mbox{\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\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{}
\DoxyCodeLine{    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"+ \%d/\%d: \%y\(\backslash\)n"}, i.index(), i.max(), i.getValue());}
\DoxyCodeLine{\}}
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\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 bool Qore\+::\+List\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Moves the current position to the next element in the list; returns \mbox{\hyperlink{basic_data_types_False}{False}} 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 \mbox{\hyperlink{basic_data_types_True}{True}} again after it returns \mbox{\hyperlink{basic_data_types_False}{False}} once if list is not empty, otherwise it will always return \mbox{\hyperlink{basic_data_types_False}{False}}. The iterator object should not be used after this method returns \mbox{\hyperlink{basic_data_types_False}{False}}

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

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

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em I\+T\+E\+R\+A\+T\+O\+R-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}


Implements \mbox{\hyperlink{class_qore_1_1_abstract_iterator_ab10d5694cc2fcd3b6689ea7494da79de}{Qore\+::\+Abstract\+Iterator}}.



Reimplemented in \mbox{\hyperlink{class_qore_1_1_list_reverse_iterator_a49ec4a340d3d713d5865c91d1ead6065}{Qore\+::\+List\+Reverse\+Iterator}}.

\mbox{\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 bool Qore\+::\+List\+Iterator\+::prev (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Moves the current position to the previous element in the list; returns \mbox{\hyperlink{basic_data_types_False}{False}} 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 \mbox{\hyperlink{basic_data_types_True}{True}} again after it returns \mbox{\hyperlink{basic_data_types_False}{False}} once if the list is not empty, otherwise it will always return \mbox{\hyperlink{basic_data_types_False}{False}}. The iterator object should not be used after this method returns \mbox{\hyperlink{basic_data_types_False}{False}}

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

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

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em I\+T\+E\+R\+A\+T\+O\+R-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}


Implements \mbox{\hyperlink{class_qore_1_1_abstract_bidirectional_iterator_a8ca43ac8bffc78178f61e3cca9b6323e}{Qore\+::\+Abstract\+Bidirectional\+Iterator}}.



Reimplemented in \mbox{\hyperlink{class_qore_1_1_list_reverse_iterator_aae132f219a250cedb11bcf67995422dc}{Qore\+::\+List\+Reverse\+Iterator}}.

\mbox{\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 I\+T\+E\+R\+A\+T\+O\+R-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\mbox{\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 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 \mbox{\hyperlink{basic_data_types_False}{False}}, meaning the iterator is not valid, otherwise it returns \mbox{\hyperlink{basic_data_types_True}{True}} 


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

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

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em I\+T\+E\+R\+A\+T\+O\+R-\/\+T\+H\+R\+E\+A\+D-\/\+E\+R\+R\+OR} & this exception is thrown if this method is called from any thread other than the thread that created the object \\
\hline
\end{DoxyExceptions}
\mbox{\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 bool Qore\+::\+List\+Iterator\+::valid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



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

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{basic_data_types_True}{True}} if the iterator is currently pointing at a valid element, \mbox{\hyperlink{basic_data_types_False}{False}} if not
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

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


Implements \mbox{\hyperlink{class_qore_1_1_abstract_iterator_aee1def5d872b487b8917a166d9b263e8}{Qore\+::\+Abstract\+Iterator}}.

