Eet Data Handling Library Public A\+PI Calls.

These routines are used for Eet Library interaction.

\begin{DoxyDate}{Date}
2000 (created)
\end{DoxyDate}
\hypertarget{evil_main_toc}{}\doxysection{Table of Contents}\label{evil_main_toc}
\begin{DoxyItemize}
\item \mbox{\hyperlink{eet_main_eet_main_intro}{Introduction}} \item \mbox{\hyperlink{eet_main_eet_main_compiling}{How to compile}} \item \mbox{\hyperlink{eet_main_eet_main_next_steps}{Next Steps}} \item \mbox{\hyperlink{eet_main_eet_main_intro_example}{Introductory Examples}}\end{DoxyItemize}
\hypertarget{eet_main_eet_main_intro}{}\doxysection{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}{}\doxysection{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 \mbox{\hyperlink{pkgconfig}{pkgconfig}}\hypertarget{eet_main_eet_main_next_steps}{}\doxysection{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\textquotesingle{}d recommend you to take a while to learn \mbox{\hyperlink{group__Eina}{Eina}} as it is very convenient and optimized, and Eet provides integration with it.

Recommended reading\+:

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__Eet__File__Group}{Eet File Main Functions}} to know the basics to open and save files. \item \mbox{\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}{}\doxysection{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\textquotesingle{}t show all of the capabilities of Eet, but it serves to illustrate its simplicity.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{// gcc -\/o eet-\/basic eet-\/basic.c `pkg-\/config -\/-\/cflags -\/-\/libs eet`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{Eet_8h}{Eet.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__File__Group_ga8d9779184a9870c1a225f1f40c76e8a7}{Eet\_File}} *ef;}
\DoxyCodeLine{   \textcolor{keywordtype}{char} *ret;}
\DoxyCodeLine{   \textcolor{keywordtype}{int} size;}
\DoxyCodeLine{   \textcolor{keywordtype}{char} *entries[] =}
\DoxyCodeLine{   \{}
\DoxyCodeLine{      \textcolor{stringliteral}{"Entry 1"},}
\DoxyCodeLine{      \textcolor{stringliteral}{"Big text string here compared to others"},}
\DoxyCodeLine{      \textcolor{stringliteral}{"Eet is cool"}}
\DoxyCodeLine{   \};}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__Group_ga9903687bfa20fe9a9e59d4c1d213e89a}{eet\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{// blindly open an file for output and write strings with their NUL char}}
\DoxyCodeLine{   ef = \mbox{\hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}}(\textcolor{stringliteral}{"test.eet"}, \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a8f395f56fba48be007c65be51d799ee9}{EET\_FILE\_MODE\_WRITE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"Entry 1"}, entries[0], strlen(entries[0]) + 1, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"Entry 2"}, entries[1], strlen(entries[1]) + 1, 1);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__File__Group_ga682d04715f0e11380c460814c4a9bd21}{eet\_write}}(ef, \textcolor{stringliteral}{"Entry 3"}, entries[2], strlen(entries[2]) + 1, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{// open the file again and blindly get the entries we wrote}}
\DoxyCodeLine{   ef = \mbox{\hyperlink{group__Eet__File__Group_ga5f55956b860aa2c77af9b1a880c4c256}{eet\_open}}(\textcolor{stringliteral}{"test.eet"}, \mbox{\hyperlink{group__Eet__File__Group_ggaa8e1a7af50fefaf15eb2f69543d24998a416f7e9a76b8131a44bbeedb13060c81}{EET\_FILE\_MODE\_READ}});}
\DoxyCodeLine{   ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"Entry 1"}, \&size);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"\%s\(\backslash\)n"}, ret);}
\DoxyCodeLine{   free(ret);}
\DoxyCodeLine{   ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"Entry 2"}, \&size);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"\%s\(\backslash\)n"}, ret);}
\DoxyCodeLine{   free(ret);}
\DoxyCodeLine{   ret = \mbox{\hyperlink{group__Eet__File__Group_gac13cdf7782d1e513f5b1abcc529962f4}{eet\_read}}(ef, \textcolor{stringliteral}{"Entry 3"}, \&size);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"\%s\(\backslash\)n"}, ret);}
\DoxyCodeLine{   free(ret);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__File__Group_ga1675fef1f6012c1e02ae313d13dc3e03}{eet\_close}}(ef);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eet__Group_gacbc7583179399d3b3e7b003e911f866f}{eet\_shutdown}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\end{DoxyCodeInclude}


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