\hypertarget{class_qore_1_1_hash_iterator}{}\doxysection{Qore\+::Hash\+Iterator Class Reference} \label{class_qore_1_1_hash_iterator}\index{Qore::HashIterator@{Qore::HashIterator}} This class an iterator class for hashes. Inheritance diagram for Qore\+::Hash\+Iterator\+: % FIG 0 \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{class_qore_1_1_hash_iterator_a842d257239bb77f2989960dbe1ddabc9}{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_iterator_a1fc56abc6eb066009a390ff11fe5b69d}{constructor}} () \begin{DoxyCompactList}\small\item\em Creates an empty hash iterator object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae35efa6b6afd35bc56fdddd9d5622059}{copy}} () \begin{DoxyCompactList}\small\item\em Creates a copy of the \mbox{\hyperlink{class_qore_1_1_hash_iterator}{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_hash_iterator_adc2400ed775808e5ab8a3afd671c4428}{empty}} () \begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if the hash is empty; \mbox{\hyperlink{basic_data_types_False}{False}} if not \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_hash_iterator_a1d639332a9f27f97a830994b1a68ada2}{first}} () \begin{DoxyCompactList}\small\item\em returns \mbox{\hyperlink{basic_data_types_True}{True}} if on the first element of the hash \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_hash_iterator_a60c35d8ea159a1f9b53c0b164094c7c0}{get\+Key}} () \begin{DoxyCompactList}\small\item\em returns the current key value or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \end{DoxyCompactList}\item auto \mbox{\hyperlink{class_qore_1_1_hash_iterator_a0d62ed2e642f1f9f0fc06cbd2d79b14b}{get\+Key\+Value}} () \begin{DoxyCompactList}\small\item\em returns the current value of the current hash key being iterated or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \end{DoxyCompactList}\item auto \mbox{\hyperlink{class_qore_1_1_hash_iterator_ac476d576e747b685d4284fb02a5cf83e}{get\+Value}} () \begin{DoxyCompactList}\small\item\em returns the current key value 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_hash_iterator_a1300d0cec84d5f08b89fdc3d18f1f229}{get\+Value\+Pair}} () \begin{DoxyCompactList}\small\item\em returns a hash with the current key and value (a hash with 2 keys\+: {\ttfamily \char`\"{}key\char`\"{}} and {\ttfamily \char`\"{}value\char`\"{}}) or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_hash_iterator_a40b7935be4791e186dba782e091084e5}{last}} () \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_iterator_ae1c8221cd1002edbb93ec41a333900ae}{next}} () \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}\item bool \mbox{\hyperlink{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}{prev}} () \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 \mbox{\hyperlink{class_qore_1_1_hash_iterator_ad7b5c2e35ee739f1ef3cbe9565f075ad}{reset}} () \begin{DoxyCompactList}\small\item\em Reset the iterator instance to its initial state. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_hash_iterator_a12d469ed0e4ba8b61b8a38fa97332ef1}{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 hashes. Call \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Hash\+Iterator\+::next()}} to iterate through the hash; do not use the iterator if \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Hash\+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_iterator_a9df83a19c89100056c875b2ca40f6ed3}{Hash\+Iterator\+::prev()}} instead of \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Hash\+Iterator\+::next()}} \begin{DoxyParagraph}{Example\+: Hash\+Iterator basic usage} \begin{DoxyCode}{0} \DoxyCodeLine{hash h = \{\textcolor{stringliteral}{"{}key1"{}}: 1, \textcolor{stringliteral}{"{}key2"{}}: 2,\};} \DoxyCodeLine{} \DoxyCodeLine{HashIterator 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}{"{}key1"{}}; getKeyValue: 1; getValue: 1; getValuePair: hash: (key : \textcolor{stringliteral}{"{}key1"{}}, value : 1)} \DoxyCodeLine{getKey: \textcolor{stringliteral}{"{}key2"{}}; getKeyValue: 2; getValue: 2; getValuePair: hash: (key : \textcolor{stringliteral}{"{}key2"{}}, value : 2)} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item In general, the \mbox{\hyperlink{class_qore_1_1_hash_iterator}{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_hash_reverse_iterator}{Hash\+Reverse\+Iterator}} \end{DoxySeeAlso} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_hash_iterator_a1fc56abc6eb066009a390ff11fe5b69d}\label{class_qore_1_1_hash_iterator_a1fc56abc6eb066009a390ff11fe5b69d}} \index{Qore::HashIterator@{Qore::HashIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily Qore\+::\+Hash\+Iterator\+::constructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates an empty hash iterator object. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*hash h = get\_hash\_or\_nothing();} \DoxyCodeLine{HashIterator hi(h);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_hash_iterator_a842d257239bb77f2989960dbe1ddabc9}\label{class_qore_1_1_hash_iterator_a842d257239bb77f2989960dbe1ddabc9}} \index{Qore::HashIterator@{Qore::HashIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily Qore\+::\+Hash\+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{HashIterator hi(h);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_hash_iterator_ae35efa6b6afd35bc56fdddd9d5622059}\label{class_qore_1_1_hash_iterator_ae35efa6b6afd35bc56fdddd9d5622059}} \index{Qore::HashIterator@{Qore::HashIterator}!copy@{copy}} \index{copy@{copy}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+Hash\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates a copy of the \mbox{\hyperlink{class_qore_1_1_hash_iterator}{Hash\+Iterator}} object, iterating the same object as the original and in the same position. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{HashIterator ni = i.copy();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_hash_iterator_adc2400ed775808e5ab8a3afd671c4428}\label{class_qore_1_1_hash_iterator_adc2400ed775808e5ab8a3afd671c4428}} \index{Qore::HashIterator@{Qore::HashIterator}!empty@{empty}} \index{empty@{empty}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{empty()}{empty()}} {\footnotesize\ttfamily bool Qore\+::\+Hash\+Iterator\+::empty (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns \mbox{\hyperlink{basic_data_types_True}{True}} if the hash is empty; \mbox{\hyperlink{basic_data_types_False}{False}} if not \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if the hash 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 hash 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_hash_iterator_a1d639332a9f27f97a830994b1a68ada2}\label{class_qore_1_1_hash_iterator_a1d639332a9f27f97a830994b1a68ada2}} \index{Qore::HashIterator@{Qore::HashIterator}!first@{first}} \index{first@{first}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{first()}{first()}} {\footnotesize\ttfamily bool Qore\+::\+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 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.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_object_reverse_iterator_a6f053540cbbc574c438e6201b713f7dd}{Qore\+::\+Object\+Reverse\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_ac7cf3e0eda0c8f4854e3dd6fab31a1ab}{Qore\+::\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_iterator_a60c35d8ea159a1f9b53c0b164094c7c0}\label{class_qore_1_1_hash_iterator_a60c35d8ea159a1f9b53c0b164094c7c0}} \index{Qore::HashIterator@{Qore::HashIterator}!getKey@{getKey}} \index{getKey@{getKey}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{getKey()}{getKey()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Hash\+Iterator\+::get\+Key (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} returns the current key value or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \begin{DoxyReturn}{Returns} the current key 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{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}+ \%y\(\backslash\)n"{}}, i.getKey());} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element \\ \hline {\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_hash_iterator_a0d62ed2e642f1f9f0fc06cbd2d79b14b}\label{class_qore_1_1_hash_iterator_a0d62ed2e642f1f9f0fc06cbd2d79b14b}} \index{Qore::HashIterator@{Qore::HashIterator}!getKeyValue@{getKeyValue}} \index{getKeyValue@{getKeyValue}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{getKeyValue()}{getKeyValue()}} {\footnotesize\ttfamily auto Qore\+::\+Hash\+Iterator\+::get\+Key\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} returns the current value of the current hash key being iterated or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \begin{DoxyReturn}{Returns} the current value of the current hash key being iterated 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}{"{}+ \%y\(\backslash\)n"{}}, i.getKeyValue());} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element \\ \hline {\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} \begin{DoxySince}{Since} Qore 0.\+8.\+6 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_hash_iterator_ac476d576e747b685d4284fb02a5cf83e}\label{class_qore_1_1_hash_iterator_ac476d576e747b685d4284fb02a5cf83e}} \index{Qore::HashIterator@{Qore::HashIterator}!getValue@{getValue}} \index{getValue@{getValue}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{getValue()}{getValue()}} {\footnotesize\ttfamily auto Qore\+::\+Hash\+Iterator\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}} returns the current key value or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid The current hash key can be returned with \mbox{\hyperlink{class_qore_1_1_hash_iterator_a60c35d8ea159a1f9b53c0b164094c7c0}{get\+Key()}}. \begin{DoxyReturn}{Returns} the current key 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{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{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 {\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_aa01374b285003faa21b045082063ac12}{Qore\+::\+Abstract\+Iterator}}. Reimplemented in \mbox{\hyperlink{class_qore_1_1_object_pair_reverse_iterator_aedf5e1075159bbf2f43dc20f56a18c80}{Qore\+::\+Object\+Pair\+Reverse\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_object_pair_iterator_a6f3fd6f1cd8d7d8d1d5909593acf048a}{Qore\+::\+Object\+Pair\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_object_key_reverse_iterator_a3434e0503dad1fd3f569ae330036f573}{Qore\+::\+Object\+Key\+Reverse\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_object_key_iterator_a7b936b687c054fda6f93b76ed04d5292}{Qore\+::\+Object\+Key\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_hash_pair_reverse_iterator_a90f26825378858c2020954104ab5bb1b}{Qore\+::\+Hash\+Pair\+Reverse\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_hash_pair_iterator_a7fbbc6dd431b481042d49eeb706b871e}{Qore\+::\+Hash\+Pair\+Iterator}}, \mbox{\hyperlink{class_qore_1_1_hash_key_reverse_iterator_a2c6cbbc478c54a908faf7766685b4645}{Qore\+::\+Hash\+Key\+Reverse\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_hash_key_iterator_a749d9db18178ea1f86aa721b3c37a770}{Qore\+::\+Hash\+Key\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_iterator_a1300d0cec84d5f08b89fdc3d18f1f229}\label{class_qore_1_1_hash_iterator_a1300d0cec84d5f08b89fdc3d18f1f229}} \index{Qore::HashIterator@{Qore::HashIterator}!getValuePair@{getValuePair}} \index{getValuePair@{getValuePair}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{getValuePair()}{getValuePair()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+Hash\+Iterator\+::get\+Value\+Pair (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} returns a hash with the current key and value (a hash with 2 keys\+: {\ttfamily \char`\"{}key\char`\"{}} and {\ttfamily \char`\"{}value\char`\"{}}) or throws an {\ttfamily INVALID-\/\+ITERATOR} exception if the iterator is invalid \begin{DoxyReturn}{Returns} a hash with the current key and value (a hash with 2 keys\+: {\ttfamily \char`\"{}key\char`\"{}} and {\ttfamily \char`\"{}value\char`\"{}}) 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}{"{}+ \%y\(\backslash\)n"{}}, i.getValuePair());} \DoxyCodeLine{\}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em INVALID-\/\+ITERATOR} & the iterator is not pointing at a valid element \\ \hline {\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} \begin{DoxySince}{Since} Qore 0.\+8.\+6 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_hash_iterator_a40b7935be4791e186dba782e091084e5}\label{class_qore_1_1_hash_iterator_a40b7935be4791e186dba782e091084e5}} \index{Qore::HashIterator@{Qore::HashIterator}!last@{last}} \index{last@{last}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{last()}{last()}} {\footnotesize\ttfamily bool Qore\+::\+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 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.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_object_reverse_iterator_a96a5d6b421ccbe6875ca2f3fbfe7576d}{Qore\+::\+Object\+Reverse\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_aec930a3efe298b98eeda8670c132dd8f}{Qore\+::\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}\label{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}} \index{Qore::HashIterator@{Qore::HashIterator}!next@{next}} \index{next@{next}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{next()}{next()}} {\footnotesize\ttfamily bool Qore\+::\+Hash\+Iterator\+::next (\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 = \%y\(\backslash\)n"{}}, i.getKey(), 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_object_reverse_iterator_a0c9460024246ef2742b9937cb0e3da4d}{Qore\+::\+Object\+Reverse\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a82746948d972de83d1ef179efc9e9c81}{Qore\+::\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}\label{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}} \index{Qore::HashIterator@{Qore::HashIterator}!prev@{prev}} \index{prev@{prev}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{prev()}{prev()}} {\footnotesize\ttfamily bool Qore\+::\+Hash\+Iterator\+::prev (\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 = \%y\(\backslash\)n"{}}, i.getKey(), 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_object_reverse_iterator_a8eb6d967f85d306e897e08deadd63c92}{Qore\+::\+Object\+Reverse\+Iterator}}, and \mbox{\hyperlink{class_qore_1_1_hash_reverse_iterator_a04c6aa78e4bcf4bd7fcd0a0d1964d427}{Qore\+::\+Hash\+Reverse\+Iterator}}. \mbox{\Hypertarget{class_qore_1_1_hash_iterator_ad7b5c2e35ee739f1ef3cbe9565f075ad}\label{class_qore_1_1_hash_iterator_ad7b5c2e35ee739f1ef3cbe9565f075ad}} \index{Qore::HashIterator@{Qore::HashIterator}!reset@{reset}} \index{reset@{reset}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{reset()}{reset()}} {\footnotesize\ttfamily Qore\+::\+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_hash_iterator_a12d469ed0e4ba8b61b8a38fa97332ef1}\label{class_qore_1_1_hash_iterator_a12d469ed0e4ba8b61b8a38fa97332ef1}} \index{Qore::HashIterator@{Qore::HashIterator}!valid@{valid}} \index{valid@{valid}!Qore::HashIterator@{Qore::HashIterator}} \doxysubsubsection{\texorpdfstring{valid()}{valid()}} {\footnotesize\ttfamily bool Qore\+::\+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}}.