Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 3736f276bb1ccfbcee6cb2d27b25d981 > files > 610

openscap-devel-0.5.7-1mdv2010.1.x86_64.rpm

\hypertarget{group__ITER}{
\section{Iterators \& collections}
\label{group__ITER}\index{Iterators \& collections@{Iterators \& collections}}
}


OpenScap iterators concept.  
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__ITER_gaea98dedf8ff9418609496bb11ff8c66c}{OSCAP\_\-FOREACH\_\-GENERIC}(itype, vtype, val, init\_\-val, code)
\begin{DoxyCompactList}\small\item\em Iterate over an array, given an iterator. \item\end{DoxyCompactList}\item 
\#define \hyperlink{group__ITER_ga252a13d8be22bb101a8732987eb4e828}{OSCAP\_\-FOREACH}(type, val, init\_\-val, code)~OSCAP\_\-FOREACH\_\-GENERIC(type, struct type $\ast$, val, init\_\-val, code)
\begin{DoxyCompactList}\small\item\em Iterate over an array, given an iterator. \item\end{DoxyCompactList}\item 
\#define \hyperlink{group__ITER_gafdd9cc9b1ae693c07dd4ff9727cfb019}{OSCAP\_\-FOREACH\_\-STR}(val, init\_\-val, code)~OSCAP\_\-FOREACH\_\-GENERIC(oscap\_\-string, const char $\ast$, val, init\_\-val, code)
\begin{DoxyCompactList}\small\item\em Iterate over an array of strings, given an iterator. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
OpenScap iterators concept. Any iterator name takes a form of {\ttfamily struct OBJECT\_\-iterator}, where {\ttfamily OBJECT} is a name of particular datatype the iterator iterates over.

Each iterator type defines several manipulation functions, namely:
\begin{DoxyItemize}
\item {\ttfamily OBJECT\_\-iterator\_\-has\_\-more} -\/ returns true if there is anything left to iterate over
\item {\ttfamily OBJECT\_\-iterator\_\-next} -\/ returns next item in the collection
\item {\ttfamily OBJECT\_\-iterator\_\-free} -\/ destroys the iterator
\end{DoxyItemize}

You can also use \hyperlink{group__ITER_ga252a13d8be22bb101a8732987eb4e828}{OSCAP\_\-FOREACH} convience macro. 

\subsection{Define Documentation}
\hypertarget{group__ITER_ga252a13d8be22bb101a8732987eb4e828}{
\index{ITER@{ITER}!OSCAP\_\-FOREACH@{OSCAP\_\-FOREACH}}
\index{OSCAP\_\-FOREACH@{OSCAP\_\-FOREACH}!ITER@{ITER}}
\subsubsection[{OSCAP\_\-FOREACH}]{\setlength{\rightskip}{0pt plus 5cm}\#define OSCAP\_\-FOREACH(type, \/  val, \/  init\_\-val, \/  code)~OSCAP\_\-FOREACH\_\-GENERIC(type, struct type $\ast$, val, init\_\-val, code)}}
\label{group__ITER_ga252a13d8be22bb101a8732987eb4e828}


Iterate over an array, given an iterator. 
\begin{DoxyParams}{Parameters}
\item[{\em type}]type of array elements (w/o the struct keyword) \item[{\em val}]name of an variable the member will be sequentially stored in \item[{\em init\_\-val}]initial member value (i.e. an iterator pointing to the start element) \item[{\em code}]code to be executed for each element the iterator hits \end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__ITER_gaea98dedf8ff9418609496bb11ff8c66c}{OSCAP\_\-FOREACH\_\-GENERIC} 
\end{DoxySeeAlso}
\hypertarget{group__ITER_gaea98dedf8ff9418609496bb11ff8c66c}{
\index{ITER@{ITER}!OSCAP\_\-FOREACH\_\-GENERIC@{OSCAP\_\-FOREACH\_\-GENERIC}}
\index{OSCAP\_\-FOREACH\_\-GENERIC@{OSCAP\_\-FOREACH\_\-GENERIC}!ITER@{ITER}}
\subsubsection[{OSCAP\_\-FOREACH\_\-GENERIC}]{\setlength{\rightskip}{0pt plus 5cm}\#define OSCAP\_\-FOREACH\_\-GENERIC(itype, \/  vtype, \/  val, \/  init\_\-val, \/  code)}}
\label{group__ITER_gaea98dedf8ff9418609496bb11ff8c66c}
{\bfseries Value:}
\begin{DoxyCode}
{                                                            \
        struct itype##_iterator *val##_iter = (init_val);        \
        vtype val;                                               \
        while (itype##_iterator_has_more(val##_iter)) {          \
            val = itype##_iterator_next(val##_iter);             \
            code                                                 \
        }                                                        \
        itype##_iterator_free(val##_iter);                       \
    }
\end{DoxyCode}


Iterate over an array, given an iterator. Execute {\itshape code\/} for each array member stored in {\itshape val\/}. \hypertarget{group__ITER_gafdd9cc9b1ae693c07dd4ff9727cfb019}{
\index{ITER@{ITER}!OSCAP\_\-FOREACH\_\-STR@{OSCAP\_\-FOREACH\_\-STR}}
\index{OSCAP\_\-FOREACH\_\-STR@{OSCAP\_\-FOREACH\_\-STR}!ITER@{ITER}}
\subsubsection[{OSCAP\_\-FOREACH\_\-STR}]{\setlength{\rightskip}{0pt plus 5cm}\#define OSCAP\_\-FOREACH\_\-STR(val, \/  init\_\-val, \/  code)~OSCAP\_\-FOREACH\_\-GENERIC(oscap\_\-string, const char $\ast$, val, init\_\-val, code)}}
\label{group__ITER_gafdd9cc9b1ae693c07dd4ff9727cfb019}


Iterate over an array of strings, given an iterator. 
\begin{DoxyParams}{Parameters}
\item[{\em val}]name of an variable the string will be sequentially stored in \item[{\em init\_\-val}]initial member value (i.e. an iterator pointing to the start element) \item[{\em code}]code to be executed for each string the iterator hits \end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__ITER_gaea98dedf8ff9418609496bb11ff8c66c}{OSCAP\_\-FOREACH\_\-GENERIC} 
\end{DoxySeeAlso}