\hypertarget{class_qore_1_1_object_key_iterator}{}\doxysection{Qore\+::Object\+Key\+Iterator Class Reference} \label{class_qore_1_1_object_key_iterator}\index{Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}} This class an iterator class for objectes. Inheritance diagram for Qore\+::Object\+Key\+Iterator\+: % FIG 0 \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{class_qore_1_1_object_key_iterator_ae577a2ee92a114efc8454aac9e1b131d}{constructor}} (object o) \begin{DoxyCompactList}\small\item\em Creates the object iterator object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_object_key_iterator_a08650070f581778ec7d1bc0da7271535}{constructor}} () \begin{DoxyCompactList}\small\item\em Creates an empty object iterator object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_object_key_iterator_a2e52586c92f4bbe0bd3b56f23f266c5c}{copy}} () \begin{DoxyCompactList}\small\item\em Creates a copy of the \mbox{\hyperlink{class_qore_1_1_object_key_iterator}{Object\+Key\+Iterator}} object, iterating the same object as the original and in the same position. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_object_key_iterator_a7b936b687c054fda6f93b76ed04d5292}{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}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} This class an iterator class for objectes. Call \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Object\+Key\+Iterator\+::next()}} to iterate through the object; do not use the iterator if \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Object\+Key\+Iterator\+::next()}} returns \mbox{\hyperlink{basic_data_types_False}{False}}. A object can be iterated in reverse order by calling \mbox{\hyperlink{class_qore_1_1_hash_iterator_a9df83a19c89100056c875b2ca40f6ed3}{Object\+Key\+Iterator\+::prev()}} instead of \mbox{\hyperlink{class_qore_1_1_hash_iterator_ae1c8221cd1002edbb93ec41a333900ae}{Object\+Key\+Iterator\+::next()}} \begin{DoxyParagraph}{Example\+: Object\+Key\+Iterator basic usage} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keyword}{class }Class1 \{} \DoxyCodeLine{ public \{} \DoxyCodeLine{ int attr1;} \DoxyCodeLine{ date attr2;} \DoxyCodeLine{ \}} \DoxyCodeLine{ constructor() \{} \DoxyCodeLine{ attr1 = 1;} \DoxyCodeLine{ attr2 = \mbox{\hyperlink{group__date__and__time__functions_ga23f067a4f82596346d4fef09782e1945}{now}}();} \DoxyCodeLine{ \}} \DoxyCodeLine{\}} \DoxyCodeLine{Class1 o();} \DoxyCodeLine{} \DoxyCodeLine{ObjectKeyIterator it(o);} \DoxyCodeLine{\textcolor{keywordflow}{while} (it.next()) \{} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}iter: \%n\(\backslash\)n"{}}, it.getValue());} \DoxyCodeLine{\}} \DoxyCodeLine{} \DoxyCodeLine{iter: \textcolor{stringliteral}{"{}attr1"{}}} \DoxyCodeLine{iter: \textcolor{stringliteral}{"{}attr2"{}}} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item In general, the \mbox{\hyperlink{class_qore_1_1_object_key_iterator}{Object\+Key\+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_object_key_reverse_iterator}{Object\+Key\+Reverse\+Iterator}} \end{DoxySeeAlso} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_object_key_iterator_a08650070f581778ec7d1bc0da7271535}\label{class_qore_1_1_object_key_iterator_a08650070f581778ec7d1bc0da7271535}} \index{Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily Qore\+::\+Object\+Key\+Iterator\+::constructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates an empty object iterator object. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*object o = get\_object\_or\_nothing();} \DoxyCodeLine{ObjectKeyIterator i(o);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_object_key_iterator_ae577a2ee92a114efc8454aac9e1b131d}\label{class_qore_1_1_object_key_iterator_ae577a2ee92a114efc8454aac9e1b131d}} \index{Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}!constructor@{constructor}} \index{constructor@{constructor}!Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily Qore\+::\+Object\+Key\+Iterator\+::constructor (\begin{DoxyParamCaption}\item[{object}]{o }\end{DoxyParamCaption})} Creates the object iterator object. \begin{DoxyParams}{Parameters} {\em o} & the object to iterate\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ObjectKeyIterator i(h);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_object_key_iterator_a2e52586c92f4bbe0bd3b56f23f266c5c}\label{class_qore_1_1_object_key_iterator_a2e52586c92f4bbe0bd3b56f23f266c5c}} \index{Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}!copy@{copy}} \index{copy@{copy}!Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+Object\+Key\+Iterator\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates a copy of the \mbox{\hyperlink{class_qore_1_1_object_key_iterator}{Object\+Key\+Iterator}} object, iterating the same object as the original and in the same position. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{ObjectKeyIterator ni = i.copy();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_object_key_iterator_a7b936b687c054fda6f93b76ed04d5292}\label{class_qore_1_1_object_key_iterator_a7b936b687c054fda6f93b76ed04d5292}} \index{Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}!getValue@{getValue}} \index{getValue@{getValue}!Qore::ObjectKeyIterator@{Qore::ObjectKeyIterator}} \doxysubsubsection{\texorpdfstring{getValue()}{getValue()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+Object\+Key\+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 \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{foreach string key \textcolor{keywordflow}{in} (object.keyIterator())} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}key: \%s\(\backslash\)n"{}}, key);} \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} Reimplemented from \mbox{\hyperlink{class_qore_1_1_hash_iterator_ac476d576e747b685d4284fb02a5cf83e}{Qore\+::\+Hash\+Iterator}}.