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


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




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



Inheritance diagram for Qore\+::Single\+Value\+Iterator\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=219pt]{class_qore_1_1_single_value_iterator__inherit__graph}
\end{center}
\end{figure}
\doxysubsection*{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 INVALID-\/\+ITERATOR} 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{basic_data_types_True}{True}} and \mbox{\hyperlink{basic_data_types_False}{False}} alternately unless it has no value to iterate, in which case it returns only \mbox{\hyperlink{basic_data_types_False}{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{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 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}{0}
\DoxyCodeLine{auto val = 1;}
\DoxyCodeLine{SingleValueIterator it(val);}
\DoxyCodeLine{\textcolor{keywordflow}{while} (it.next()) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}iter: \%n\(\backslash\)n"{}}, it.getValue());}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{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}{0}
\DoxyCodeLine{auto val = (1, 2, 3);}
\DoxyCodeLine{iter: list: (1, 2, 3)}

\end{DoxyCode}
 

\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_a7991e0509145e7c02eb7220ec068e0c0}\label{class_qore_1_1_single_value_iterator_a7991e0509145e7c02eb7220ec068e0c0}} 
\index{Qore::SingleValueIterator@{Qore::SingleValueIterator}!constructor@{constructor}}
\index{constructor@{constructor}!Qore::SingleValueIterator@{Qore::SingleValueIterator}}
\doxysubsubsection{\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}{0}
\DoxyCodeLine{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::SingleValueIterator@{Qore::SingleValueIterator}!copy@{copy}}
\index{copy@{copy}!Qore::SingleValueIterator@{Qore::SingleValueIterator}}
\doxysubsubsection{\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}{0}
\DoxyCodeLine{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::SingleValueIterator@{Qore::SingleValueIterator}!getValue@{getValue}}
\index{getValue@{getValue}!Qore::SingleValueIterator@{Qore::SingleValueIterator}}
\doxysubsubsection{\texorpdfstring{getValue()}{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 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\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}}
\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
\end{DoxyExceptions}


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

\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_a2923e45802fc98a2fb9207989710de1d}\label{class_qore_1_1_single_value_iterator_a2923e45802fc98a2fb9207989710de1d}} 
\index{Qore::SingleValueIterator@{Qore::SingleValueIterator}!next@{next}}
\index{next@{next}!Qore::SingleValueIterator@{Qore::SingleValueIterator}}
\doxysubsubsection{\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{basic_data_types_True}{True}} and \mbox{\hyperlink{basic_data_types_False}{False}} alternately unless it has no value to iterate, in which case it returns only \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_True}{True}} and \mbox{\hyperlink{basic_data_types_False}{False}} alternately unless it has no value to iterate, in which case it returns only \mbox{\hyperlink{basic_data_types_False}{False}}
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{}
\DoxyCodeLine{    printf(\textcolor{stringliteral}{"{}value: \%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}


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::SingleValueIterator@{Qore::SingleValueIterator}!reset@{reset}}
\index{reset@{reset}!Qore::SingleValueIterator@{Qore::SingleValueIterator}}
\doxysubsubsection{\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}{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}
\mbox{\Hypertarget{class_qore_1_1_single_value_iterator_aafb8a835f5535484dc1a1fb97b8a1328}\label{class_qore_1_1_single_value_iterator_aafb8a835f5535484dc1a1fb97b8a1328}} 
\index{Qore::SingleValueIterator@{Qore::SingleValueIterator}!valid@{valid}}
\index{valid@{valid}!Qore::SingleValueIterator@{Qore::SingleValueIterator}}
\doxysubsubsection{\texorpdfstring{valid()}{valid()}}
{\footnotesize\ttfamily bool Qore\+::\+Single\+Value\+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}{CONSTANT}}
\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}


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

