\chapter{Eina\+\_\+\+Iterator usage}
\hypertarget{eina_iterator_01_c}{}\label{eina_iterator_01_c}\index{Eina\_Iterator usage@{Eina\_Iterator usage}}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc\ -\/g\ eina\_iterator\_01.c\ -\/o\ eina\_iterator\_01\ \`{}pkg-\/config\ -\/-\/cflags\ -\/-\/libs\ eina`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{print\_one(\textcolor{keyword}{const}\ \textcolor{keywordtype}{void}\ *container\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *data,\ \textcolor{keywordtype}{void}\ *fdata\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}},\ (\textcolor{keywordtype}{char}*)data);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{print\_eina\_container(\mbox{\hyperlink{struct__Eina__Iterator}{Eina\_Iterator}}\ *it)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Iterator__Group_gaff9c1e02361afa3abcede2fd4056d286}{eina\_iterator\_foreach}}(it,\ print\_one,\ NULL);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)n"{}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int}\ argc\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{char}\ **argv\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *strings[]\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}unintersting\ string"{}},\ \textcolor{stringliteral}{"{}husker"{}},\ \textcolor{stringliteral}{"{}starbuck"{}},\ \textcolor{stringliteral}{"{}husker"{}}}
\DoxyCodeLine{\ \ \ \};}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *more\_strings[]\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}very\ unintersting\ string"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}what\ do\ your\ hear?"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}nothing\ but\ the\ rain"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}then\ grab\ your\ gun\ and\ bring\ the\ cat\ in"{}}}
\DoxyCodeLine{\ \ \ \};}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eina__Array}{Eina\_Array}}\ *array;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eina__List}{Eina\_List}}\ *list\ =\ NULL;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eina__Iterator}{Eina\_Iterator}}\ *it;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ *uninteresting;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ array\ =\ \mbox{\hyperlink{group__Eina__Array__Group_gaf4b5844225b5359a617744210a5ed6ff}{eina\_array\_new}}(4);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ 4;\ i++)}
\DoxyCodeLine{\ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__Array__Group_ga97ac1fe353f4cd7a9762af4d4db7b9c4}{eina\_array\_push}}(array,\ strings[i]);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ list\ =\ \mbox{\hyperlink{group__Eina__List__Group_ga625698a383dda8fc0db245a1c7608c49}{eina\_list\_append}}(list,\ more\_strings[i]);}
\DoxyCodeLine{\ \ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ it\ =\ \mbox{\hyperlink{group__Eina__Array__Group_ga1bcab88d8e913489a7ed28bb4cac6218}{eina\_array\_iterator\_new}}(array);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Eina__Iterator__Group_gad870f9b1d5fb8892cb9623ad0e7f75b2}{eina\_iterator\_next}}(it,\ (\textcolor{keywordtype}{void}\ **)\&uninteresting))}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\ \ \ print\_eina\_container(it);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Array__Group_ga7fa7e2cdcfb739140d5c5a5044086ce1}{eina\_array\_free}}(\mbox{\hyperlink{group__Eina__Iterator__Group_gab41f34ca186b6b6508291dad138f7062}{eina\_iterator\_container\_get}}(it));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Iterator__Group_ga50da005e8d26c0a043d0d1c025bc9008}{eina\_iterator\_free}}(it);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ it\ =\ \mbox{\hyperlink{group__Eina__List__Group_gaaad791a6b6ca783926082e976ce486b9}{eina\_list\_iterator\_new}}(list);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{group__Eina__Iterator__Group_gad870f9b1d5fb8892cb9623ad0e7f75b2}{eina\_iterator\_next}}(it,\ (\textcolor{keywordtype}{void}\ **)\&uninteresting))}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\ \ \ print\_eina\_container(it);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Iterator__Group_ga50da005e8d26c0a043d0d1c025bc9008}{eina\_iterator\_free}}(it);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__List__Group_ga82a1bfa543e21853f9ea3ff88dd1250b}{eina\_list\_free}}(list);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 