Tizen Native API
5.5
|
Eet Data Handling Library Public API Calls.
These routines are used for Eet Library interaction.
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.
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 pkg-config
script outputs. For example:
Compiling C or C++ files into object files:
gcc -c -o main.o main.c `pkg-config --cflags eet`
Linking object files into a binary executable:
gcc -o my_application main.o `pkg-config --libs eet`
See pkgconfig
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 Eina as it is very convenient and optimized, and Eet provides integration with it.
Recommended reading:
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.
//Compile with: // gcc -o eet-basic eet-basic.c `pkg-config --cflags --libs eet` #include <Eet.h> int main(void) { Eet_File *ef; char *ret; int size; char *entries[] = { "Entry 1", "Big text string here compared to others", "Eet is cool" }; eet_init(); // blindly open an file for output and write strings with their NUL char ef = eet_open("test.eet", EET_FILE_MODE_WRITE); eet_write(ef, "Entry 1", entries[0], strlen(entries[0]) + 1, 0); eet_write(ef, "Entry 2", entries[1], strlen(entries[1]) + 1, 1); eet_write(ef, "Entry 3", entries[2], strlen(entries[2]) + 1, 0); eet_close(ef); // open the file again and blindly get the entries we wrote ef = eet_open("test.eet", EET_FILE_MODE_READ); ret = eet_read(ef, "Entry 1", &size); printf("%s\n", ret); free(ret); ret = eet_read(ef, "Entry 2", &size); printf("%s\n", ret); free(ret); ret = eet_read(ef, "Entry 3", &size); printf("%s\n", ret); free(ret); eet_close(ef); eet_shutdown(); }
More examples can be found at eet_examples.