\hypertarget{class_qore_1_1_list_hash_iterator}{}\doxysection{Qore\+::List\+Hash\+Iterator Class Reference} \label{class_qore_1_1_list_hash_iterator}\index{Qore::ListHashIterator@{Qore::ListHashIterator}} This class an iterator class for lists of hashes as returned by \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{Qore\+::\+SQL\+::\+Datasource\+::select\+Rows()}} and \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_pool_a9298e44c0af5bb93330c929b47cde5c9}{Qore\+::\+SQL\+::\+Datasource\+Pool\+::select\+Rows()}}, both of which return lists of columns where each list entry is a hash of the current column values. Inheritance diagram for Qore\+::List\+Hash\+Iterator\+: % FIG 0 \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a1df64c650e8dafe3dcff39c554458de5}{constructor}} (softlist$<$ auto $>$ l) \begin{DoxyCompactList}\small\item\em Creates the hash list iterator object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_aa7725a9de08969a75be8fc94727b73ad}{copy}} () \begin{DoxyCompactList}\small\item\em Creates a copy of the \mbox{\hyperlink{class_qore_1_1_list_hash_iterator}{List\+Hash\+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_hash_iterator_acbf9ae3d6d10b3007cd9b718fa88d1b8}{empty}} () \begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if the result list is empty; \mbox{\hyperlink{basic_data_types_False}{False}} if not \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a4e7a345f24263766e7cdac8eeae903ef}{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_hash_iterator_a415506cda48690331ebfa00a79646df7}{get\+Key\+Value}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} key) \begin{DoxyCompactList}\small\item\em Returns the current value for the column given as an argument. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a64679b32e59aba5cc3f95f931386022b}{get\+Row}} () \begin{DoxyCompactList}\small\item\em returns the current row value as a hash or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a6b4f669230a5c01ff8e1df96c5029773}{get\+Value}} () \begin{DoxyCompactList}\small\item\em returns the current row value as a hash 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_hash_iterator_ad53157969b6c64ac9cb9732b4817ab59}{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_hash_iterator_a849e526feaa79ce62c920267ec35eab4}{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_hash_iterator_a4309a3e47c54d01350d58599019bd21c}{max}} () \begin{DoxyCompactList}\small\item\em returns the number of elements in the list \end{DoxyCompactList}\item auto \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a831e61e4d25344faa028dabe03acce4a}{member\+Gate}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} key) \begin{DoxyCompactList}\small\item\em This method allows the iterator to be dereferenced directly as a hash for the current row being iterated, as member\+Gate methods are called implicitly when an unknown member is accessed from outside the class. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}{next}} () \begin{DoxyCompactList}\small\item\em Moves the current position to the next element in the result 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_hash_iterator_af422c1925e9f9d659da0987afbdb93e7}{prev}} () \begin{DoxyCompactList}\small\item\em Moves the current position to the previous element in the result 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_hash_iterator_a9f5b2b81baf0c5a3b6981c8f4ffe3d56}{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_hash_iterator_a6cb2ba7c6ed81afb8c06cde38ce000f2}{set}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} pos) \begin{DoxyCompactList}\small\item\em sets the new position in the result 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_hash_iterator_aff5bfd5e591c6306d2deaad6665e0ba8}{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 of hashes as returned by \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{Qore\+::\+SQL\+::\+Datasource\+::select\+Rows()}} and \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_pool_a9298e44c0af5bb93330c929b47cde5c9}{Qore\+::\+SQL\+::\+Datasource\+Pool\+::select\+Rows()}}, both of which return lists of columns where each list entry is a hash of the current column values. Call \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}{List\+Hash\+Iterator\+::next()}} to iterate through the lists of column values; do not use the iterator if \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}{List\+Hash\+Iterator\+::next()}} returns \mbox{\hyperlink{basic_data_types_False}{False}}. A result list can be iterated in reverse order by calling \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_af422c1925e9f9d659da0987afbdb93e7}{List\+Hash\+Iterator\+::prev()}} instead of \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}{List\+Hash\+Iterator\+::next()}} \begin{DoxyParagraph}{Example\+: List\+Hash\+Iterator basic usage} \begin{DoxyCode}{0} \DoxyCodeLine{list data = (} \DoxyCodeLine{ \{\textcolor{stringliteral}{"{}column1"{}}: 1, \textcolor{stringliteral}{"{}column2"{}}: \textcolor{stringliteral}{"{}a"{}}\},} \DoxyCodeLine{ \{\textcolor{stringliteral}{"{}column1"{}}: 2, \textcolor{stringliteral}{"{}column2"{}}: \textcolor{stringliteral}{"{}b"{}}\},} \DoxyCodeLine{ );} \DoxyCodeLine{} \DoxyCodeLine{ListHashIterator it(data);} \DoxyCodeLine{\textcolor{keywordflow}{while} (it.next()) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}iter \%d: \%n\(\backslash\)n"{}}, it.index(), it.getValue());} \DoxyCodeLine{\}} \DoxyCodeLine{} \DoxyCodeLine{iter 0: hash: (column1: 1, column2: \textcolor{stringliteral}{"{}a"{}})} \DoxyCodeLine{iter 1: hash: (column1: 2, column2: \textcolor{stringliteral}{"{}b"{}})} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item In general, the \mbox{\hyperlink{class_qore_1_1_list_hash_iterator}{List\+Hash\+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} \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator}{List\+Hash\+Reverse\+Iterator}} \end{DoxySeeAlso} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_a1df64c650e8dafe3dcff39c554458de5}\label{class_qore_1_1_list_hash_iterator_a1df64c650e8dafe3dcff39c554458de5}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}} {\footnotesize\ttfamily Qore\+::\+List\+Hash\+Iterator\+::constructor (\begin{DoxyParamCaption}\item[{softlist$<$ auto $>$}]{l }\end{DoxyParamCaption})} Creates the hash list iterator object. \begin{DoxyParams}{Parameters} {\em l} & the list of hashes to iterate\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ListHashIterator i(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}{NOTHING}} \end{DoxyNote} \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_aa7725a9de08969a75be8fc94727b73ad}\label{class_qore_1_1_list_hash_iterator_aa7725a9de08969a75be8fc94727b73ad}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!copy@{copy}} \index{copy@{copy}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+List\+Hash\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates a copy of the \mbox{\hyperlink{class_qore_1_1_list_hash_iterator}{List\+Hash\+Iterator}} object, iterating the same object as the original and in the same position. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ListHashIterator ni = i.copy();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_acbf9ae3d6d10b3007cd9b718fa88d1b8}\label{class_qore_1_1_list_hash_iterator_acbf9ae3d6d10b3007cd9b718fa88d1b8}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!empty@{empty}} \index{empty@{empty}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{empty()}{empty()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Iterator\+::empty (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns \mbox{\hyperlink{basic_data_types_True}{True}} if the result list is empty; \mbox{\hyperlink{basic_data_types_False}{False}} if not \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if the result list is empty; \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.empty())} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}the result 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_hash_iterator_a4e7a345f24263766e7cdac8eeae903ef}\label{class_qore_1_1_list_hash_iterator_a4e7a345f24263766e7cdac8eeae903ef}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!first@{first}} \index{first@{first}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{first()}{first()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+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}{CONSTANT}} \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_hash_reverse_iterator_aa54754072fd1532f651013abf7f0cf6f}{Qore\+::\+List\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_a415506cda48690331ebfa00a79646df7}\label{class_qore_1_1_list_hash_iterator_a415506cda48690331ebfa00a79646df7}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!getKeyValue@{getKeyValue}} \index{getKeyValue@{getKeyValue}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{getKeyValue()}{getKeyValue()}} {\footnotesize\ttfamily auto Qore\+::\+List\+Hash\+Iterator\+::get\+Key\+Value (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{key }\end{DoxyParamCaption})} Returns the current value for the column given as an argument. \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em key} & the column name for the value to retrieve\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the current column value of the given row \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}\%d: value: \%y"{}}, i.index(), i.getKeyValue(\textcolor{stringliteral}{"{}value"{}}));} \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 {\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element or the list being iterated does not contain a hash element at the current iterator position or the given hash key does not exist\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a831e61e4d25344faa028dabe03acce4a}{List\+Hash\+Iterator\+::member\+Gate()}} allows for the iterator to act as if it is a hash with members equal to the current row being iterated \end{DoxyNote} \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_a64679b32e59aba5cc3f95f931386022b}\label{class_qore_1_1_list_hash_iterator_a64679b32e59aba5cc3f95f931386022b}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!getRow@{getRow}} \index{getRow@{getRow}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{getRow()}{getRow()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+List\+Hash\+Iterator\+::get\+Row (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} returns the current row value as a hash or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \begin{DoxyReturn}{Returns} the current row value as a hash 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{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{} + row \%d: \%y\(\backslash\)n"{}}, i.index(), i.getValue());} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} equivalent to \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a6b4f669230a5c01ff8e1df96c5029773}{List\+Hash\+Iterator\+::get\+Value()}} \end{DoxyNote} \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 {\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element or the list being iterated does not contain a hash element at the current iterator position \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_a6b4f669230a5c01ff8e1df96c5029773}\label{class_qore_1_1_list_hash_iterator_a6b4f669230a5c01ff8e1df96c5029773}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!getValue@{getValue}} \index{getValue@{getValue}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{getValue()}{getValue()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+List\+Hash\+Iterator\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns the current row value as a hash or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \begin{DoxyReturn}{Returns} the current row value as a hash 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{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{} + row \%d: \%y\(\backslash\)n"{}}, i.index(), i.getValue());} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item equivalent to \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a64679b32e59aba5cc3f95f931386022b}{List\+Hash\+Iterator\+::get\+Row()}} \end{DoxyItemize} \end{DoxyNote} \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 {\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element or the list being iterated does not contain a hash element at the current iterator position \\ \hline \end{DoxyExceptions} Implements \mbox{\hyperlink{class_qore_1_1_abstract_iterator_aa01374b285003faa21b045082063ac12}{Qore\+::\+Abstract\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_ad53157969b6c64ac9cb9732b4817ab59}\label{class_qore_1_1_list_hash_iterator_ad53157969b6c64ac9cb9732b4817ab59}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!index@{index}} \index{index@{index}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{index()}{index()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+List\+Hash\+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}{CONSTANT}} \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_hash_iterator_a849e526feaa79ce62c920267ec35eab4}\label{class_qore_1_1_list_hash_iterator_a849e526feaa79ce62c920267ec35eab4}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!last@{last}} \index{last@{last}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{last()}{last()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+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}{CONSTANT}} \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_hash_reverse_iterator_a45a4fb06056965aa986e416a5860e005}{Qore\+::\+List\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_a4309a3e47c54d01350d58599019bd21c}\label{class_qore_1_1_list_hash_iterator_a4309a3e47c54d01350d58599019bd21c}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!max@{max}} \index{max@{max}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{max()}{max()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+List\+Hash\+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}{CONSTANT}} \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_hash_iterator_a831e61e4d25344faa028dabe03acce4a}\label{class_qore_1_1_list_hash_iterator_a831e61e4d25344faa028dabe03acce4a}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!memberGate@{memberGate}} \index{memberGate@{memberGate}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{memberGate()}{memberGate()}} {\footnotesize\ttfamily auto Qore\+::\+List\+Hash\+Iterator\+::member\+Gate (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{key }\end{DoxyParamCaption})} This method allows the iterator to be dereferenced directly as a hash for the current row being iterated, as member\+Gate methods are called implicitly when an unknown member is accessed from outside the class. \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em key} & the column name for the value to retrieve\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the current column value of the given row \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{while} (i.next()) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}\%d: value: \%y"{}}, i.index(), i.value);} \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 {\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element or the list being iterated does not contain a hash element at the current iterator position or the given hash key does not exist\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} equivalent to \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a415506cda48690331ebfa00a79646df7}{List\+Hash\+Iterator\+::get\+Key\+Value()}} when called explicitly \end{DoxyNote} \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}\label{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!next@{next}} \index{next@{next}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{next()}{next()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} Moves the current position to the next element in the result 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 result 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}{"{} + row \%d: \%y\(\backslash\)n"{}}, i.index(), 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}}. Reimplemented in \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}{Qore\+::\+List\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_af422c1925e9f9d659da0987afbdb93e7}\label{class_qore_1_1_list_hash_iterator_af422c1925e9f9d659da0987afbdb93e7}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!prev@{prev}} \index{prev@{prev}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{prev()}{prev()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Iterator\+::prev (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} Moves the current position to the previous element in the result 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 result 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}{"{} + row \%d: \%y\(\backslash\)n"{}}, i.index(), 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_bidirectional_iterator_a8ca43ac8bffc78178f61e3cca9b6323e}{Qore\+::\+Abstract\+Bidirectional\+Iterator}}. Reimplemented in \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a075a0a4b3a2e4aa664bd70541a6b4f33}{Qore\+::\+List\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_iterator_a9f5b2b81baf0c5a3b6981c8f4ffe3d56}\label{class_qore_1_1_list_hash_iterator_a9f5b2b81baf0c5a3b6981c8f4ffe3d56}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!reset@{reset}} \index{reset@{reset}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{reset()}{reset()}} {\footnotesize\ttfamily Qore\+::\+List\+Hash\+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_list_hash_iterator_a6cb2ba7c6ed81afb8c06cde38ce000f2}\label{class_qore_1_1_list_hash_iterator_a6cb2ba7c6ed81afb8c06cde38ce000f2}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!set@{set}} \index{set@{set}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{set()}{set()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Iterator\+::set (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{pos }\end{DoxyParamCaption})} sets the new position in the result 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 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_list_hash_iterator_aff5bfd5e591c6306d2deaad6665e0ba8}\label{class_qore_1_1_list_hash_iterator_aff5bfd5e591c6306d2deaad6665e0ba8}} \index{Qore::ListHashIterator@{Qore::ListHashIterator}!valid@{valid}} \index{valid@{valid}!Qore::ListHashIterator@{Qore::ListHashIterator}} \doxysubsubsection{\texorpdfstring{valid()}{valid()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+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{ \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}}.