\doxysection{eina\+\_\+value\+\_\+02.\+c}
\hypertarget{eina_value_02_8c-example}{}\label{eina_value_02_8c-example}
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc\ eina\_value\_02.c\ -\/o\ eina\_value\_02\ \`{}pkg-\/config\ -\/-\/cflags\ -\/-\/libs\ eina`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Eina__Value__Struct__Desc}{Eina\_Value\_Struct\_Desc}}\ *V1\_DESC\ =\ NULL;}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Eina__Value__Struct__Desc}{Eina\_Value\_Struct\_Desc}}\ *V2\_DESC\ =\ NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{void}\ value\_init(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\_My\_Struct\_V1\ \{}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordtype}{int}\ param1;}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordtype}{char}\ param2;}
\DoxyCodeLine{\ \ \ \}\ My\_Struct\_V1;}
\DoxyCodeLine{}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Eina__Value__Struct__Member}{Eina\_Value\_Struct\_Member}}\ v1\_members[]\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \textcolor{comment}{//\ no\ eina\_value\_type\ as\ they\ are\ not\ constant\ initializers,\ see\ below.}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Value__Struct__Group_ga139206ef35b0b76e87eef56a202c0ae9}{EINA\_VALUE\_STRUCT\_MEMBER}}(NULL,\ My\_Struct\_V1,\ param1),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Value__Struct__Group_ga139206ef35b0b76e87eef56a202c0ae9}{EINA\_VALUE\_STRUCT\_MEMBER}}(NULL,\ My\_Struct\_V1,\ param2)}
\DoxyCodeLine{\ \ \ \};}
\DoxyCodeLine{\ \ \ v1\_members[0].\mbox{\hyperlink{struct__Eina__Value__Struct__Member_a615cdf08597bd18623c8c7daec7b4641}{type}}\ =\ \mbox{\hyperlink{group__Eina__Value__Group_ga17974fd9ab773a3efefd591ffde58f77}{EINA\_VALUE\_TYPE\_INT}};}
\DoxyCodeLine{\ \ \ v1\_members[1].\mbox{\hyperlink{struct__Eina__Value__Struct__Member_a615cdf08597bd18623c8c7daec7b4641}{type}}\ =\ \mbox{\hyperlink{group__Eina__Value__Group_ga0d54e0b952b44b7ac4f2fd573f7839c0}{EINA\_VALUE\_TYPE\_CHAR}};}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Eina__Value__Struct__Desc}{Eina\_Value\_Struct\_Desc}}\ v1\_desc\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Value__Struct__Group_gae76aada4965672ce991f1f41baf71975}{EINA\_VALUE\_STRUCT\_DESC\_VERSION}},}
\DoxyCodeLine{\ \ \ \ \ NULL,\ \textcolor{comment}{//\ no\ special\ operations}}
\DoxyCodeLine{\ \ \ \ \ v1\_members,}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga7c1b6f81660b4e30516169e9e7d3261c}{EINA\_C\_ARRAY\_LENGTH}}(v1\_members),}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keyword}{sizeof}(My\_Struct\_V1)}
\DoxyCodeLine{\ \ \ \};}
\DoxyCodeLine{\ \ \ V1\_DESC\ =\ \&v1\_desc;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\_My\_Struct\_V2\ \{}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordtype}{int}\ param1;}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordtype}{char}\ param2;}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordtype}{int}\ param3;}
\DoxyCodeLine{\ \ \ \}\ My\_Struct\_V2;}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Eina__Value__Struct__Member}{Eina\_Value\_Struct\_Member}}\ v2\_members[]\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \textcolor{comment}{//\ no\ eina\_value\_type\ as\ they\ are\ not\ constant\ initializers,\ see\ below.}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Value__Struct__Group_ga139206ef35b0b76e87eef56a202c0ae9}{EINA\_VALUE\_STRUCT\_MEMBER}}(NULL,\ My\_Struct\_V2,\ param1),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Value__Struct__Group_ga139206ef35b0b76e87eef56a202c0ae9}{EINA\_VALUE\_STRUCT\_MEMBER}}(NULL,\ My\_Struct\_V2,\ param2),}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Value__Struct__Group_ga139206ef35b0b76e87eef56a202c0ae9}{EINA\_VALUE\_STRUCT\_MEMBER}}(NULL,\ My\_Struct\_V2,\ param3)}
\DoxyCodeLine{\ \ \ \};}
\DoxyCodeLine{\ \ \ v2\_members[0].\mbox{\hyperlink{struct__Eina__Value__Struct__Member_a615cdf08597bd18623c8c7daec7b4641}{type}}\ =\ \mbox{\hyperlink{group__Eina__Value__Group_ga17974fd9ab773a3efefd591ffde58f77}{EINA\_VALUE\_TYPE\_INT}};}
\DoxyCodeLine{\ \ \ v2\_members[1].\mbox{\hyperlink{struct__Eina__Value__Struct__Member_a615cdf08597bd18623c8c7daec7b4641}{type}}\ =\ \mbox{\hyperlink{group__Eina__Value__Group_ga0d54e0b952b44b7ac4f2fd573f7839c0}{EINA\_VALUE\_TYPE\_CHAR}};}
\DoxyCodeLine{\ \ \ v2\_members[2].\mbox{\hyperlink{struct__Eina__Value__Struct__Member_a615cdf08597bd18623c8c7daec7b4641}{type}}\ =\ \mbox{\hyperlink{group__Eina__Value__Group_ga17974fd9ab773a3efefd591ffde58f77}{EINA\_VALUE\_TYPE\_INT}};}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Eina__Value__Struct__Desc}{Eina\_Value\_Struct\_Desc}}\ v2\_desc\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Value__Struct__Group_gae76aada4965672ce991f1f41baf71975}{EINA\_VALUE\_STRUCT\_DESC\_VERSION}},}
\DoxyCodeLine{\ \ \ \ \ NULL,\ \textcolor{comment}{//\ no\ special\ operations}}
\DoxyCodeLine{\ \ \ \ \ v2\_members,}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga7c1b6f81660b4e30516169e9e7d3261c}{EINA\_C\_ARRAY\_LENGTH}}(v2\_members),}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keyword}{sizeof}(My\_Struct\_V2)}
\DoxyCodeLine{\ \ \ \};}
\DoxyCodeLine{\ \ \ V2\_DESC\ =\ \&v2\_desc;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{void}\ rand\_init(\mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}}\ *v)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (v-\/>type\ !=\ \mbox{\hyperlink{group__Eina__Value__Group_ga8147143699c5f5a686415090080d3f9e}{EINA\_VALUE\_TYPE\_STRUCT}})}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ eina\_value\_struct\_set(v,\ \textcolor{stringliteral}{"{}param1"{}},\ rand());}
\DoxyCodeLine{\ \ \ eina\_value\_struct\_set(v,\ \textcolor{stringliteral}{"{}param2"{}},\ rand()\ \%\ 256);}
\DoxyCodeLine{\ \ \ eina\_value\_struct\_set(v,\ \textcolor{stringliteral}{"{}param3"{}},\ rand());}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{void}\ my\_struct\_use(\mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}}\ *params)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ p1,\ p3;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ p2;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ eina\_value\_struct\_get(params,\ \textcolor{stringliteral}{"{}param1"{}},\ \&p1);}
\DoxyCodeLine{\ \ \ eina\_value\_struct\_get(params,\ \textcolor{stringliteral}{"{}param2"{}},\ \&p2);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}param1:\ \%d\(\backslash\)nparam2:\ \%c\(\backslash\)n"{}},\ p1,\ p2);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (eina\_value\_struct\_get(params,\ \textcolor{stringliteral}{"{}param3"{}},\ \&p3))}
\DoxyCodeLine{\ \ \ \ \ printf(\textcolor{stringliteral}{"{}param3:\ \%d\(\backslash\)n"{}},\ p3);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ main(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}\ **argv)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ (void)argc;}
\DoxyCodeLine{\ \ \ (void)argv;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}}\ *v1,\ *v2;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}();}
\DoxyCodeLine{\ \ \ value\_init();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ v1\ =\ \mbox{\hyperlink{group__Eina__Value__Struct__Group_gaeda31142675d09af1863096a4f4ac707}{eina\_value\_struct\_new}}(V1\_DESC);}
\DoxyCodeLine{\ \ \ v2\ =\ \mbox{\hyperlink{group__Eina__Value__Struct__Group_gaeda31142675d09af1863096a4f4ac707}{eina\_value\_struct\_new}}(V2\_DESC);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ rand\_init(v1);}
\DoxyCodeLine{\ \ \ my\_struct\_use(v1);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ rand\_init(v2);}
\DoxyCodeLine{\ \ \ my\_struct\_use(v2);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Value__Value__Group_ga27a121e20a7109d5eae7203fc0f54850}{eina\_value\_free}}(v1);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Value__Value__Group_ga27a121e20a7109d5eae7203fc0f54850}{eina\_value\_free}}(v2);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 