\hypertarget{class_qore_1_1_list_hash_reverse_iterator}{}\doxysection{Qore\+::List\+Hash\+Reverse\+Iterator Class Reference} \label{class_qore_1_1_list_hash_reverse_iterator}\index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} This class a reverse 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 hashes with keys giving column names where the key values are lists of column values. Inheritance diagram for Qore\+::List\+Hash\+Reverse\+Iterator\+: % FIG 0 \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a967c3737fba002e711a1fe0c18ac0b74}{constructor}} (softlist$<$ auto $>$ l) \begin{DoxyCompactList}\small\item\em Creates the list hash iterator object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a54b680f9c0c050442ec87912516aab60}{copy}} () \begin{DoxyCompactList}\small\item\em Creates a copy of the \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator}{List\+Hash\+Reverse\+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_reverse_iterator_aa54754072fd1532f651013abf7f0cf6f}{first}} () \begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element being iterated (ie the last element in the list) \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a45a4fb06056965aa986e416a5860e005}{last}} () \begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the last element being iterated (ie the first element in the list) \end{DoxyCompactList}\item auto \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a5a876f4ec9552f0e15a8213c909df786}{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_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}{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_reverse_iterator_a075a0a4b3a2e4aa664bd70541a6b4f33}{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}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} This class a reverse 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 hashes with keys giving column names where the key values are lists of column values. Call \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}{List\+Hash\+Reverse\+Iterator\+::next()}} to iterate through the lists of column values assigned to each hash key in reverse order; do not use the iterator if \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}{List\+Hash\+Reverse\+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_reverse_iterator_a075a0a4b3a2e4aa664bd70541a6b4f33}{List\+Hash\+Reverse\+Iterator\+::prev()}} instead of \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}{List\+Hash\+Reverse\+Iterator\+::next()}} \begin{DoxyParagraph}{Example\+: List\+Hash\+Reverse\+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{ListHashReverseIterator 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 1: hash: (column1 : 2, column2 : \textcolor{stringliteral}{"{}b"{}})} \DoxyCodeLine{iter 0: hash: (column1 : 1, column2 : \textcolor{stringliteral}{"{}a"{}})} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item In general, the \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator}{List\+Hash\+Reverse\+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. \item \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator}{List\+Hash\+Reverse\+Iterator}} is functionally equivalent to \mbox{\hyperlink{class_qore_1_1_list_hash_iterator}{List\+Hash\+Iterator}}, but the effect of \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}{List\+Hash\+Reverse\+Iterator\+::next()}} and \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a075a0a4b3a2e4aa664bd70541a6b4f33}{List\+Hash\+Reverse\+Iterator\+::prev()}} are the opposite of \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}{List\+Hash\+Iterator\+::next()}} and \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_af422c1925e9f9d659da0987afbdb93e7}{List\+Hash\+Iterator\+::prev()}}; that is \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}{List\+Hash\+Reverse\+Iterator\+::next()}} will iterate through the hash in reverse order, while \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a075a0a4b3a2e4aa664bd70541a6b4f33}{List\+Hash\+Reverse\+Iterator\+::prev()}} iterates in forward order. Additionally the meanings of the return values for \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_aa54754072fd1532f651013abf7f0cf6f}{List\+Hash\+Reverse\+Iterator\+::first()}} and \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator_a45a4fb06056965aa986e416a5860e005}{List\+Hash\+Reverse\+Iterator\+::last()}} are swapped in respect to \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a4e7a345f24263766e7cdac8eeae903ef}{List\+Hash\+Iterator\+::first()}} and \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a849e526feaa79ce62c920267ec35eab4}{List\+Hash\+Iterator\+::last()}}. \end{DoxyItemize} \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_list_hash_iterator}{List\+Hash\+Iterator}} \end{DoxySeeAlso} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_list_hash_reverse_iterator_a967c3737fba002e711a1fe0c18ac0b74}\label{class_qore_1_1_list_hash_reverse_iterator_a967c3737fba002e711a1fe0c18ac0b74}} \index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}} {\footnotesize\ttfamily Qore\+::\+List\+Hash\+Reverse\+Iterator\+::constructor (\begin{DoxyParamCaption}\item[{softlist$<$ auto $>$}]{l }\end{DoxyParamCaption})} Creates the list hash 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_reverse_iterator_a54b680f9c0c050442ec87912516aab60}\label{class_qore_1_1_list_hash_reverse_iterator_a54b680f9c0c050442ec87912516aab60}} \index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}!copy@{copy}} \index{copy@{copy}!Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+List\+Hash\+Reverse\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates a copy of the \mbox{\hyperlink{class_qore_1_1_list_hash_reverse_iterator}{List\+Hash\+Reverse\+Iterator}} object, iterating the same object as the original and in the same position. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ListHashReverseIterator ni = i.copy();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_list_hash_reverse_iterator_aa54754072fd1532f651013abf7f0cf6f}\label{class_qore_1_1_list_hash_reverse_iterator_aa54754072fd1532f651013abf7f0cf6f}} \index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}!first@{first}} \index{first@{first}!Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} \doxysubsubsection{\texorpdfstring{first()}{first()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Reverse\+Iterator\+::first (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element being iterated (ie the last element in the list) \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element being iterated (ie the last element 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{ \textcolor{keywordflow}{if} (i.first())} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}START:\(\backslash\)n"{}});} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} Reimplemented from \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a4e7a345f24263766e7cdac8eeae903ef}{Qore\+::\+List\+Hash\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_reverse_iterator_a45a4fb06056965aa986e416a5860e005}\label{class_qore_1_1_list_hash_reverse_iterator_a45a4fb06056965aa986e416a5860e005}} \index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}!last@{last}} \index{last@{last}!Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} \doxysubsubsection{\texorpdfstring{last()}{last()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Reverse\+Iterator\+::last (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the last element being iterated (ie the first element in the list) \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if on the last element being iterated (ie the first element 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{ \textcolor{keywordflow}{if} (i.last())} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}END.\(\backslash\)n"{}});} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} Reimplemented from \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a849e526feaa79ce62c920267ec35eab4}{Qore\+::\+List\+Hash\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_reverse_iterator_a5a876f4ec9552f0e15a8213c909df786}\label{class_qore_1_1_list_hash_reverse_iterator_a5a876f4ec9552f0e15a8213c909df786}} \index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}!memberGate@{memberGate}} \index{memberGate@{memberGate}!Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} \doxysubsubsection{\texorpdfstring{memberGate()}{memberGate()}} {\footnotesize\ttfamily auto Qore\+::\+List\+Hash\+Reverse\+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_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}\label{class_qore_1_1_list_hash_reverse_iterator_ad5e6281d6b83babe2a1e96b7a801b6e1}} \index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}!next@{next}} \index{next@{next}!Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} \doxysubsubsection{\texorpdfstring{next()}{next()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Reverse\+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} Reimplemented from \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_a0856d8bc238ce8110e4e9ca14331f295}{Qore\+::\+List\+Hash\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_list_hash_reverse_iterator_a075a0a4b3a2e4aa664bd70541a6b4f33}\label{class_qore_1_1_list_hash_reverse_iterator_a075a0a4b3a2e4aa664bd70541a6b4f33}} \index{Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}!prev@{prev}} \index{prev@{prev}!Qore::ListHashReverseIterator@{Qore::ListHashReverseIterator}} \doxysubsubsection{\texorpdfstring{prev()}{prev()}} {\footnotesize\ttfamily bool Qore\+::\+List\+Hash\+Reverse\+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} Reimplemented from \mbox{\hyperlink{class_qore_1_1_list_hash_iterator_af422c1925e9f9d659da0987afbdb93e7}{Qore\+::\+List\+Hash\+Iterator}}.