Eet Data Handling Library Public A\+P\+I Calls

These routines are used for Eet Library interaction

\begin{DoxyDate}{Date}
2000 (created)
\end{DoxyDate}
\hypertarget{eina_cxx_main_toc}{}\section{Table of Contents}\label{eina_cxx_main_toc}
\begin{DoxyItemize}
\item \hyperlink{eet_main_eet_main_intro}{Introduction} \item \hyperlink{eet_main_eet_main_compiling}{How to compile} \item \hyperlink{eet_main_eet_main_next_steps}{Next Steps} \item \hyperlink{eet_main_eet_main_intro_example}{Introductory Examples}\end{DoxyItemize}
\hypertarget{eet_main_eet_main_intro}{}\section{Introduction}\label{eet_main_eet_main_intro}
It is a tiny library designed to write an arbitrary set of chunks of data to a file and optionally compress each chunk (very much like a zip file) and allow fast random-\/access reading of the file later on. It does not do zip as a zip itself has more complexity than is needed, and it was much simpler to implement this once here.

Eet is extremely fast, small and simple. Eet files can be very small and highly compressed, making them very optimal for just sending across the internet without having to archive, compress or decompress and install them. They allow for lightning-\/fast random-\/access reads once created, making them perfect for storing data that is written once (or rarely) and read many times, but the program does not want to have to read it all in at once.

It also can encode and decode data structures in memory, as well as image data for saving to Eet files or sending across the network to other machines, or just writing to arbitrary files on the system. All data is encoded in a platform independent way and can be written and read by any architecture.\hypertarget{eet_main_eet_main_compiling}{}\section{How to compile}\label{eet_main_eet_main_compiling}
Eet is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the {\ttfamily pkg-\/config} script outputs. For example\+:

Compiling C or C++ files into object files\+:

\begin{DoxyVerb}gcc -c -o main.o main.c `pkg-config --cflags eet`
\end{DoxyVerb}


Linking object files into a binary executable\+:

\begin{DoxyVerb}gcc -o my_application main.o `pkg-config --libs eet`
\end{DoxyVerb}


See \hyperlink{pkgconfig}{pkgconfig}\hypertarget{eet_main_eet_main_next_steps}{}\section{Next Steps}\label{eet_main_eet_main_next_steps}
After you understood what Eet is and installed it in your system you should proceed understanding the programming interface. We'd recommend you to take a while to learn \hyperlink{group__Eina}{Eina} as it is very convenient and optimized, and Eet provides integration with it.

Recommended reading\+:

\begin{DoxyItemize}
\item \hyperlink{group__Eet__File__Group}{Eet File Main Functions} to know the basics to open and save files. \item \hyperlink{group__Eet__Data__Group}{Eet Data Serialization} to know the convenient way to serialize and parse your data structures automatically. Just create your descriptors and let Eet do the work for you.\end{DoxyItemize}
\hypertarget{eet_main_eet_main_intro_example}{}\section{Introductory Examples}\label{eet_main_eet_main_intro_example}
Here is a simple example on how to use Eet to save a series of strings to a file and load them again. The advantage of using Eet over just fprintf() and fscanf() is that not only can these entries be strings, they need no special parsing to handle delimiter characters or escaping, they can be binary data, image data, data structures containing integers, strings, other data structures, linked lists and much more, without the programmer having to worry about parsing, and best of all, Eet is very fast.

This is just a very simple example that doesn't show all of the capabilities of Eet, but it serves to illustrate its simplicity.


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

\textcolor{preprocessor}{#include <\hyperlink{Eet_8h}{Eet.h}>}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File} *ef;
   \textcolor{keywordtype}{char} *ret;
   \textcolor{keywordtype}{int} size;
   \textcolor{keywordtype}{char} *entries[] =
   \{
      \textcolor{stringliteral}{"Entry 1"},
      \textcolor{stringliteral}{"Big text string here compared to others"},
      \textcolor{stringliteral}{"Eet is cool"}
   \};

   \hyperlink{group__Eet__Group_ga9903687bfa20fe9a9e59d4c1d213e89a}{eet\_init}();

   \textcolor{comment}{// blindly open an file for output and write strings with their NUL char}
   ef = \hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}(\textcolor{stringliteral}{"test.eet"}, \hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a8f395f56fba48be007c65be51d799ee9}{EET\_FILE\_MODE\_WRITE});
   \hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}(ef, \textcolor{stringliteral}{"Entry 1"}, entries[0], strlen(entries[0]) + 1, 0);
   \hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}(ef, \textcolor{stringliteral}{"Entry 2"}, entries[1], strlen(entries[1]) + 1, 1);
   \hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}(ef, \textcolor{stringliteral}{"Entry 3"}, entries[2], strlen(entries[2]) + 1, 0);
   \hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}(ef);

   \textcolor{comment}{// open the file again and blindly get the entries we wrote}
   ef = \hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}(\textcolor{stringliteral}{"test.eet"}, \hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a416f7e9a76b8131a44bbeedb13060c81}{EET\_FILE\_MODE\_READ});
   ret = \hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}(ef, \textcolor{stringliteral}{"Entry 1"}, &size);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, ret);
   free(ret);
   ret = \hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}(ef, \textcolor{stringliteral}{"Entry 2"}, &size);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, ret);
   free(ret);
   ret = \hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}(ef, \textcolor{stringliteral}{"Entry 3"}, &size);
   printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, ret);
   free(ret);
   \hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}(ef);

   \hyperlink{group__Eet__Group_gacbc7583179399d3b3e7b003e911f866f}{eet\_shutdown}();
\}

\end{DoxyCodeInclude}


More examples can be found at \hyperlink{eet_examples}{E\+E\+T Examples}.