\hypertarget{class_qore_1_1_single_value_iterator}{}\section{Qore\+:\+:Single\+Value\+Iterator Class Reference}
\label{class_qore_1_1_single_value_iterator}\index{Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}}


This class defines a simple iterator to be used to iterate single values (or complex objects where no iterator has been implemented yet)  




Inheritance diagram for Qore\+:\+:Single\+Value\+Iterator\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=218pt]{class_qore_1_1_single_value_iterator__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_qore_1_1_single_value_iterator_a7991e0509145e7c02eb7220ec068e0c0}{constructor}} (auto v)
\begin{DoxyCompactList}\small\item\em creates the single value iterator with the value passed as an argument \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_single_value_iterator_af8bfa7e66fd73c0de1c4f05c03a9fc78}{copy}} ()
\begin{DoxyCompactList}\small\item\em Creates a copy of the \mbox{\hyperlink{class_qore_1_1_single_value_iterator}{Single\+Value\+Iterator}} object, iterating the same object as the original and in the same position. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_single_value_iterator_a4f8553281a347e9e10077ab154a1190a}{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 
bool \mbox{\hyperlink{class_qore_1_1_single_value_iterator_a2923e45802fc98a2fb9207989710de1d}{next}} ()
\begin{DoxyCompactList}\small\item\em This method returns \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} and \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} alternately unless it has no value to iterate, in which case it returns only \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_single_value_iterator_a7e96e7dbea4e7e680b74ab605db403cc}{reset}} ()
\begin{DoxyCompactList}\small\item\em Reset the iterator instance to its initial state. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_single_value_iterator_aafb8a835f5535484dc1a1fb97b8a1328}{valid}} ()
\begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if the iterator is currently pointing at a valid element, \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} if not \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This class defines a simple iterator to be used to iterate single values (or complex objects where no iterator has been implemented yet) 

\begin{DoxySince}{Since}
Qore 0.\+8.\+6
\end{DoxySince}
\begin{DoxyParagraph}{Example\+: Single\+Value\+Iterator basic usage}

\begin{DoxyCode}
auto val = 1;
SingleValueIterator it(val);
\textcolor{keywordflow}{while} (it.next()) \{
    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"iter: %n\(\backslash\)n"}, it.getValue());
\}

iter: 1
\end{DoxyCode}

\end{DoxyParagraph}
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\+:


\begin{DoxyCode}
auto val = (1, 2, 3);
iter: list: (1, 2, 3)
\end{DoxyCode}
 

\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_a7991e0509145e7c02eb7220ec068e0c0}\label{class_qore_1_1_single_value_iterator_a7991e0509145e7c02eb7220ec068e0c0}} 
\index{Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}!constructor@{constructor}}
\index{constructor@{constructor}!Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}}
\subsubsection{\texorpdfstring{constructor()}{constructor()}}
{\footnotesize\ttfamily Qore\+::\+Single\+Value\+Iterator\+::constructor (\begin{DoxyParamCaption}\item[{auto}]{v }\end{DoxyParamCaption})}



creates the single value iterator with the value passed as an argument 


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

\begin{DoxyCode}
SingleValueIterator i(v);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_af8bfa7e66fd73c0de1c4f05c03a9fc78}\label{class_qore_1_1_single_value_iterator_af8bfa7e66fd73c0de1c4f05c03a9fc78}} 
\index{Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}!copy@{copy}}
\index{copy@{copy}!Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}}
\subsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+Single\+Value\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Creates a copy of the \mbox{\hyperlink{class_qore_1_1_single_value_iterator}{Single\+Value\+Iterator}} object, iterating the same object as the original and in the same position. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
SingleValueIterator ni = i.copy();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_a4f8553281a347e9e10077ab154a1190a}\label{class_qore_1_1_single_value_iterator_a4f8553281a347e9e10077ab154a1190a}} 
\index{Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}!get\+Value@{get\+Value}}
\index{get\+Value@{get\+Value}!Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}}
\subsubsection{\texorpdfstring{get\+Value()}{getValue()}}
{\footnotesize\ttfamily auto Qore\+::\+Single\+Value\+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}
\textcolor{keywordflow}{while} (i.next()) \{
    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"+ %y\(\backslash\)n"}, i.getValue());
\}
\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
\end{DoxyExceptions}


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

\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_a2923e45802fc98a2fb9207989710de1d}\label{class_qore_1_1_single_value_iterator_a2923e45802fc98a2fb9207989710de1d}} 
\index{Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}!next@{next}}
\index{next@{next}!Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}}
\subsubsection{\texorpdfstring{next()}{next()}}
{\footnotesize\ttfamily bool Qore\+::\+Single\+Value\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



This method returns \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} and \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} alternately unless it has no value to iterate, in which case it returns only \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}. 

The iterator object should not be used after this method returns \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} and \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} alternately unless it has no value to iterate, in which case it returns only \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
\textcolor{keywordflow}{while} (i.next()) \{
    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"value: %y\(\backslash\)n"}, i.getValue());
\}
\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}}.

\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_a7e96e7dbea4e7e680b74ab605db403cc}\label{class_qore_1_1_single_value_iterator_a7e96e7dbea4e7e680b74ab605db403cc}} 
\index{Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}!reset@{reset}}
\index{reset@{reset}!Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}}
\subsubsection{\texorpdfstring{reset()}{reset()}}
{\footnotesize\ttfamily Qore\+::\+Single\+Value\+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}
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_single_value_iterator_aafb8a835f5535484dc1a1fb97b8a1328}\label{class_qore_1_1_single_value_iterator_aafb8a835f5535484dc1a1fb97b8a1328}} 
\index{Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}!valid@{valid}}
\index{valid@{valid}!Qore\+::\+Single\+Value\+Iterator@{Qore\+::\+Single\+Value\+Iterator}}
\subsubsection{\texorpdfstring{valid()}{valid()}}
{\footnotesize\ttfamily bool Qore\+::\+Single\+Value\+Iterator\+::valid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



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

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if the iterator is currently pointing at a valid element, \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{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}
\textcolor{keywordflow}{if} (i.valid())
    \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}}.

