
\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc eina\_value\_01.c -o eina\_value\_01 `pkg-config --cflags --libs eina`}

\textcolor{preprocessor}{#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   (void)argc;
   (void)argv;
   \mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}} v;
   \textcolor{keywordtype}{int} i;
   \textcolor{keywordtype}{char} *newstr;

   \mbox{\hyperlink{group__Eina__Main__Group_gafee4bfc0e509b6ffed6598edf6f4b3de}{eina\_init}}();

   \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\_value\_setup}}(&v, \mbox{\hyperlink{group__Eina__Value__Group_ga17974fd9ab773a3efefd591ffde58f77}{EINA\_VALUE\_TYPE\_INT}});
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga9a1407c953694c3d6f40ab01ebe9a294}{eina\_value\_set}}(&v, 123);
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga6f088fe6c6127d808cdf214b355cbdeb}{eina\_value\_get}}(&v, &i);
   printf(\textcolor{stringliteral}{"v=%d\(\backslash\)n"}, i);

   newstr = \mbox{\hyperlink{group__Eina__Value__Value__Group_ga8f34b6d6639654dd88cd197c9def78a3}{eina\_value\_to\_string}}(&v);
   printf(\textcolor{stringliteral}{"v as string: %s\(\backslash\)n"}, newstr);
   free(newstr); \textcolor{comment}{// it was allocated by eina\_value\_to\_string()}
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\_value\_flush}}(&v); \textcolor{comment}{// destroy v contents, will not use anymore}

   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *s;
   \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\_value\_setup}}(&v, \mbox{\hyperlink{group__Eina__Value__Group_ga916f76c8d5ffd4c3ee3c322a54efd0b7}{EINA\_VALUE\_TYPE\_STRING}});
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga9a1407c953694c3d6f40ab01ebe9a294}{eina\_value\_set}}(&v, \textcolor{stringliteral}{"My string"});
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga6f088fe6c6127d808cdf214b355cbdeb}{eina\_value\_get}}(&v, &s);
   printf(\textcolor{stringliteral}{"v=%s (pointer: %p)\(\backslash\)n"}, s, s);

   newstr = \mbox{\hyperlink{group__Eina__Value__Value__Group_ga8f34b6d6639654dd88cd197c9def78a3}{eina\_value\_to\_string}}(&v);
   printf(\textcolor{stringliteral}{"v as string: %s (pointer: %p)\(\backslash\)n"}, newstr, newstr);
   free(newstr); \textcolor{comment}{// it was allocated by eina\_value\_to\_string()}
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\_value\_flush}}(&v); \textcolor{comment}{// destroy v contents, string 's' is not valid anymore!}

   \mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}} otherv;
   \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\_value\_setup}}(&otherv, \mbox{\hyperlink{group__Eina__Value__Group_ga916f76c8d5ffd4c3ee3c322a54efd0b7}{EINA\_VALUE\_TYPE\_STRING}});
   \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\_value\_setup}}(&v, \mbox{\hyperlink{group__Eina__Value__Group_ga17974fd9ab773a3efefd591ffde58f77}{EINA\_VALUE\_TYPE\_INT}});

   \textcolor{comment}{// convert from int to string:}
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga9a1407c953694c3d6f40ab01ebe9a294}{eina\_value\_set}}(&v, 123);
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga86f91748c90652df59e3ef38bf54949d}{eina\_value\_convert}}(&v, &otherv);
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga6f088fe6c6127d808cdf214b355cbdeb}{eina\_value\_get}}(&otherv, &s);
   printf(\textcolor{stringliteral}{"otherv=%s\(\backslash\)n"}, s);

   \textcolor{comment}{// and the other way around!}
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga9a1407c953694c3d6f40ab01ebe9a294}{eina\_value\_set}}(&otherv, \textcolor{stringliteral}{"33"});
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga86f91748c90652df59e3ef38bf54949d}{eina\_value\_convert}}(&otherv, &v);
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga6f088fe6c6127d808cdf214b355cbdeb}{eina\_value\_get}}(&v, &i);
   printf(\textcolor{stringliteral}{"v=%d\(\backslash\)n"}, i);

   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\_value\_flush}}(&otherv);
   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\_value\_flush}}(&v);
   \mbox{\hyperlink{group__Eina__Main__Group_ga2c8b4020427108a30c44707af22c99d3}{eina\_shutdown}}();
\}
\end{DoxyCodeInclude}
 