\hypertarget{class_qore_1_1_hash_reverse_iterator}{}\doxysection{Qore\+::Hash\+Reverse\+Iterator Class Reference} \label{class_qore_1_1_hash_reverse_iterator}\index{Qore::HashReverseIterator@{Qore::HashReverseIterator}} This class an iterator class for hashes. Inheritance diagram for Qore\+::Hash\+Reverse\+Iterator\+: % FIG 0 \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_aefb96e7e14db92d4e94f690e25965a86}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ h) \begin{DoxyCompactList}\small\item\em Creates the hash iterator object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a05216846a86b7b3ccfb7dd8d82bf5693}{constructor}} () \begin{DoxyCompactList}\small\item\em Creates an empty iterator object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a0daf58b78d679d6242c88a24b2a95bfa}{copy}} () \begin{DoxyCompactList}\small\item\em Creates a copy of the \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator}{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_hash_reverse_iterator_ac7cf3e0eda0c8f4854e3dd6fab31a1ab}{first}} () \begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the last element of the hash \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_aec930a3efe298b98eeda8670c132dd8f}{last}} () \begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element of the hash \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{next}} () \begin{DoxyCompactList}\small\item\em Moves the current position to the previous element in the hash; 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 hash if the hash is not empty. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}{prev}} () \begin{DoxyCompactList}\small\item\em Moves the current position to the next element in the hash; 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 hash if the hash is not empty. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} This class an iterator class for hashes. Call \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Hash\+Reverse\+Iterator\+::next()}} to iterate through the hash in reverse order; do not use the iterator if \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Hash\+Reverse\+Iterator\+::next()}} returns \mbox{\hyperlink{basic_data_types_False}{False}}. A hash can be iterated in reverse order by calling \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}{Hash\+Reverse\+Iterator\+::prev()}} instead of \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Hash\+Reverse\+Iterator\+::next()}} \begin{DoxyParagraph}{Example\+: Hash\+Reverse\+Iterator basic usage} \begin{DoxyCode}{0} \DoxyCodeLine{hash h = ( \textcolor{stringliteral}{"{}key1"{}} : 1, \textcolor{stringliteral}{"{}key2"{}} : 2, );} \DoxyCodeLine{} \DoxyCodeLine{HashReverseIterator it(h);} \DoxyCodeLine{\textcolor{keywordflow}{while} (it.next()) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}getKey: \%n; getKeyValue: \%n; getValue: \%n; getValuePair: \%n\(\backslash\)n"{}},} \DoxyCodeLine{ it.getKey(), it.getKeyValue(), it.getValue(), it.getValuePair());} \DoxyCodeLine{\}} \DoxyCodeLine{} \DoxyCodeLine{getKey: \textcolor{stringliteral}{"{}key2"{}}; getKeyValue: 2; getValue: 2; getValuePair: hash: (key : \textcolor{stringliteral}{"{}key2"{}}, value : 2)} \DoxyCodeLine{getKey: \textcolor{stringliteral}{"{}key1"{}}; getKeyValue: 1; getValue: 1; getValuePair: hash: (key : \textcolor{stringliteral}{"{}key1"{}}, value : 1)} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item In general, the \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator}{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_hash_reverse_iterator}{Hash\+Reverse\+Iterator}} is functionally equivalent to \mbox{\hyperlink{class_qore_1_1_hash_iterator}{Hash\+Iterator}}, but the effect of \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Hash\+Reverse\+Iterator\+::next()}} and \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}{Hash\+Reverse\+Iterator\+::prev()}} are the opposite of \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Hash\+Iterator\+::next()}} and \mbox{\hyperlink{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}{Hash\+Iterator\+::prev()}}; that is \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Hash\+Reverse\+Iterator\+::next()}} will iterate through the hash in reverse order, while \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}{Hash\+Reverse\+Iterator\+::prev()}} iterates in forward order. Additionally the meanings of the return values for \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_ac7cf3e0eda0c8f4854e3dd6fab31a1ab}{Hash\+Reverse\+Iterator\+::first()}} and \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_aec930a3efe298b98eeda8670c132dd8f}{Hash\+Reverse\+Iterator\+::last()}} are swapped in respect to \mbox{\hyperlink{class_qore_1_1_hash_iterator_a1d639332a9f27f97a830994b1a68ada2}{Hash\+Iterator\+::first()}} and \mbox{\hyperlink{class_qore_1_1_hash_iterator_a40b7935be4791e186dba782e091084e5}{Hash\+Iterator\+::last()}}. \end{DoxyItemize} \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_hash_iterator}{Hash\+Iterator}} \end{DoxySeeAlso} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_hash_reverse_iterator_a05216846a86b7b3ccfb7dd8d82bf5693}\label{class_qore_1_1_hash_reverse_iterator_a05216846a86b7b3ccfb7dd8d82bf5693}} \index{Qore::HashReverseIterator@{Qore::HashReverseIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::HashReverseIterator@{Qore::HashReverseIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily Qore\+::\+Hash\+Reverse\+Iterator\+::constructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates an empty iterator object. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*hash h = get\_hash\_or\_nothing();} \DoxyCodeLine{HashReverseIterator hi(h);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_hash_reverse_iterator_aefb96e7e14db92d4e94f690e25965a86}\label{class_qore_1_1_hash_reverse_iterator_aefb96e7e14db92d4e94f690e25965a86}} \index{Qore::HashReverseIterator@{Qore::HashReverseIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::HashReverseIterator@{Qore::HashReverseIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily Qore\+::\+Hash\+Reverse\+Iterator\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{h }\end{DoxyParamCaption})} Creates the hash iterator object. \begin{DoxyParams}{Parameters} {\em h} & the hash to iterate\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{HashReverseIterator hi(h);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_hash_reverse_iterator_a0daf58b78d679d6242c88a24b2a95bfa}\label{class_qore_1_1_hash_reverse_iterator_a0daf58b78d679d6242c88a24b2a95bfa}} \index{Qore::HashReverseIterator@{Qore::HashReverseIterator}!copy@{copy}} \index{copy@{copy}!Qore::HashReverseIterator@{Qore::HashReverseIterator}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+Hash\+Reverse\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates a copy of the \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator}{Hash\+Reverse\+Iterator}} object, iterating the same object as the original and in the same position. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{HashReverseIterator ni = i.copy();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_hash_reverse_iterator_ac7cf3e0eda0c8f4854e3dd6fab31a1ab}\label{class_qore_1_1_hash_reverse_iterator_ac7cf3e0eda0c8f4854e3dd6fab31a1ab}} \index{Qore::HashReverseIterator@{Qore::HashReverseIterator}!first@{first}} \index{first@{first}!Qore::HashReverseIterator@{Qore::HashReverseIterator}} \doxysubsubsection{\texorpdfstring{first()}{first()}} {\footnotesize\ttfamily bool Qore\+::\+Hash\+Reverse\+Iterator\+::first (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the last element of the hash \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if on the last element of the hash \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_hash_iterator_a1d639332a9f27f97a830994b1a68ada2}{Qore\+::\+Hash\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_reverse_iterator_aec930a3efe298b98eeda8670c132dd8f}\label{class_qore_1_1_hash_reverse_iterator_aec930a3efe298b98eeda8670c132dd8f}} \index{Qore::HashReverseIterator@{Qore::HashReverseIterator}!last@{last}} \index{last@{last}!Qore::HashReverseIterator@{Qore::HashReverseIterator}} \doxysubsubsection{\texorpdfstring{last()}{last()}} {\footnotesize\ttfamily bool Qore\+::\+Hash\+Reverse\+Iterator\+::last (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element of the hash \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element of the hash \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_hash_iterator_a40b7935be4791e186dba782e091084e5}{Qore\+::\+Hash\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}\label{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}} \index{Qore::HashReverseIterator@{Qore::HashReverseIterator}!next@{next}} \index{next@{next}!Qore::HashReverseIterator@{Qore::HashReverseIterator}} \doxysubsubsection{\texorpdfstring{next()}{next()}} {\footnotesize\ttfamily bool Qore\+::\+Hash\+Reverse\+Iterator\+::next (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} Moves the current position to the previous element in the hash; 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 hash if the hash 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 hash 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 hash (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{DoxyNote}{Note} \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Hash\+Reverse\+Iterator\+::next()}} is the opposite of \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Hash\+Iterator\+::next()}}; it is functionally equivalent to \mbox{\hyperlink{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}{Hash\+Iterator\+::prev()}}; \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Hash\+Reverse\+Iterator\+::next()}} iterates through the hash in reverse order \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 \end{DoxyExceptions} Reimplemented from \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Qore\+::\+Hash\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}\label{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}} \index{Qore::HashReverseIterator@{Qore::HashReverseIterator}!prev@{prev}} \index{prev@{prev}!Qore::HashReverseIterator@{Qore::HashReverseIterator}} \doxysubsubsection{\texorpdfstring{prev()}{prev()}} {\footnotesize\ttfamily bool Qore\+::\+Hash\+Reverse\+Iterator\+::prev (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} Moves the current position to the next element in the hash; 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 hash if the hash 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 hash 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 hash (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{DoxyNote}{Note} \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}{Hash\+Reverse\+Iterator\+::prev()}} is the opposite of \mbox{\hyperlink{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}{Hash\+Iterator\+::prev()}}; it is functionally equivalent to \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Hash\+Iterator\+::next()}}; \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}{Hash\+Reverse\+Iterator\+::prev()}} iterates through the hash in forward order \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 \end{DoxyExceptions} Reimplemented from \mbox{\hyperlink{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}{Qore\+::\+Hash\+Iterator}}. 98340da29f4">
constructor(Type type, *hash< auto > options, *hash< auto > tags)
creates the object with the given options
auto acceptsValue(auto value)
returns the value if the value can be assigned to the type
const SupportedOptions
supported options
Definition: QoreStringDataTypeBase.qc.dox.h:41
AbstractDataProviderType getSoftType()
returns a "soft" type equivalent to the current type
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions()
returns supported options
const String
const Boolean
const Int
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27
describes type options
Definition: AbstractDataProviderType.qc.dox.h:125