diff --git a/doc/eet/cipher.rst b/doc/eet/cipher.rst
new file mode 100644
index 0000000..44d83f3
--- /dev/null
+++ b/doc/eet/cipher.rst
@@ -0,0 +1,6 @@
+.. currentmodule:: efl.eet
+
+.. _Eet_Cipher_Group:
+
+Cipher, Identity and Protection Mechanisms
+==========================================
diff --git a/doc/eet/data.rst b/doc/eet/data.rst
new file mode 100644
index 0000000..b40f020
--- /dev/null
+++ b/doc/eet/data.rst
@@ -0,0 +1,10 @@
+.. currentmodule:: efl.eet
+
+.. _Eet_Data_Group:
+
+Eet Data Serialization
+=======================
+
+.. autoclass:: EetDataDescriptor
+
+.. autoclass:: EetDataDescriptorClass
diff --git a/doc/eet/eet.rst b/doc/eet/eet.rst
new file mode 100644
index 0000000..a300777
--- /dev/null
+++ b/doc/eet/eet.rst
@@ -0,0 +1,17 @@
+:mod:`efl.eet` Module
+=======================
+
+.. automodule:: efl.eet
+
+.. autofunction:: init
+
+.. autofunction:: shutdown
+
+.. autofunction:: clearcache
+
+.. autoexception:: EetError
+
+.. toctree::
+
+ file
+ cipher
diff --git a/doc/eet/file.rst b/doc/eet/file.rst
new file mode 100644
index 0000000..2572f2b
--- /dev/null
+++ b/doc/eet/file.rst
@@ -0,0 +1,21 @@
+.. currentmodule:: efl.eet
+
+.. _Eet_File_Group:
+
+Eet File Main Functions
+=======================
+
+:class:`efl.eet.EetDictionary` Class
+------------------------------------
+
+.. autoclass:: EetDictionary
+
+:class:`efl.eet.EetEntry` Class
+--------------------------------
+
+.. autoclass:: EetEntry
+
+:class:`efl.eet.EetFile` Class
+-------------------------------
+
+.. autoclass:: EetFile
diff --git a/doc/index.rst b/doc/index.rst
index ac42901..b4c68e4 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -42,6 +42,11 @@ EO
.. toctree:: eo/eo.rst
+Eet
+---
+
+.. toctree:: eet/eet
+
Ecore
-----
diff --git a/efl/eet/connection.pxi b/efl/eet/connection.pxi
new file mode 100644
index 0000000..eb5946f
--- /dev/null
+++ b/efl/eet/connection.pxi
@@ -0,0 +1,140 @@
+"""
+
+@typedef Eet_Connection
+Opaque handle to track paquet for a specific connection.
+
+
+"""
+typedef struct _Eet_Connection Eet_Connection;
+
+"""
+
+@typedef Eet_Read_Cb
+Called back when an :ref:`Eet_Data_Group` has been received completely and could be used.
+
+
+"""
+typedef Eina_Bool Eet_Read_Cb (const void *eet_data, size_t size, void *user_data);
+
+"""
+
+@typedef Eet_Write_Cb
+Called back when a packet containing :ref:`Eet_Data_Group` data is ready to be send.
+
+
+"""
+typedef Eina_Bool Eet_Write_Cb (const void *data, size_t size, void *user_data);
+
+"""
+
+Instanciate a new connection to track.
+:param eet_read_cb: Function to call when one Eet_Data packet has been fully assemble.
+:param eet_write_cb: Function to call when one Eet_Data packet is ready to be send over the wire.
+:param user_data: Pointer provided to both functions to be used as a context handler.
+:return: NULL on failure, or a valid Eet_Connection handler.
+
+For every connection to track you will need a separate Eet_Connection provider.
+
+:since: 1.2.4
+
+"""
+EAPI Eet_Connection *
+eet_connection_new(Eet_Read_Cb *eet_read_cb,
+ Eet_Write_Cb *eet_write_cb,
+ const void *user_data);
+
+"""
+
+Process a raw packet received over the link
+:param conn: Connection handler to track.
+:param data: Raw data packet.
+:param size: The size of that packet.
+:return: 0 on complete success, any other value indicate where in the stream it got wrong (It could be before that packet).
+
+Every time you receive a packet related to your connection, you should pass
+it to that function so that it could process and assemble packet has you
+receive it. It will automatically call Eet_Read_Cb when one is fully received.
+
+:since: 1.2.4
+
+"""
+EAPI int
+eet_connection_received(Eet_Connection *conn,
+ const void *data,
+ size_t size);
+
+"""
+
+Tell if the Eet_Connection as received some partial data.
+:param conn: Connection handler to request.
+:return: EINA_TRUE if there is some data pending inside, EINA_FALSE otherwise.
+
+Eet_Connection buffer data until the received data can be unserialized correctly. This
+function let you know if there is some data inside that buffer waiting for more data to
+be received before being processed.
+
+:since: 1.7
+
+"""
+EAPI Eina_Bool eet_connection_empty(Eet_Connection *conn);
+
+"""
+
+Convert a complex structure and prepare it to be send.
+:param conn: Connection handler to track.
+:param edd: The data descriptor to use when encoding.
+:param data_in: The pointer to the struct to encode into data.
+:param cipher_key: The key to use as cipher.
+:return: EINA_TRUE if the data where correctly send, EINA_FALSE if they don't.
+
+This function serialize data_in with edd, assemble the packet and call
+Eet_Write_Cb when ready. The data passed Eet_Write_Cb are temporary allocated
+and will vanish just after the return of the callback.
+
+:see: eet_data_descriptor_encode_cipher
+
+:since: 1.2.4
+
+"""
+EAPI Eina_Bool
+eet_connection_send(Eet_Connection *conn,
+ Eet_Data_Descriptor *edd,
+ const void *data_in,
+ const char *cipher_key);
+
+"""
+
+Convert a Eet_Node tree and prepare it to be send.
+:param conn: Connection handler to track.
+:param node: The data tree to use when encoding.
+:param cipher_key: The key to use as cipher.
+:return: EINA_TRUE if the data where correctly send, EINA_FALSE if they don't.
+
+This function serialize node, assemble the packet and call
+Eet_Write_Cb when ready. The data passed Eet_Write_Cb are temporary allocated
+and will vanish just after the return of the callback.
+
+:see: eet_data_node_encode_cipher
+
+:since: 1.2.4
+
+"""
+EAPI Eina_Bool
+eet_connection_node_send(Eet_Connection *conn,
+ Eet_Node *node,
+ const char *cipher_key);
+
+"""
+
+Close a connection and lost its track.
+:param conn: Connection handler to close.
+:param on_going: Signal if a partial packet wasn't completed.
+:return: the user_data passed to both callback.
+
+:since: 1.2.4
+
+"""
+EAPI void *
+eet_connection_close(Eet_Connection *conn,
+ Eina_Bool *on_going);
+
diff --git a/efl/eet/data_descriptor.pxi b/efl/eet/data_descriptor.pxi
new file mode 100644
index 0000000..97b76e2
--- /dev/null
+++ b/efl/eet/data_descriptor.pxi
@@ -0,0 +1,653 @@
+
+
+#define EET_T_UNKNOW 0 # Unknown data encoding type
+#define EET_T_CHAR 1 # Data type: char
+#define EET_T_SHORT 2 # Data type: short
+#define EET_T_INT 3 # Data type: int
+#define EET_T_LONG_LONG 4 # Data type: long long
+#define EET_T_FLOAT 5 # Data type: float
+#define EET_T_DOUBLE 6 # Data type: double
+#define EET_T_UCHAR 7 # Data type: unsigned char
+#define EET_T_USHORT 8 # Data type: unsigned short
+#define EET_T_UINT 9 # Data type: unsigned int
+#define EET_T_ULONG_LONG 10 # Data type: unsigned long long
+#define EET_T_STRING 11 # Data type: char *
+#define EET_T_INLINED_STRING 12 # Data type: char * (but compressed inside the resulting eet)
+#define EET_T_NULL 13 # Data type: (void *) (only use it if you know why)
+#define EET_T_F32P32 14 # Data type: fixed point 32.32
+#define EET_T_F16P16 15 # Data type: fixed point 16.16
+#define EET_T_F8P24 16 # Data type: fixed point 8.24
+#define EET_T_VALUE 17 # Data type: pointer to Eina_Value :since: 1.8
+#define EET_T_LAST 18 # Last data type
+
+#define EET_G_UNKNOWN 100 # Unknown group data encoding type
+#define EET_G_ARRAY 101 # Fixed size array group type
+#define EET_G_VAR_ARRAY 102 # Variable size array group type
+#define EET_G_LIST 103 # Linked list group type
+#define EET_G_HASH 104 # Hash table group type
+#define EET_G_UNION 105 # Union group type
+#define EET_G_VARIANT 106 # Selectable subtype group
+#define EET_G_UNKNOWN_NESTED 107 # Unknown nested group type. :since: 1.8
+#define EET_G_LAST 108 # Last group type
+
+#define EET_I_LIMIT 128 # Other type exist but are reserved for internal purpose.
+
+
+cdef class EetDataDescriptor(object):
+
+ """
+
+ Opaque handle that have information on a type members.
+
+ Descriptors are created using an #Eet_Data_Descriptor_Class, and they
+ describe the contents of the structure that will be serialized by Eet.
+ Not all members need be described by it, just those that should be handled
+ by Eet. This way it's possible to have one structure with both data to be
+ saved to a file, like application configuration, and runtime information
+ that would be meaningless to store, but is appropriate to keep together
+ during the program execution.
+ The members are added by means of
+ EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB(),
+ EET_DATA_DESCRIPTOR_ADD_LIST(), EET_DATA_DESCRIPTOR_ADD_HASH()
+ or eet_data_descriptor_element_add().
+
+ :see: eet_data_descriptor_stream_new()
+ :see: eet_data_descriptor_file_new()
+ :see: eet_data_descriptor_free()
+
+ """
+
+ cdef Eet_Data_Descriptor *edd
+
+ def __init__(self, cls):
+ """
+
+ This function creates a new data descriptor and returns a handle to the
+ new data descriptor. On creation it will be empty, containing no
+ contents describing anything other than the shell of the data structure.
+ :param eddc: The class from where to create the data descriptor.
+ :return: A handle to the new data descriptor.
+
+ You add structure members to the data descriptor using the macros
+ EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
+ EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
+ adding to the description.
+
+ Once you have described all the members of a struct you want loaded or
+ saved, eet can load and save those members for you, encode them into
+ endian-independent serialised data chunks for transmission across a
+ network or more.
+
+ This function specially ignores str_direct_alloc and str_direct_free. It
+ is useful when the eet_data you are reading doesn't have a dictionary,
+ like network stream or IPC. It also mean that all string will be
+ allocated and duplicated in memory.
+
+ :since: 1.2.3
+
+ """
+ self.edd = eet_data_descriptor_stream_new(cls.eddc)
+
+ def file_new(self, cls):
+ """
+
+ This function creates a new data descriptor and returns a handle to the
+ new data descriptor. On creation it will be empty, containing no
+ contents describing anything other than the shell of the data structure.
+ :param eddc: The class from where to create the data descriptor.
+ :return: A handle to the new data descriptor.
+
+ You add structure members to the data descriptor using the macros
+ EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
+ EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
+ adding to the description.
+
+ Once you have described all the members of a struct you want loaded or
+ saved, eet can load and save those members for you, encode them into
+ endian-independent serialised data chunks for transmission across a
+ a network or more.
+
+ This function uses str_direct_alloc and str_direct_free. It is useful
+ when the eet_data you are reading come from a file and have a
+ dictionary. This will reduce memory use and improve the possibility for
+ the OS to page this string out.
+
+ However, the load speed and memory saving comes with some drawbacks to
+ keep in mind. If you never modify the contents of the structures loaded
+ from the file, all you need to remember is that closing the eet file
+ will make the strings go away. On the other hand, should you need to
+ free a string, before doing so you have to verify that it's not part of
+ the eet dictionary. You can do this in the following way, assuming @p ef
+ is a valid Eet_File and @p str is a string loaded from said file.
+
+ @code
+ void eet_string_free(Eet_File *ef, const char *str)
+ {
+ Eet_Dictionary *dict = eet_dictionary_get(ef);
+ if (dict && eet_dictionary_string_check(dict, str))
+ {
+ // The file contains a dictionary and the given string is a part of
+ // of it, so we can't free it, just return.
+ return;
+ }
+ // We assume eina_stringshare was used on the descriptor
+ eina_stringshare_del(str);
+ }
+ @endcode
+
+ :since: 1.2.3
+
+ """
+ self.edd = eet_data_descriptor_file_new(cls.eddc)
+
+ def free(self):
+ """
+
+ This function frees a data descriptor when it is not needed anymore.
+ :param edd: The data descriptor to free.
+
+ This function takes a data descriptor handle as a parameter and frees all
+ data allocated for the data descriptor and the handle itself. After this
+ call the descriptor is no longer valid.
+
+ :since: 1.0.0
+
+ """
+ eet_data_descriptor_free(self.edd)
+
+ property name:
+ """
+
+ This function returns the name of a data descriptor.
+
+ :since: 1.8.0
+
+ """
+ return _ctouni(eet_data_descriptor_name_get(self.edd)
+
+
+ def decode(self, data_in, size_in):
+ """
+
+ Decode a data structure from an arbitrary location in memory.
+ :param edd: The data descriptor to use when decoding.
+ :param data_in: The pointer to the data to decode into a struct.
+ :param size_in: The size of the data pointed to in bytes.
+ :return: NULL on failure, or a valid decoded struct pointer on success.
+
+ This function will decode a data structure that has been encoded using
+ eet_data_descriptor_encode(), and return a data structure with all its
+ elements filled out, if successful, or NULL on failure.
+
+ The data to be decoded is stored at the memory pointed to by @p data_in,
+ and is described by the descriptor pointed to by @p edd. The data size is
+ passed in as the value to @p size_in, ande must be greater than 0 to
+ succeed.
+
+ This function is useful for decoding data structures delivered to the
+ application by means other than an eet file, such as an IPC or socket
+ connection, raw files, shared memory etc.
+
+ Please see eet_data_read() for more information.
+
+ @see eet_data_descriptor_decode_cipher()
+
+ :since: 1.0.0
+
+ """
+ EAPI void *
+ eet_data_descriptor_decode(Eet_Data_Descriptor *edd,
+ const void *data_in,
+ int size_in);
+
+ def encode(self, data_in):
+ """
+
+ Encode a dsata struct to memory and return that encoded data.
+ :param edd: The data descriptor to use when encoding.
+ :param data_in: The pointer to the struct to encode into data.
+ :param size_ret: pointer to the an int to be filled with the decoded size.
+ :return: NULL on failure, or a valid encoded data chunk on success.
+
+ This function takes a data structutre in memory and encodes it into a
+ serialised chunk of data that can be decoded again by
+ eet_data_descriptor_decode(). This is useful for being able to transmit
+ data structures across sockets, pipes, IPC or shared file mechanisms,
+ without having to worry about memory space, machine type, endianness etc.
+
+ The parameter @p edd must point to a valid data descriptor, and
+ @p data_in must point to the right data structure to encode. If not, the
+ encoding may fail.
+
+ On success a non NULL valid pointer is returned and what @p size_ret
+ points to is set to the size of this decoded data, in bytes. When the
+ encoded data is no longer needed, call free() on it. On failure NULL is
+ returned and what @p size_ret points to is set to 0.
+
+ Please see eet_data_write() for more information.
+
+ @see eet_data_descriptor_encode_cipher()
+
+ :since: 1.0.0
+
+ """
+ EAPI void *
+ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
+ const void *data_in,
+ int *size_ret);
+
+ def decode_cipher(self, data_in, cipher_key, size_in):
+ """
+
+ Decode a data structure from an arbitrary location in memory
+ using a cipher.
+ :param edd: The data descriptor to use when decoding.
+ :param data_in: The pointer to the data to decode into a struct.
+ :param cipher_key: The key to use as cipher.
+ :param size_in: The size of the data pointed to in bytes.
+ :return: NULL on failure, or a valid decoded struct pointer on success.
+
+ This function will decode a data structure that has been encoded using
+ eet_data_descriptor_encode(), and return a data structure with all its
+ elements filled out, if successful, or NULL on failure.
+
+ The data to be decoded is stored at the memory pointed to by @p data_in,
+ and is described by the descriptor pointed to by @p edd. The data size is
+ passed in as the value to @p size_in, ande must be greater than 0 to
+ succeed.
+
+ This function is useful for decoding data structures delivered to the
+ application by means other than an eet file, such as an IPC or socket
+ connection, raw files, shared memory etc.
+
+ Please see eet_data_read() for more information.
+
+ @see eet_data_descriptor_decode()
+
+ :since: 1.0.0
+
+ """
+ EAPI void *
+ eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd,
+ const void *data_in,
+ const char *cipher_key,
+ int size_in);
+
+ def encode_cipher(self, data_in, cipher_key):
+ """
+
+ Encode a data struct to memory and return that encoded data
+ using a cipher.
+ :param edd: The data descriptor to use when encoding.
+ :param data_in: The pointer to the struct to encode into data.
+ :param cipher_key: The key to use as cipher.
+ :param size_ret: pointer to the an int to be filled with the decoded size.
+ :return: NULL on failure, or a valid encoded data chunk on success.
+
+ This function takes a data structutre in memory and encodes it into a
+ serialised chunk of data that can be decoded again by
+ eet_data_descriptor_decode(). This is useful for being able to transmit
+ data structures across sockets, pipes, IPC or shared file mechanisms,
+ without having to worry about memory space, machine type, endianess etc.
+
+ The parameter @p edd must point to a valid data descriptor, and
+ @p data_in must point to the right data structure to encode. If not, the
+ encoding may fail.
+
+ On success a non NULL valid pointer is returned and what @p size_ret
+ points to is set to the size of this decoded data, in bytes. When the
+ encoded data is no longer needed, call free() on it. On failure NULL is
+ returned and what @p size_ret points to is set to 0.
+
+ Please see eet_data_write() for more information.
+
+ @see eet_data_descriptor_encode()
+
+ :since: 1.0.0
+
+ """
+ EAPI void *
+ eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd,
+ const void *data_in,
+ const char *cipher_key,
+ int *size_ret);
+
+
+ def add_basic(self, struct_type, name, member, type):
+ """
+
+ Add a basic data element to a data descriptor.
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param type: The type of the member to encode.
+
+ This macro is a convenience macro provided to add a member to
+ the data descriptor @p edd. The type of the structure is
+ provided as the @p struct_type parameter (for example: struct
+ my_struct). The @p name parameter defines a string that will be
+ used to uniquely name that member of the struct (it is suggested
+ to use the struct member itself). The @p member parameter is
+ the actual struct member itself (for example: values), and @p type is the
+ basic data type of the member which must be one of: EET_T_CHAR, EET_T_SHORT,
+ EET_T_INT, EET_T_LONG_LONG, EET_T_FLOAT, EET_T_DOUBLE, EET_T_UCHAR,
+ EET_T_USHORT, EET_T_UINT, EET_T_ULONG_LONG or EET_T_STRING.
+
+ :since: 1.0.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type)
+
+ def add_sub(self, struct_type, name, member, subtype):
+ """
+
+ Add a sub-element type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param subtype: The type of sub-type struct to add.
+
+ This macro lets you easily add a sub-type (a struct that's pointed to
+ by this one). All the parameters are the same as for
+ EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the exception.
+ This must be the data descriptor of the struct that is pointed to by
+ this element.
+
+ :since: 1.0.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype)
+
+ def add_sub_nested(self, struct_type, name, member, subtype):
+ """
+
+ Add a nested sub-element type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param subtype: The type of sub-type struct to add.
+
+ This macro lets you easily add a sub-type: a struct that is nested into
+ this one. If your data is pointed by this element instead of being nested,
+ you should use EET_DATA_DESCRIPTOR_ADD_SUB().
+ All the parameters are the same as for EET_DATA_DESCRIPTOR_ADD_SUB().
+
+ :since: 1.8.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(edd, struct_type, name, member, subtype)
+
+ def add_list(self, struct_type, name, member, subtype):
+ """
+
+ Add a linked list type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param subtype: The type of linked list member to add.
+
+ This macro lets you easily add a linked list of other data types. All the
+ parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
+ @p subtype being the exception. This must be the data descriptor of the
+ element that is in each member of the linked list to be stored.
+
+ :since: 1.0.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype)
+
+ def add_list_string(self, struct_type, name, member):
+ """
+
+ Add a linked list of string to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+
+ This macro lets you easily add a linked list of char *. All the
+ parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC().
+
+ :since: 1.5.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd, struct_type, name, member)
+
+ def add_hash(self, struct_type, name, member, subtype):
+ """
+
+ Add a hash type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param subtype: The type of hash member to add.
+
+ This macro lets you easily add a hash of other data types. All the
+ parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
+ @p subtype being the exception. This must be the data descriptor of the
+ element that is in each member of the hash to be stored.
+ The hash keys must be strings.
+
+ :since: 1.0.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype)
+
+ def add_hash_string(self, struct_type, name, member):
+ """
+
+ Add a hash of string to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+
+ This macro lets you easily add a hash of string elements. All the
+ parameters are the same as for EET_DATA_DESCRIPTOR_ADD_HASH().
+
+ :since: 1.3.4
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_HASH_STRING(edd, struct_type, name, member)
+
+ def add_basic_array(self, struct_type, name, member, type):
+ """
+
+ Add an array of basic data elements to a data descriptor.
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param type: The type of the member to encode.
+
+ This macro lets you easily add a fixed size array of basic data
+ types. All the parameters are the same as for
+ EET_DATA_DESCRIPTOR_ADD_BASIC().
+ The array must be defined with a fixed size in the declaration of the
+ struct containing it.
+
+ :since: 1.5.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY(edd, struct_type, name, member, type)
+
+ def add_basic_var_array(self, struct_type, name, member, type):
+ """
+
+ Add a variable array of basic data elements to a data descriptor.
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param type: The type of the member to encode.
+
+ This macro lets you easily add a variable size array of basic data
+ types. All the parameters are the same as for
+ EET_DATA_DESCRIPTOR_ADD_BASIC(). This assumes you have
+ a struct member (of type EET_T_INT) called member_count (note the
+ _count appended to the member) that holds the number of items in
+ the array. This array will be allocated separately to the struct it
+ is in.
+
+ :since: 1.6.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY(edd, struct_type, name, member, type)
+
+ def add_array(self, struct_type, name, member, subtype):
+ """
+
+ Add a fixed size array type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param subtype: The type of hash member to add.
+
+ This macro lets you easily add a fixed size array of other data
+ types. All the parameters are the same as for
+ EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the
+ exception. This must be the data descriptor of the element that
+ is in each member of the array to be stored.
+ The array must be defined with a fixed size in the declaration of the
+ struct containing it.
+
+ :since: 1.0.2
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype)
+
+ def add_var_array(self, struct_type, name, member, subtype):
+ """
+
+ Add a variable size array type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param subtype: The type of hash member to add.
+
+ This macro lets you easily add a variable size array of other data
+ types. All the parameters are the same as for
+ EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the
+ exception. This must be the data descriptor of the element that
+ is in each member of the array to be stored. This assumes you have
+ a struct member (of type EET_T_INT) called member_count (note the
+ _count appended to the member) that holds the number of items in
+ the array. This array will be allocated separately to the struct it
+ is in.
+
+ :since: 1.0.2
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, subtype)
+
+ def add_var_array_string(self, struct_type, name, member):
+ """
+
+ Add a variable size array type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+
+ This macro lets you easily add a variable size array of strings. All
+ the parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC().
+
+ :since: 1.4.0
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY_STRING(edd, struct_type, name, member)
+
+ def add_union(self, struct_type, name, member, type_member, unified_type):
+ """
+
+ Add an union type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param type_member: The member that give hints on what is in the union.
+ :param unified_type: Describe all possible type the union could handle.
+
+ This macro lets you easily add an union with a member that specify what is inside.
+ The @p unified_type is an Eet_Data_Descriptor, but only the entry that match the name
+ returned by type_get will be used for each serialized data. The type_get and type_set
+ callback of unified_type should be defined.
+
+ :since: 1.2.4
+ :see: Eet_Data_Descriptor_Class
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_UNION(edd, struct_type, name, member, type_member, unified_type)
+
+ def add_variant(self, struct_type, name, member, type_member, unified_type):
+ """
+
+ Add a automatically selectable type to a data descriptor
+ :param edd: The data descriptor to add the type to.
+ :param struct_type: The type of the struct.
+ :param name: The string name to use to encode/decode this member
+ (must be a constant global and never change).
+ :param member: The struct member itself to be encoded.
+ :param type_member: The member that give hints on what is in the union.
+ :param unified_type: Describe all possible type the union could handle.
+
+ This macro lets you easily define what the content of @p member points to depending of
+ the content of @p type_member. The type_get and type_set callback of unified_type should
+ be defined. If the the type is not know at the time of restoring it, eet will still call
+ type_set of @p unified_type but the pointer will be set to a serialized binary representation
+ of what eet know. This make it possible, to save this pointer again by just returning the string
+ given previously and telling it by setting unknow to EINA_TRUE.
+
+ :since: 1.2.4
+ :see: Eet_Data_Descriptor_Class
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_VARIANT(edd, struct_type, name, member, type_member, unified_type)
+
+ def add_mapping(self, name, subtype):
+ """
+
+ Add a mapping to a data descriptor that will be used by union, variant or inherited type
+ :param unified_type: The data descriptor to add the mapping to.
+ :param name: The string name to get/set type.
+ :param subtype: The matching data descriptor.
+
+ :since: 1.2.4
+ :see: Eet_Data_Descriptor_Class
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_MAPPING(unified_type, name, subtype)
+
+ def add_mapping_basic(self, name, basic_type):
+ """
+
+ Add a mapping of a basic type to a data descriptor that will be used by a union type.
+ :param unified_type: The data descriptor to add the mapping to.
+ :param name: The string name to get/set type.
+ :param basic_type: The matching basic type.
+
+ :since: 1.8
+ :see: Eet_Data_Descriptor_Class
+
+ """
+ EET_DATA_DESCRIPTOR_ADD_MAPPING_BASIC(unified_type, name, basic_type)
diff --git a/efl/eet/data_descriptor_class.pxi b/efl/eet/data_descriptor_class.pxi
new file mode 100644
index 0000000..a32fbeb
--- /dev/null
+++ b/efl/eet/data_descriptor_class.pxi
@@ -0,0 +1,176 @@
+
+
+"""
+
+@def EET_DATA_DESCRIPTOR_CLASS_VERSION
+The version of #Eet_Data_Descriptor_Class at the time of the
+distribution of the sources. One should define this to its
+version member so it is compatible with abi changes, or at least
+will not crash with them.
+
+"""
+#define EET_DATA_DESCRIPTOR_CLASS_VERSION 4
+
+
+
+"""
+
+@typedef Eet_Data_Descriptor_Class
+
+Instructs Eet about memory management for different needs under
+serialization and parse process.
+
+"""
+typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
+
+typedef int (*Eet_Descriptor_Hash_Foreach_Callback_Callback)(void *h, const char *k, void *dt, void *fdt);
+
+typedef void * (*Eet_Descriptor_Mem_Alloc_Callback)(size_t size);
+typedef void (*Eet_Descriptor_Mem_Free_Callback)(void *mem);
+typedef char * (*Eet_Descriptor_Str_Alloc_Callback)(const char *str);
+typedef void (*Eet_Descriptor_Str_Free_Callback)(const char *str);
+typedef void * (*Eet_Descriptor_List_Next_Callback)(void *l);
+typedef void * (*Eet_Descriptor_List_Append_Callback)(void *l, void *d);
+typedef void * (*Eet_Descriptor_List_Data_Callback)(void *l);
+typedef void * (*Eet_Descriptor_List_Free_Callback)(void *l);
+typedef void (*Eet_Descriptor_Hash_Foreach_Callback)(void *h, Eet_Descriptor_Hash_Foreach_Callback_Callback func, void *fdt);
+typedef void * (*Eet_Descriptor_Hash_Add_Callback)(void *h, const char *k, void *d);
+typedef void (*Eet_Descriptor_Hash_Free_Callback)(void *h);
+typedef char * (*Eet_Descriptor_Str_Direct_Alloc_Callback)(const char *str);
+typedef void (*Eet_Descriptor_Str_Direct_Free_Callback)(const char *str);
+typedef const char * (*Eet_Descriptor_Type_Get_Callback)(const void *data, Eina_Bool *unknow);
+typedef Eina_Bool (*Eet_Descriptor_Type_Set_Callback)(const char *type, void *data, Eina_Bool unknow);
+typedef void * (*Eet_Descriptor_Array_Alloc_Callback)(size_t size);
+typedef void (*Eet_Descriptor_Array_Free_Callback)(void *mem);
+"""
+
+@struct _Eet_Data_Descriptor_Class
+
+Instructs Eet about memory management for different needs under
+serialization and parse process.
+
+The list and hash methods match the Eina API, so for a more detailed
+reference on them, look at the Eina_List and Eina_Hash documentation,
+respectively.
+For the most part these will be used with the standard Eina functions,
+so using EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET() and
+EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET() will set up everything
+accordingly.
+
+"""
+struct _Eet_Data_Descriptor_Class
+{
+ int version; # ABI version. Should always be set to #EET_DATA_DESCRIPTOR_CLASS_VERSION
+ const char *name; # Name of the user data type to be serialized
+ int size; # Size in bytes of the user data type to be serialized
+ struct
+ {
+ Eet_Descriptor_Mem_Alloc_Callback mem_alloc; # how to allocate memory (usually malloc())
+ Eet_Descriptor_Mem_Free_Callback mem_free; # how to free memory (usually free())
+ Eet_Descriptor_Str_Alloc_Callback str_alloc; # how to allocate a string
+ Eet_Descriptor_Str_Free_Callback str_free; # how to free a string
+ Eet_Descriptor_List_Next_Callback list_next; # how to iterate to the next element of a list. Receives and should return the list node.
+ Eet_Descriptor_List_Append_Callback list_append; # how to append data @p d to list which head node is @p l
+ Eet_Descriptor_List_Data_Callback list_data; # retrieves the data from node @p l
+ Eet_Descriptor_List_Free_Callback list_free; # free all the nodes from the list which head node is @p l
+ Eet_Descriptor_Hash_Foreach_Callback hash_foreach; # iterates over all elements in the hash @p h in no specific order
+ Eet_Descriptor_Hash_Add_Callback hash_add; # add a new data @p d with key @p k in hash @p h
+ Eet_Descriptor_Hash_Free_Callback hash_free; # free all entries from the hash @p h
+ Eet_Descriptor_Str_Direct_Alloc_Callback str_direct_alloc; # how to allocate a string directly from file backed/mmaped region pointed by @p str
+ Eet_Descriptor_Str_Direct_Free_Callback str_direct_free; # how to free a string returned by str_direct_alloc
+ Eet_Descriptor_Type_Get_Callback type_get; # get the type, as used in the union or variant mapping, that should be used to store the given data into the eet file.
+ Eet_Descriptor_Type_Set_Callback type_set; # called when loading a mapped type with the given @p type used to describe the type in the descriptor
+ Eet_Descriptor_Array_Alloc_Callback array_alloc; # how to allocate memory for array (usually malloc())
+ Eet_Descriptor_Array_Free_Callback array_free; # how to free memory for array (usually free())
+ } func;
+};
+
+
+
+
+"""
+
+This function is an helper that set all the parameters of an
+Eet_Data_Descriptor_Class correctly when you use Eina data type
+with a stream.
+:param eddc: The Eet_Data_Descriptor_Class you want to set.
+:param eddc_size: The size of the Eet_Data_Descriptor_Class at the compilation time.
+:param name: The name of the structure described by this class.
+:param size: The size of the structure described by this class.
+:return: EINA_TRUE if the structure was correctly set (The only
+ reason that could make it fail is if you did give wrong
+ parameter).
+
+@note Unless there's a very specific reason to use this function directly,
+the EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET macro is recommended.
+
+:since: 1.2.3
+
+"""
+EAPI Eina_Bool
+eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
+ unsigned int eddc_size,
+ const char *name,
+ int size);
+
+"""
+
+This macro is an helper that set all the parameter of an
+Eet_Data_Descriptor_Class correctly when you use Eina data type
+with stream.
+:param clas: The Eet_Data_Descriptor_Class you want to set.
+:param type: The type of the structure described by this class.
+:return: EINA_TRUE if the structure was correctly set (The only
+ reason that could make it fail is if you did give wrong
+ parameter).
+
+:see: eet_data_descriptor_stream_new
+:since: 1.2.3
+
+"""
+#define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(clas, type) \
+ (eet_eina_stream_data_descriptor_class_set(clas, sizeof (*(clas)), # type, sizeof(type)))
+
+"""
+
+This function is an helper that set all the parameter of an
+Eet_Data_Descriptor_Class correctly when you use Eina data type
+with a file.
+:param eddc: The Eet_Data_Descriptor_Class you want to set.
+:param eddc_size: The size of the Eet_Data_Descriptor_Class at the compilation time.
+:param name: The name of the structure described by this class.
+:param size: The size of the structure described by this class.
+:return: EINA_TRUE if the structure was correctly set (The only
+ reason that could make it fail is if you did give wrong
+ parameter).
+
+@note Unless there's a very specific reason to use this function directly,
+the EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET macro is recommended.
+
+:since: 1.2.3
+
+"""
+EAPI Eina_Bool
+eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc,
+ unsigned int eddc_size,
+ const char *name,
+ int size);
+
+"""
+
+This macro is an helper that set all the parameter of an
+Eet_Data_Descriptor_Class correctly when you use Eina data type
+with file.
+:param clas: The Eet_Data_Descriptor_Class you want to set.
+:param type: The type of the structure described by this class.
+:return: EINA_TRUE if the structure was correctly set (The only
+ reason that could make it fail is if you did give wrong
+ parameter).
+
+:see: eet_data_descriptor_file_new
+:since: 1.2.3
+
+"""
+#define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(clas, type) \
+ (eet_eina_file_data_descriptor_class_set(clas, sizeof (*(clas)), # type, sizeof(type)))
+
diff --git a/efl/eet/data_utils.pxi b/efl/eet/data_utils.pxi
new file mode 100644
index 0000000..06263b9
--- /dev/null
+++ b/efl/eet/data_utils.pxi
@@ -0,0 +1,622 @@
+"""
+
+Decode Image data header only to get information.
+:param data: The encoded pixel data.
+:param size: The size, in bytes, of the encoded pixel data.
+:param w: A pointer to the unsigned int to hold the width in pixels.
+:param h: A pointer to the unsigned int to hold the height in pixels.
+:param alpha: A pointer to the int to hold the alpha flag.
+:param compress: A pointer to the int to hold the compression amount.
+:param quality: A pointer to the int to hold the quality amount.
+:param lossy: A pointer to the int to hold the lossiness flag.
+:return: 1 on success, 0 on failure.
+
+This function works exactly like eet_data_image_header_read(), but instead
+of reading from an Eet file, it takes the buffer of size @p size pointed
+by @p data, which must be a valid Eet encoded image.
+
+On success the function returns 1 indicating the header was read and
+decoded properly, or 0 on failure.
+
+@see eet_data_image_header_read()
+@see eet_data_image_header_decode_cipher()
+
+:since: 1.0.0
+
+"""
+EAPI int
+eet_data_image_header_decode(const void *data,
+ int size,
+ unsigned int *w,
+ unsigned int *h,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
+
+"""
+
+Decode Image data into pixel data.
+:param data: The encoded pixel data.
+:param size: The size, in bytes, of the encoded pixel data.
+:param w: A pointer to the unsigned int to hold the width in pixels.
+:param h: A pointer to the unsigned int to hold the height in pixels.
+:param alpha: A pointer to the int to hold the alpha flag.
+:param compress: A pointer to the int to hold the compression amount.
+:param quality: A pointer to the int to hold the quality amount.
+:param lossy: A pointer to the int to hold the lossiness flag.
+:return: The image pixel data decoded
+
+This function takes encoded pixel data and decodes it into raw RGBA
+pixels on success.
+
+It works exactly like eet_data_image_read(), but it takes the encoded
+data in the @p data buffer of size @p size, instead of reading from a file.
+All the others parameters are also the same.
+
+On success the function returns a pointer to the image data decoded. The
+calling application is responsible for calling free() on the image data
+when it is done with it. On failure NULL is returned and the parameter
+values may not contain any sensible data.
+
+@see eet_data_image_read()
+@see eet_data_image_decode_cipher()
+
+:since: 1.0.0
+
+"""
+EAPI void *
+eet_data_image_decode(const void *data,
+ int size,
+ unsigned int *w,
+ unsigned int *h,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
+
+"""
+
+Decode Image data into pixel data and stores in the given buffer.
+:param data: The encoded pixel data.
+:param size: The size, in bytes, of the encoded pixel data.
+:param src_x: The starting x coordinate from where to dump the stream.
+:param src_y: The starting y coordinate from where to dump the stream.
+:param d: A pointer to the pixel surface.
+:param w: The expected width in pixels of the pixel surface to decode.
+:param h: The expected height in pixels of the pixel surface to decode.
+:param row_stride: The length of a pixels line in the destination surface.
+:param alpha: A pointer to the int to hold the alpha flag.
+:param compress: A pointer to the int to hold the compression amount.
+:param quality: A pointer to the int to hold the quality amount.
+:param lossy: A pointer to the int to hold the lossiness flag.
+:return: 1 on success, 0 otherwise.
+
+Like eet_data_image_read_to_surface(), but reading the given @p data buffer
+instead of a file.
+
+On success the function returns 1, and 0 on failure. On failure the
+parameter values may not contain any sensible data.
+
+@see eet_data_image_read_to_surface()
+@see eet_data_image_decode_to_surface_cipher()
+
+:since: 1.0.2
+
+"""
+EAPI int
+eet_data_image_decode_to_surface(const void *data,
+ int size,
+ unsigned int src_x,
+ unsigned int src_y,
+ unsigned int *d,
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
+
+"""
+
+Encode image data for storage or transmission.
+:param data: A pointer to the image pixel data.
+:param size_ret: A pointer to an int to hold the size of the returned data.
+:param w: The width of the image in pixels.
+:param h: The height of the image in pixels.
+:param alpha: The alpha channel flag.
+:param compress: The compression amount.
+:param quality: The quality encoding amount.
+:param lossy: The lossiness flag.
+:return: The encoded image data.
+
+This function stakes image pixel data and encodes it with compression and
+possible loss of quality (as a trade off for size) for storage or
+transmission to another system.
+
+It works like eet_data_image_write(), but instead of writing the encoded
+image into an Eet file, it allocates a new buffer of the size required and
+returns the encoded data in it.
+
+On success this function returns a pointer to the encoded data that you
+can free with free() when no longer needed.
+
+@see eet_data_image_write()
+@see eet_data_image_read()
+@see eet_data_image_encode_cipher()
+
+:since: 1.0.0
+
+"""
+EAPI void *
+eet_data_image_encode(const void *data,
+ int *size_ret,
+ unsigned int w,
+ unsigned int h,
+ int alpha,
+ int compress,
+ int quality,
+ int lossy);
+
+
+"""
+
+Decode Image data header only to get information using a cipher.
+:param data: The encoded pixel data.
+:param cipher_key: The key to use as cipher.
+:param size: The size, in bytes, of the encoded pixel data.
+:param w: A pointer to the unsigned int to hold the width in pixels.
+:param h: A pointer to the unsigned int to hold the height in pixels.
+:param alpha: A pointer to the int to hold the alpha flag.
+:param compress: A pointer to the int to hold the compression amount.
+:param quality: A pointer to the int to hold the quality amount.
+:param lossy: A pointer to the int to hold the lossiness flag.
+:return: 1 on success, 0 on failure.
+
+This function takes encoded pixel data and decodes it into raw RGBA
+pixels on success.
+
+The other parameters of the image (width, height etc.) are placed into
+the values pointed to (they must be supplied). The pixel data is a linear
+array of pixels starting from the top-left of the image scanning row by
+row from left to right. Each pixel is a 32bit value, with the high byte
+being the alpha channel, the next being red, then green, and the low byte
+being blue. The width and height are measured in pixels and will be
+greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
+that the alpha channel is not used. 1 denotes that it is significant.
+Compress is filled with the compression value/amount the image was
+stored with. The quality value is filled with the quality encoding of
+the image file (0 - 100). The lossy flags is either 0 or 1 as to if
+the image was encoded lossily or not.
+
+On success the function returns 1 indicating the header was read and
+decoded properly, or 0 on failure.
+
+@see eet_data_image_header_decode()
+
+:since: 1.0.0
+
+"""
+EAPI int
+eet_data_image_header_decode_cipher(const void *data,
+ const char *cipher_key,
+ int size,
+ unsigned int *w,
+ unsigned int *h,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
+
+"""
+
+Decode Image data into pixel data using a cipher.
+:param data: The encoded pixel data.
+:param cipher_key: The key to use as cipher.
+:param size: The size, in bytes, of the encoded pixel data.
+:param w: A pointer to the unsigned int to hold the width in pixels.
+:param h: A pointer to the unsigned int to hold the height in pixels.
+:param alpha: A pointer to the int to hold the alpha flag.
+:param compress: A pointer to the int to hold the compression amount.
+:param quality: A pointer to the int to hold the quality amount.
+:param lossy: A pointer to the int to hold the lossiness flag.
+:return: The image pixel data decoded
+
+This function takes encoded pixel data and decodes it into raw RGBA
+pixels on success.
+
+The other parameters of the image (width, height etc.) are placed into
+the values pointed to (they must be supplied). The pixel data is a linear
+array of pixels starting from the top-left of the image scanning row by
+row from left to right. Each pixel is a 32bit value, with the high byte
+being the alpha channel, the next being red, then green, and the low byte
+being blue. The width and height are measured in pixels and will be
+greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
+that the alpha channel is not used. 1 denotes that it is significant.
+Compress is filled with the compression value/amount the image was
+stored with. The quality value is filled with the quality encoding of
+the image file (0 - 100). The lossy flags is either 0 or 1 as to if
+the image was encoded lossily or not.
+
+On success the function returns a pointer to the image data decoded. The
+calling application is responsible for calling free() on the image data
+when it is done with it. On failure NULL is returned and the parameter
+values may not contain any sensible data.
+
+@see eet_data_image_decode()
+
+:since: 1.0.0
+
+"""
+EAPI void *
+eet_data_image_decode_cipher(const void *data,
+ const char *cipher_key,
+ int size,
+ unsigned int *w,
+ unsigned int *h,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
+
+"""
+
+Decode Image data into pixel data using a cipher.
+:param data: The encoded pixel data.
+:param cipher_key: The key to use as cipher.
+:param size: The size, in bytes, of the encoded pixel data.
+:param src_x: The starting x coordinate from where to dump the stream.
+:param src_y: The starting y coordinate from where to dump the stream.
+:param d: A pointer to the pixel surface.
+:param w: The expected width in pixels of the pixel surface to decode.
+:param h: The expected height in pixels of the pixel surface to decode.
+:param row_stride: The length of a pixels line in the destination surface.
+:param alpha: A pointer to the int to hold the alpha flag.
+:param compress: A pointer to the int to hold the compression amount.
+:param quality: A pointer to the int to hold the quality amount.
+:param lossy: A pointer to the int to hold the lossiness flag.
+:return: 1 on success, 0 otherwise.
+
+This function takes encoded pixel data and decodes it into raw RGBA
+pixels on success.
+
+The other parameters of the image (alpha, compress etc.) are placed into
+the values pointed to (they must be supplied). The pixel data is a linear
+array of pixels starting from the top-left of the image scanning row by
+row from left to right. Each pixel is a 32bit value, with the high byte
+being the alpha channel, the next being red, then green, and the low byte
+being blue. The width and height are measured in pixels and will be
+greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
+that the alpha channel is not used. 1 denotes that it is significant.
+Compress is filled with the compression value/amount the image was
+stored with. The quality value is filled with the quality encoding of
+the image file (0 - 100). The lossy flags is either 0 or 1 as to if
+the image was encoded lossily or not.
+
+On success the function returns 1, and 0 on failure. On failure the
+parameter values may not contain any sensible data.
+
+@see eet_data_image_decode_to_surface()
+
+:since: 1.0.2
+
+"""
+EAPI int
+eet_data_image_decode_to_surface_cipher(const void *data,
+ const char *cipher_key,
+ int size,
+ unsigned int src_x,
+ unsigned int src_y,
+ unsigned int *d,
+ unsigned int w,
+ unsigned int h,
+ unsigned int row_stride,
+ int *alpha,
+ int *compress,
+ int *quality,
+ int *lossy);
+
+"""
+
+Encode image data for storage or transmission using a cipher.
+:param data: A pointer to the image pixel data.
+:param cipher_key: The key to use as cipher.
+:param size_ret: A pointer to an int to hold the size of the returned data.
+:param w: The width of the image in pixels.
+:param h: The height of the image in pixels.
+:param alpha: The alpha channel flag.
+:param compress: The compression amount.
+:param quality: The quality encoding amount.
+:param lossy: The lossiness flag.
+:return: The encoded image data.
+
+This function stakes image pixel data and encodes it with compression and
+possible loss of quality (as a trade off for size) for storage or
+transmission to another system.
+
+The data expected is the same format as returned by eet_data_image_read.
+If this is not the case weird things may happen. Width and height must
+be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
+the alpha values are not useful and 1 meaning they are). Compress can
+be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
+This is only used if the image is not lossily encoded. Quality is used on
+lossy compression and should be a value from 0 to 100. The lossy flag
+can be 0 or 1. 0 means encode losslessly and 1 means to encode with
+image quality loss (but then have a much smaller encoding).
+
+On success this function returns a pointer to the encoded data that you
+can free with free() when no longer needed.
+
+@see eet_data_image_encode()
+
+:since: 1.0.0
+
+"""
+EAPI void *
+eet_data_image_encode_cipher(const void *data,
+ const char *cipher_key,
+ unsigned int w,
+ unsigned int h,
+ int alpha,
+ int compress,
+ int quality,
+ int lossy,
+ int *size_ret);
+
+
+
+
+typedef void (*Eet_Dump_Callback)(void *data, const char *str);
+
+"""
+
+Dump an eet encoded data structure into ascii text
+:param data_in: The pointer to the data to decode into a struct.
+:param size_in: The size of the data pointed to in bytes.
+:param dumpfunc: The function to call passed a string when new
+ data is converted to text
+:param dumpdata: The data to pass to the @p dumpfunc callback.
+:return: 1 on success, 0 on failure
+
+This function will take a chunk of data encoded by
+eet_data_descriptor_encode() and convert it into human readable
+ascii text. It does this by calling the @p dumpfunc callback
+for all new text that is generated. This callback should append
+to any existing text buffer and will be passed the pointer @p
+dumpdata as a parameter as well as a string with new text to be
+appended.
+
+Example:
+
+@code
+void output(void *data, const char *string)
+{
+ printf("%s", string);
+}
+
+void dump(const char *file)
+{
+ FILE *f;
+ int len;
+ void *data;
+
+ f = fopen(file, "r");
+ fseek(f, 0, SEEK_END);
+ len = ftell(f);
+ rewind(f);
+ data = malloc(len);
+ fread(data, len, 1, f);
+ fclose(f);
+ eet_data_text_dump(data, len, output, NULL);
+}
+@endcode
+
+:see: eet_data_text_dump_cipher()
+
+:since: 1.0.0
+
+"""
+EAPI int
+eet_data_text_dump(const void *data_in,
+ int size_in,
+ Eet_Dump_Callback dumpfunc,
+ void *dumpdata);
+
+"""
+
+Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
+:param text: The pointer to the string data to parse and encode.
+:param textlen: The size of the string in bytes (not including 0
+ byte terminator).
+:param size_ret: This gets filled in with the encoded data blob
+ size in bytes.
+:return: The encoded data on success, NULL on failure.
+
+This function will parse the string pointed to by @p text and return
+an encoded data lump the same way eet_data_descriptor_encode() takes an
+in-memory data struct and encodes into a binary blob. @p text is a normal
+C string.
+
+:see: eet_data_text_undump_cipher()
+
+:since: 1.0.0
+
+"""
+EAPI void *
+eet_data_text_undump(const char *text,
+ int textlen,
+ int *size_ret);
+
+
+
+
+"""
+
+Read a data structure from an eet extended attribute and decodes it using a cipher.
+:param filename: The file to extract the extended attribute from.
+:param attribute: The attribute to get the data from.
+:param edd: The data descriptor handle to use when decoding.
+:param cipher_key: The key to use as cipher.
+:return: A pointer to the decoded data structure.
+
+This function decodes a data structure stored in an eet extended attribute,
+returning a pointer to it if it decoded successfully, or NULL on failure.
+Eet can handle members being added or deleted from the data in
+storage and safely zero-fills unfilled members if they were not found
+in the data. It checks sizes and headers whenever it reads data, allowing
+the programmer to not worry about corrupt data.
+
+Once a data structure has been described by the programmer with the
+fields they wish to save or load, storing or retrieving a data structure
+from an eet file, from a chunk of memory or from an extended attribute
+is as simple as a single function call.
+
+:since: 1.5.0
+
+"""
+EAPI void *
+eet_data_xattr_cipher_get(const char *filename,
+ const char *attribute,
+ Eet_Data_Descriptor *edd,
+ const char *cipher_key);
+
+
+"""
+
+Write a data structure from memory and store in an eet extended attribute
+using a cipher.
+:param filename: The file to write the extended attribute to.
+:param attribute: The attribute to store the data to.
+:param edd: The data descriptor to use when encoding.
+:param cipher_key: The key to use as cipher.
+:param data: A pointer to the data structure to save and encode.
+:param flags: The policy to use when setting the data.
+:return: EINA_TRUE on success, EINA_FALSE on failure.
+
+This function is the reverse of eet_data_xattr_cipher_get(), saving a data structure
+to an eet extended attribute.
+
+:since: 1.5.0
+
+"""
+EAPI Eina_Bool
+eet_data_xattr_cipher_set(const char *filename,
+ const char *attribute,
+ Eet_Data_Descriptor *edd,
+ const char *cipher_key,
+ const void *data,
+ Eina_Xattr_Flags flags);
+
+"""
+
+Dump an eet encoded data structure into ascii text using a cipher.
+:param data_in: The pointer to the data to decode into a struct.
+:param cipher_key: The key to use as cipher.
+:param size_in: The size of the data pointed to in bytes.
+:param dumpfunc: The function to call passed a string when new
+ data is converted to text
+:param dumpdata: The data to pass to the @p dumpfunc callback.
+:return: 1 on success, 0 on failure
+
+This function will take a chunk of data encoded by
+eet_data_descriptor_encode() and convert it into human readable
+ascii text. It does this by calling the @p dumpfunc callback
+for all new text that is generated. This callback should append
+to any existing text buffer and will be passed the pointer @p
+dumpdata as a parameter as well as a string with new text to be
+appended.
+
+Example:
+
+@code
+void output(void *data, const char *string)
+{
+ printf("%s", string);
+}
+
+void dump(const char *file)
+{
+ FILE *f;
+ int len;
+ void *data;
+
+ f = fopen(file, "r");
+ fseek(f, 0, SEEK_END);
+ len = ftell(f);
+ rewind(f);
+ data = malloc(len);
+ fread(data, len, 1, f);
+ fclose(f);
+ eet_data_text_dump_cipher(data, cipher_key, len, output, NULL);
+}
+@endcode
+
+:see: eet_data_text_dump()
+
+:since: 1.0.0
+
+"""
+EAPI int
+eet_data_text_dump_cipher(const void *data_in,
+ const char *cipher_key,
+ int size_in,
+ Eet_Dump_Callback dumpfunc,
+ void *dumpdata);
+
+"""
+
+Take an ascii encoding from eet_data_text_dump() and re-encode
+in binary using a cipher.
+:param text: The pointer to the string data to parse and encode.
+:param cipher_key: The key to use as cipher.
+:param textlen: The size of the string in bytes (not including 0
+ byte terminator).
+:param size_ret: This gets filled in with the encoded data blob
+ size in bytes.
+:return: The encoded data on success, NULL on failure.
+
+This function will parse the string pointed to by @p text and return
+an encoded data lump the same way eet_data_descriptor_encode() takes an
+in-memory data struct and encodes into a binary blob. @p text is a normal
+C string.
+
+:see: eet_data_text_undump()
+
+:since: 1.0.0
+
+"""
+EAPI void *
+eet_data_text_undump_cipher(const char *text,
+ const char *cipher_key,
+ int textlen,
+ int *size_ret);
+
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_data_node_decode_cipher(const void *data_in,
+ const char *cipher_key,
+ int size_in);
+
+
+"""
+
+Display the x509 der certificate to out.
+
+:param certificate: the x509 certificate to print
+:param der_length: The length the certificate.
+:param out: where to print.
+
+@warning You need to compile signature support in EET.
+:since: 1.2.0
+
+"""
+EAPI void
+eet_identity_certificate_print(const unsigned char *certificate,
+ int der_length,
+ FILE *out);
diff --git a/efl/eet/dictionary.pxi b/efl/eet/dictionary.pxi
new file mode 100644
index 0000000..d660c39
--- /dev/null
+++ b/efl/eet/dictionary.pxi
@@ -0,0 +1,45 @@
+
+from cpython cimport PyUnicode_AsUTF8String
+from efl.utils.conversions cimport _ctouni
+
+
+cdef class EetDictionary(object):
+
+ """
+
+ Opaque handle that defines a file-backed (mmaped) dictionary of strings.
+
+ """
+
+ cdef Eet_Dictionary *ed
+
+ def string_check(self, string):
+ """
+
+ Check if a given string comes from a given dictionary
+
+ :param string: A valid 0 byte terminated C string
+ :return: 1 if it is in the dictionary, 0 otherwise
+
+ This checks the given dictionary to see if the given string is actually
+ inside that dictionary (i.e. comes from it) and returns 1 if it does.
+ If the dictionary handle is invalid, the string is None or the string is
+ not in the dictionary, 0 is returned.
+
+ :since: 1.0.0
+
+ """
+ if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
+ return bool(eet_dictionary_string_check(self.ed, string))
+
+ def count(self):
+ """
+
+ Return the number of strings inside a dictionary
+
+ :return int: the number of strings inside a dictionary
+
+ :since: 1.6.0
+
+ """
+ return eet_dictionary_count(self.ed)
diff --git a/efl/eet/eet.pxd b/efl/eet/eet.pxd
new file mode 100644
index 0000000..90a5ceb
--- /dev/null
+++ b/efl/eet/eet.pxd
@@ -0,0 +1,309 @@
+from libc.string cimport const_char
+from libc.stdlib cimport const_void
+
+from efl.eina cimport Eina_Bool, Eina_List
+
+from efl.eet.enums cimport Eet_Error, Eet_Compression, Eet_File_Mode
+
+cdef extern from *:
+ ctypedef unsigned char const_unsigned_char "const unsigned char"
+
+cdef extern from "Eet.h":
+
+ enum:
+ EET_VERSION_MAJOR
+ EET_VERSION_MINOR
+
+ ctypedef struct Eet_Version:
+ int major # major (binary or source incompatible changes)
+ int minor # minor (new features, bugfixes, major improvements version)
+ int micro # micro (bugfix, internal improvements, no new features version)
+ int revision # svn revision (0 if a proper release or the svn revision number Eet is built from)
+
+ extern Eet_Version *eet_version
+
+ int eet_init()
+ int eet_shutdown()
+ void eet_clearcache()
+
+ ctypedef struct Eet_File
+
+ ctypedef struct Eet_Dictionary
+ ctypedef Eet_Dictionary const_Eet_Dictionary "const Eet_Dictionary"
+
+ ctypedef _Eet_Entry Eet_Entry
+ struct _Eet_Entry:
+ const_char *name # The entry name
+
+ int offset # Where it start in the file
+ int size # The size on disk
+ int data_size # The decompressed size if relevant
+
+ Eina_Bool compression # Is this data compressed ?
+ Eina_Bool ciphered # Is it ciphered ?
+ Eina_Bool alias # Is it an alias ?
+
+ Eet_File * eet_open(const_char *file, Eet_File_Mode mode)
+ # Eet_File * eet_mmap(const_Eina_File *file)
+ # Eet_File * eet_memopen_read(const_void *data, size_t size)
+ Eet_File_Mode eet_mode_get(Eet_File *ef)
+ Eet_Error eet_close(Eet_File *ef)
+ Eet_Error eet_sync(Eet_File *ef)
+ Eet_Dictionary *eet_dictionary_get(Eet_File *ef)
+ int eet_dictionary_string_check(Eet_Dictionary *ed, const_char *string)
+ int eet_dictionary_count(const_Eet_Dictionary *ed)
+ void * eet_read(Eet_File *ef, const_char *name, int *size_ret)
+ const_void * eet_read_direct(Eet_File *ef, const_char *name, int *size_ret)
+ int eet_write(Eet_File *ef, const_char *name, const_void *data, int size, int compress)
+ int eet_delete(Eet_File *ef, const_char *name)
+ Eina_Bool eet_alias(Eet_File *ef, const_char *name, const_char *destination, int compress)
+ const_char * eet_file_get(Eet_File *ef)
+ const_char * eet_alias_get(Eet_File *ef, const_char *name)
+ char ** eet_list(Eet_File *ef, const_char *glob, int *count_ret)
+ # Eina_Iterator * eet_list_entries(Eet_File *ef)
+ int eet_num_entries(Eet_File *ef)
+ # void * eet_read_cipher(Eet_File *ef, const_char *name, int *size_ret, const_char *cipher_key)
+ # int eet_write_cipher(Eet_File *ef, const_char *name, const_void *data, int size, int compress, const_char *cipher_key)
+ # int eet_data_image_header_read(Eet_File *ef, const_char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # void * eet_data_image_read(Eet_File *ef, const_char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # int eet_data_image_read_to_surface(Eet_File *ef, const_char *name, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy)
+ # int eet_data_image_write(Eet_File *ef, const_char *name, const_void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy)
+ # int eet_data_image_header_decode(const_void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # void * eet_data_image_decode(const_void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # int eet_data_image_decode_to_surface(const_void *data, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy)
+ # void * eet_data_image_encode(const_void *data, int *size_ret, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy)
+ # int eet_data_image_header_read_cipher(Eet_File *ef, const_char *name, const_char *cipher_key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # void * eet_data_image_read_cipher(Eet_File *ef, const_char *name, const_char *cipher_key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # int eet_data_image_read_to_surface_cipher(Eet_File *ef, const_char *name, const_char *cipher_key, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy)
+ # int eet_data_image_write_cipher(Eet_File *ef, const_char *name, const_char *cipher_key, const_void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy)
+ # int eet_data_image_header_decode_cipher(const_void *data, const_char *cipher_key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # void * eet_data_image_decode_cipher(const_void *data, const_char *cipher_key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy)
+ # int eet_data_image_decode_to_surface_cipher(const_void *data, const_char *cipher_key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy)
+ # void * eet_data_image_encode_cipher(const_void *data, const_char *cipher_key, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy, int *size_ret)
+
+ # ctypedef struct Eet_Key
+
+ # ctypedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag, void *data)
+
+ # Eet_Key * eet_identity_open(const_char *certificate_file, const_char *private_key_file, Eet_Key_Password_Callback cb)
+ # void eet_identity_close(Eet_Key *key)
+ # Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key)
+ # void eet_identity_print(Eet_Key *key, FILE *out)
+ # const_void * eet_identity_x509(Eet_File *ef, int *der_length)
+ # const_void * eet_identity_signature(Eet_File *ef, int *signature_length)
+ # const_void * eet_identity_sha1(Eet_File *ef, int *sha1_length)
+ # void eet_identity_certificate_print(const_unsigned_char *certificate, int der_length, FILE *out)
+
+ # enum:
+ # EET_T_UNKNOW # Unknown data encoding type
+ # EET_T_CHAR # Data type: char
+ # EET_T_SHORT # Data type: short
+ # EET_T_INT # Data type: int
+ # EET_T_LONG_LONG # Data type: long long
+ # EET_T_FLOAT # Data type: float
+ # EET_T_DOUBLE # Data type: double
+ # EET_T_UCHAR # Data type: unsigned char
+ # EET_T_USHORT # Data type: unsigned short
+ # EET_T_UINT # Data type: unsigned int
+ # EET_T_ULONG_LONG # Data type: unsigned long long
+ # EET_T_STRING # Data type: char *
+ # EET_T_INLINED_STRING # Data type: char * (but compressed inside the resulting eet)
+ # EET_T_NULL # Data type: (void *) (only use it if you know why)
+ # EET_T_F32P32 # Data type: fixed point 32.32
+ # EET_T_F16P16 # Data type: fixed point 16.16
+ # EET_T_F8P24 # Data type: fixed point 8.24
+ # EET_T_VALUE # Data type: pointer to Eina_Value @since 1.8
+ # EET_T_LAST # Last data type
+
+ # enum:
+ # EET_G_UNKNOWN # Unknown group data encoding type
+ # EET_G_ARRAY # Fixed size array group type
+ # EET_G_VAR_ARRAY # Variable size array group type
+ # EET_G_LIST # Linked list group type
+ # EET_G_HASH # Hash table group type
+ # EET_G_UNION # Union group type
+ # EET_G_VARIANT # Selectable subtype group
+ # EET_G_UNKNOWN_NESTED # Unknown nested group type. @since 1.8
+ # EET_G_LAST # Last group type
+
+ # enum:
+ # EET_I_LIMIT # Other type exist but are reserved for internal purpose.
+
+ # ctypedef struct Eet_Data_Descriptor
+
+ # enum:
+ # EET_DATA_DESCRIPTOR_CLASS_VERSION
+
+ # ctypedef _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class
+
+ # ctypedef int (*Eet_Descriptor_Hash_Foreach_Callback_Callback)(void *h, const_char *k, void *dt, void *fdt)
+
+ # ctypedef void * (*Eet_Descriptor_Mem_Alloc_Callback)(size_t size)
+ # ctypedef void (*Eet_Descriptor_Mem_Free_Callback)(void *mem)
+ # ctypedef char * (*Eet_Descriptor_Str_Alloc_Callback)(const_char *str)
+ # ctypedef void (*Eet_Descriptor_Str_Free_Callback)(const_char *str)
+ # ctypedef void * (*Eet_Descriptor_List_Next_Callback)(void *l)
+ # ctypedef void * (*Eet_Descriptor_List_Append_Callback)(void *l, void *d)
+ # ctypedef void * (*Eet_Descriptor_List_Data_Callback)(void *l)
+ # ctypedef void * (*Eet_Descriptor_List_Free_Callback)(void *l)
+ # ctypedef void (*Eet_Descriptor_Hash_Foreach_Callback)(void *h, Eet_Descriptor_Hash_Foreach_Callback_Callback func, void *fdt)
+ # ctypedef void * (*Eet_Descriptor_Hash_Add_Callback)(void *h, const_char *k, void *d)
+ # ctypedef void (*Eet_Descriptor_Hash_Free_Callback)(void *h)
+ # ctypedef char * (*Eet_Descriptor_Str_Direct_Alloc_Callback)(const_char *str)
+ # ctypedef void (*Eet_Descriptor_Str_Direct_Free_Callback)(const_char *str)
+ # ctypedef const_char * (*Eet_Descriptor_Type_Get_Callback)(const_void *data, Eina_Bool *unknow)
+ # ctypedef Eina_Bool (*Eet_Descriptor_Type_Set_Callback)(const_char *type, void *data, Eina_Bool unknow)
+ # ctypedef void * (*Eet_Descriptor_Array_Alloc_Callback)(size_t size)
+ # ctypedef void (*Eet_Descriptor_Array_Free_Callback)(void *mem)
+
+
+ # ctypedef struct _Eet_Data_Descriptor_Class_func:
+ # Eet_Descriptor_Mem_Alloc_Callback mem_alloc # how to allocate memory (usually malloc())
+ # Eet_Descriptor_Mem_Free_Callback mem_free # how to free memory (usually free())
+ # Eet_Descriptor_Str_Alloc_Callback str_alloc # how to allocate a string
+ # Eet_Descriptor_Str_Free_Callback str_free # how to free a string
+ # Eet_Descriptor_List_Next_Callback list_next # how to iterate to the next element of a list. Receives and should return the list node.
+ # Eet_Descriptor_List_Append_Callback list_append # how to append data @p d to list which head node is @p l
+ # Eet_Descriptor_List_Data_Callback list_data # retrieves the data from node @p l
+ # Eet_Descriptor_List_Free_Callback list_free # free all the nodes from the list which head node is @p l
+ # Eet_Descriptor_Hash_Foreach_Callback hash_foreach # iterates over all elements in the hash @p h in no specific order
+ # Eet_Descriptor_Hash_Add_Callback hash_add # add a new data @p d with key @p k in hash @p h
+ # Eet_Descriptor_Hash_Free_Callback hash_free # free all entries from the hash @p h
+ # Eet_Descriptor_Str_Direct_Alloc_Callback str_direct_alloc # how to allocate a string directly from file backed/mmaped region pointed by @p str
+ # Eet_Descriptor_Str_Direct_Free_Callback str_direct_free # how to free a string returned by str_direct_alloc
+ # Eet_Descriptor_Type_Get_Callback type_get # get the type, as used in the union or variant mapping, that should be used to store the given data into the eet file.
+ # Eet_Descriptor_Type_Set_Callback type_set # called when loading a mapped type with the given @p type used to describe the type in the descriptor
+ # Eet_Descriptor_Array_Alloc_Callback array_alloc # how to allocate memory for array (usually malloc())
+ # Eet_Descriptor_Array_Free_Callback array_free # how to free memory for array (usually free())
+
+ # struct _Eet_Data_Descriptor_Class:
+ # int version # ABI version. Should always be set to #EET_DATA_DESCRIPTOR_CLASS_VERSION
+ # const_char *name # Name of the user data type to be serialized
+ # int size # Size in bytes of the user data type to be serialized
+ # _Eet_Data_Descriptor_Class func
+
+
+ # Eet_Data_Descriptor * eet_data_descriptor_stream_new(const_Eet_Data_Descriptor_Class *eddc)
+ # Eet_Data_Descriptor * eet_data_descriptor_file_new(const_Eet_Data_Descriptor_Class *eddc)
+
+ # Eina_Bool eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc, unsigned int eddc_size, const_char *name, int size)
+ # Eina_Bool EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(Eet_Data_Descriptor_Class *clas, void *type)
+
+ # Eina_Bool eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc, unsigned int eddc_size, const_char *name, int size)
+ # Eina_Bool EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(Eet_Data_Descriptor_Class *clas, void *type)
+
+
+ # void eet_data_descriptor_free(Eet_Data_Descriptor *edd)
+ # const_char * eet_data_descriptor_name_get(const_Eet_Data_Descriptor *edd)
+ # void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, const_char *name, int type, int group_type, int offset, int count, const_char *counter_name, Eet_Data_Descriptor *subtype)
+ # void * eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const_char *name)
+ # int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const_char *name, const_void *data, int compress)
+
+
+ # ctypedef void (*Eet_Dump_Callback)(void *data, const_char *str)
+
+
+ # int eet_data_text_dump(const_void *data_in, int size_in, Eet_Dump_Callback dumpfunc, void *dumpdata)
+ # void * eet_data_text_undump(const_char *text, int textlen, int *size_ret)
+ # int eet_data_dump(Eet_File *ef, const_char *name, Eet_Dump_Callback dumpfunc, void *dumpdata)
+ # int eet_data_undump(Eet_File *ef, const_char *name, const_char *text, int textlen, int compress)
+ # void * eet_data_descriptor_decode(Eet_Data_Descriptor *edd, const_void *data_in, int size_in)
+ # void * eet_data_descriptor_encode(Eet_Data_Descriptor *edd, const_void *data_in, int *size_ret)
+
+ # void EET_DATA_DESCRIPTOR_ADD_BASIC(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, int type)
+ # void EET_DATA_DESCRIPTOR_ADD_SUB(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, Eet_Data_Descriptor *subtype)
+ # void EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, Eet_Data_Descriptor *subtype)
+ # void EET_DATA_DESCRIPTOR_ADD_SUB_LIST(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, Eet_Data_Descriptor *subtype)
+ # void EET_DATA_DESCRIPTOR_ADD_LIST_STRING(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member)
+ # void EET_DATA_DESCRIPTOR_ADD_HASH(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, Eet_Data_Descriptor *subtype)
+ # void EET_DATA_DESCRIPTOR_ADD_HASH_STRING(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member)
+ # void EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, int type)
+ # void EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, int type)
+ # void EET_DATA_DESCRIPTOR_ADD_ARRAY(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, Eet_Data_Descriptor *subtype)
+ # void EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, Eet_Data_Descriptor *subtype)
+ # void EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY_STRING(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member)
+ # void EET_DATA_DESCRIPTOR_ADD_UNION(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, void *type_member, Eet_Data_Descriptor *unified_type)
+ # void EET_DATA_DESCRIPTOR_ADD_VARIANT(Eet_Data_Descriptor *edd, void *struct_type, const_char *name, void *member, void *type_member, Eet_Data_Descriptor *unified_type)
+ # void EET_DATA_DESCRIPTOR_ADD_MAPPING(Eet_Data_Descriptor *unified_type, const_char *name, Eet_Data_Descriptor *subtype)
+ # void EET_DATA_DESCRIPTOR_ADD_MAPPING_BASIC(Eet_Data_Descriptor *unified_type, const_char *name, int basic_type)
+
+ # void * eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const_char *name, const_char *cipher_key)
+ # void * eet_data_xattr_cipher_get(const_char *filename, const_char *attribute, Eet_Data_Descriptor *edd, const_char *cipher_key)
+ # int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const_char *name, const_char *cipher_key, const_void *data, int compress)
+ # Eina_Bool eet_data_xattr_cipher_set(const_char *filename, const_char *attribute, Eet_Data_Descriptor *edd, const_char *cipher_key, const_void *data, Eina_Xattr_Flags flags)
+ # int eet_data_text_dump_cipher(const_void *data_in, const_char *cipher_key, int size_in, Eet_Dump_Callback dumpfunc, void *dumpdata)
+ # void * eet_data_text_undump_cipher(const_char *text, const_char *cipher_key, int textlen, int *size_ret)
+ # int eet_data_dump_cipher(Eet_File *ef, const_char *name, const_char *cipher_key, Eet_Dump_Callback dumpfunc, void *dumpdata)
+ # int eet_data_undump_cipher(Eet_File *ef, const_char *name, const_char *cipher_key, const_char *text, int textlen, int compress)
+ # void * eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd, const_void *data_in, const_char *cipher_key, int size_in)
+ # void * eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd, const_void *data_in, const_char *cipher_key, int *size_ret)
+
+ ctypedef struct Eet_Node
+
+ ctypedef _Eet_Node_Data Eet_Node_Data
+
+ ctypedef union _Eet_Node_Data_value:
+ char c
+ short s
+ int i
+ long long l
+ float f
+ double d
+ unsigned char uc
+ unsigned short us
+ unsigned int ui
+ unsigned long long ul
+ const_char *str
+
+ struct _Eet_Node_Data:
+ _Eet_Node_Data_value value
+
+ Eet_Node * eet_node_char_new(const_char *name, char c)
+ Eet_Node * eet_node_short_new(const_char *name, short s)
+ Eet_Node * eet_node_int_new(const_char *name, int i)
+ Eet_Node * eet_node_long_long_new(const_char *name, long long l)
+ Eet_Node * eet_node_float_new(const_char *name, float f)
+ Eet_Node * eet_node_double_new(const_char *name, double d)
+ Eet_Node * eet_node_unsigned_char_new(const_char *name, unsigned char uc)
+ Eet_Node * eet_node_unsigned_short_new(const_char *name, unsigned short us)
+ Eet_Node * eet_node_unsigned_int_new(const_char *name, unsigned int ui)
+ Eet_Node * eet_node_unsigned_long_long_new(const_char *name, unsigned long long l)
+ Eet_Node * eet_node_string_new(const_char *name, const_char *str)
+ Eet_Node * eet_node_inlined_string_new(const_char *name, const_char *str)
+ Eet_Node * eet_node_null_new(const_char *name)
+ Eet_Node * eet_node_list_new(const_char *name, Eina_List *nodes)
+ Eet_Node * eet_node_array_new(const_char *name, int count, Eina_List *nodes)
+ Eet_Node * eet_node_var_array_new(const_char *name, Eina_List *nodes)
+ Eet_Node * eet_node_hash_new(const_char *name, const_char *key, Eet_Node *node)
+ Eet_Node * eet_node_struct_new(const_char *name, Eina_List *nodes)
+ Eet_Node * eet_node_struct_child_new(const_char *parent, Eet_Node *child)
+
+ Eet_Node * eet_node_children_get(Eet_Node *node)
+ Eet_Node * eet_node_next_get(Eet_Node *node)
+ Eet_Node * eet_node_parent_get(Eet_Node *node)
+ void eet_node_list_append(Eet_Node *parent, const_char *name, Eet_Node *child)
+ void eet_node_struct_append(Eet_Node *parent, const_char *name, Eet_Node *child)
+ void eet_node_hash_add(Eet_Node *parent, const_char *name, const_char *key, Eet_Node *child)
+ # void eet_node_dump(Eet_Node *n, int dumplevel, Eet_Dump_Callback dumpfunc, void *dumpdata)
+ int eet_node_type_get(Eet_Node *node)
+ Eet_Node_Data * eet_node_value_get(Eet_Node *node)
+ void eet_node_del(Eet_Node *n)
+ # void * eet_data_node_encode_cipher(Eet_Node *node, const_char *cipher_key, int *size_ret)
+ # Eet_Node * eet_data_node_decode_cipher(const_void *data_in, const_char *cipher_key, int size_in)
+ # Eet_Node * eet_data_node_read_cipher(Eet_File *ef, const_char *name, const_char *cipher_key)
+ # int eet_data_node_write_cipher(Eet_File *ef, const_char *name, const_char *cipher_key, Eet_Node *node, int compress)
+
+
+ # ctypedef struct Eet_Connection
+
+ # ctypedef Eina_Bool Eet_Read_Cb (const_void *eet_data, size_t size, void *user_data)
+
+ # ctypedef Eina_Bool Eet_Write_Cb (const_void *data, size_t size, void *user_data)
+
+
+ # Eet_Connection * eet_connection_new(Eet_Read_Cb *eet_read_cb, Eet_Write_Cb *eet_write_cb, const_void *user_data)
+ # int eet_connection_received(Eet_Connection *conn, const_void *data, size_t size)
+ # Eina_Bool eet_connection_empty(Eet_Connection *conn)
+ # Eina_Bool eet_connection_send(Eet_Connection *conn, Eet_Data_Descriptor *edd, const_void *data_in, const_char *cipher_key)
+ # Eina_Bool eet_connection_node_send(Eet_Connection *conn, Eet_Node *node, const_char *cipher_key)
+ # void * eet_connection_close(Eet_Connection *conn, Eina_Bool *on_going)
diff --git a/efl/eet/eet.pyx b/efl/eet/eet.pyx
new file mode 100644
index 0000000..55146e1
--- /dev/null
+++ b/efl/eet/eet.pyx
@@ -0,0 +1,197 @@
+# Copyright (C) 2007-2014 various contributors (see AUTHORS)
+#
+# This file is part of Python-EFL.
+#
+# Python-EFL is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# Python-EFL is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this Python-EFL. If not, see .
+
+"""
+
+Eet Data Handling Library
+=========================
+
+These routines are used for Eet Library interaction
+
+.. _eet_main_intro:
+
+Introduction
+------------
+
+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_main_next_steps:
+
+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 Eina as it is very
+convenient and optimized, and Eet provides integration with it.
+
+.. _Eet_File_Image_Group:
+
+Image Store and Load
+--------------------
+
+Eet efficiently stores and loads images, including alpha
+channels and lossy compressions.
+
+Eet can handle both lossy compression with different levels of quality and
+non-lossy compression with different compression levels. It's also possible,
+given an image data, to only read its header to get the image information
+without decoding the entire content for it.
+
+The encode family of functions will take an image raw buffer and its
+parameters and compress it in memory, returning the new buffer.
+Likewise, the decode functions will read from the given location in memory
+and return the uncompressed image.
+
+The read and write functions will, respectively, encode and decode to or
+from an Eet file, under the specified key.
+
+These functions are fairly low level and the same functionality can be
+achieved using Evas and Edje, making it much easier to work with images
+as well as not needing to worry about things like scaling them.
+
+
+.. _Eet_Data_Group:
+
+Eet Data Serialization
+----------------------
+
+Convenience functions to serialize and parse complex data
+structures to binary blobs.
+
+While Eet core just handles binary blobs, it is often required
+to save some structured data of different types, such as
+strings, integers, lists, hashes and so on.
+
+Eet can serialize and then parse data types given some
+construction instructions. These are defined in two levels:
+
+- :ref:`Eet_Data_Descriptor_Class` to tell generic memory handling,
+ such as the size of the type, how to allocate memory, strings,
+ lists, hashes and so on.
+
+- :ref:`Eet_Data_Descriptor` to tell inside such type, the members and
+ their offsets inside the memory blob, their types and
+ names. These members can be simple types or other
+ #Eet_Data_Descriptor, allowing hierarchical types to be
+ defined.
+
+Given that C provides no introspection, this process can be
+quite cumbersome, so we provide lots of macros and convenience
+functions to aid creating the types.
+
+"""
+
+def init():
+ """
+
+ Initialize the EET library.
+
+ The first time this function is called, it will perform all the internal
+ initialization required for the library to function properly and increment
+ the initialization counter. Any subsequent call only increment this counter
+ and return its new value, so it's safe to call this function more than once.
+
+ :return: The new init count. Will be 0 if initialization failed.
+
+ :since: 1.0.0
+
+ """
+ return eet_init()
+
+def shutdown():
+ """
+
+ Shut down the EET library.
+
+ If eet_init() was called more than once for the running application,
+ eet_shutdown() will decrement the initialization counter and return its
+ new value, without doing anything else. When the counter reaches 0, all
+ of the internal elements will be shutdown and any memory used freed.
+
+ :return: The new init count.
+
+ :since: 1.0.0
+
+ """
+ return eet_shutdown()
+
+def clearcache():
+ """
+
+ Clear eet cache
+
+ For a faster access to previously accessed data, Eet keeps an internal
+ cache of files. These files will be freed automatically only when
+ they are unused and the cache gets full, in order based on the last time
+ they were used.
+ On systems with little memory this may present an unnecessary constraint,
+ so eet_clearcache() is available for users to reclaim the memory used by
+ files that are no longer needed. Those that were open using
+ EET_FILE_MODE_WRITE or EET_FILE_MODE_READ_WRITE and have modifications,
+ will be written down to disk before flushing them from memory.
+
+ :since: 1.0.0
+
+ """
+ eet_clearcache()
+
+cdef list eet_errors = [
+ "No error, it's all fine!",
+ "Given object or handle is NULL or invalid",
+ "There was nothing to do",
+ "Could not write to file or file is #EET_FILE_MODE_READ",
+ "Could not allocate memory",
+ "Failed to write data to destination",
+ "Failed to write file since it is too big",
+ "Failed to write due a generic Input/Output error",
+ "Failed to write due out of space",
+ "Failed to write because file was closed",
+ "Could not mmap file",
+ "Could not encode using X509",
+ "Could not validate signature",
+ "Signature is invalid",
+ "File or contents are not signed",
+ "Function is not implemented",
+ "Could not introduce random seed",
+ "Could not encrypt contents",
+ "Could not decrypt contents",
+]
+
+class EetError(Exception):
+ def __init__(self, code):
+ Exception.__init__(self, eet_errors[code])
+
+include "dictionary.pxi"
+include "file.pxi"
diff --git a/efl/eet/enums.pxd b/efl/eet/enums.pxd
new file mode 100644
index 0000000..ea4a9ab
--- /dev/null
+++ b/efl/eet/enums.pxd
@@ -0,0 +1,50 @@
+
+cdef extern from "Eet.h":
+
+ enum _Eet_Error:
+ EET_ERROR_NONE #No error, it's all fine!
+ EET_ERROR_BAD_OBJECT #Given object or handle is NULL or invalid
+ EET_ERROR_EMPTY #There was nothing to do
+ EET_ERROR_NOT_WRITABLE #Could not write to file or file is #EET_FILE_MODE_READ
+ EET_ERROR_OUT_OF_MEMORY #Could not allocate memory
+ EET_ERROR_WRITE_ERROR #Failed to write data to destination
+ EET_ERROR_WRITE_ERROR_FILE_TOO_BIG #Failed to write file since it is too big
+ EET_ERROR_WRITE_ERROR_IO_ERROR #Failed to write due a generic Input/Output error
+ EET_ERROR_WRITE_ERROR_OUT_OF_SPACE #Failed to write due out of space
+ EET_ERROR_WRITE_ERROR_FILE_CLOSED #Failed to write because file was closed
+ EET_ERROR_MMAP_FAILED #Could not mmap file
+ EET_ERROR_X509_ENCODING_FAILED #Could not encode using X509
+ EET_ERROR_SIGNATURE_FAILED #Could not validate signature
+ EET_ERROR_INVALID_SIGNATURE #Signature is invalid
+ EET_ERROR_NOT_SIGNED #File or contents are not signed
+ EET_ERROR_NOT_IMPLEMENTED #Function is not implemented
+ EET_ERROR_PRNG_NOT_SEEDED #Could not introduce random seed
+ EET_ERROR_ENCRYPT_FAILED #Could not encrypt contents
+ EET_ERROR_DECRYPT_FAILED #Could not decrypt contents
+
+ ctypedef _Eet_Error Eet_Error
+
+ ctypedef enum _Eet_Compression:
+ EET_COMPRESSION_NONE #No compression at all @since 1.7
+ EET_COMPRESSION_DEFAULT #Default compression (Zlib) @since 1.7
+ EET_COMPRESSION_LOW #Fast but minimal compression (Zlib) @since 1.7
+ EET_COMPRESSION_MED #Medium compression level (Zlib) @since 1.7
+ EET_COMPRESSION_HI #Slow but high compression level (Zlib) @since 1.7
+ EET_COMPRESSION_VERYFAST #Very fast, but lower compression ratio (LZ4HC) @since 1.7
+ EET_COMPRESSION_SUPERFAST #Very fast, but lower compression ratio (faster to compress than EET_COMPRESSION_VERYFAST) (LZ4) @since 1.7
+
+ EET_COMPRESSION_LOW2 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_MED1 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_MED2 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_HI1 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_HI2 #Space filler for compatibility. Don't use it @since 1.7
+
+ ctypedef _Eet_Compression Eet_Compression
+
+ ctypedef enum _Eet_File_Mode:
+ EET_FILE_MODE_INVALID
+ EET_FILE_MODE_READ #File is read-only.
+ EET_FILE_MODE_WRITE #File is write-only.
+ EET_FILE_MODE_READ_WRITE #File is for both read and write
+
+ ctypedef _Eet_File_Mode Eet_File_Mode
diff --git a/efl/eet/file.pxi b/efl/eet/file.pxi
new file mode 100644
index 0000000..b13a61f
--- /dev/null
+++ b/efl/eet/file.pxi
@@ -0,0 +1,1356 @@
+from libc.stdlib cimport free
+from cpython cimport PyUnicode_AsUTF8String
+from efl.utils.conversions cimport _ctouni, array_of_strings_to_python_list
+
+cimport efl.eet.enums as enums
+
+EET_FILE_MODE_INVALID = enums.EET_FILE_MODE_INVALID
+EET_FILE_MODE_READ = enums.EET_FILE_MODE_READ
+EET_FILE_MODE_WRITE = enums.EET_FILE_MODE_WRITE
+EET_FILE_MODE_READ_WRITE = enums.EET_FILE_MODE_READ_WRITE
+
+
+cdef class EetEntry(object):
+ """
+
+ Eet files may contains multiple Entries per file, this handle describe them. You can get that handle from an iterator given by eet_list_entries().
+
+ :see: eet_list_entries()
+ :since: 1.8.0
+
+ """
+
+ cdef Eet_Entry *ee
+
+ property name:
+ """The entry name"""
+ def __get__(self):
+ return _ctouni(self.ee.name)
+
+ def __set__(self, value):
+ if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
+ self.ee.name = value
+
+ property offset:
+ """Where it start in the file"""
+ def __get__(self):
+ return self.ee.offset
+
+ def __set__(self, int value):
+ self.ee.offset = value
+
+ property size:
+ """The size on disk"""
+ def __get__(self):
+ return self.ee.size
+
+ def __set__(self, int value):
+ self.ee.size = value
+
+ property data_size:
+ """The decompressed size if relevant"""
+ def __get__(self):
+ return self.ee.data_size
+
+ def __set__(self, int value):
+ self.ee.data_size = value
+
+ property compression:
+ """Is this data compressed ?"""
+ def __get__(self):
+ return bool(self.ee.compression)
+
+ def __set__(self, bint value):
+ self.ee.compression = value
+
+ property ciphered:
+ """Is it ciphered ?"""
+ def __get__(self):
+ return bool(self.ee.ciphered)
+
+ def __set__(self, bint value):
+ self.ee.ciphered = value
+
+ property alias:
+ """Is it an alias ?"""
+ def __get__(self):
+ return bool(self.ee.alias)
+
+ def __set__(self, bint value):
+ self.ee.alias = value
+
+
+cdef class EetFile(object):
+
+ """
+
+ Opaque handle that defines an Eet file (or memory).
+
+ This handle will be returned by the functions eet_open() and
+ eet_memopen_read() and is used by every other function that affects the
+ file in any way. When you are done with it, call eet_close() to close it
+ and, if the file was open for writing, write down to disk any changes made
+ to it.
+
+ """
+
+ cdef:
+ Eet_File *ef
+
+ def __init__(self, filename, Eet_File_Mode mode):
+ """
+
+ Open an eet file on disk, and returns a handle to it.
+
+ :param file: The file path to the eet file. eg: @c "/tmp/file.eet".
+ :param mode: The mode for opening. Either #EET_FILE_MODE_READ,
+ #EET_FILE_MODE_WRITE or #EET_FILE_MODE_READ_WRITE.
+
+ :return: An opened eet file handle.
+
+ This function will open an exiting eet file for reading, and build
+ the directory table in memory and return a handle to the file, if it
+ exists and can be read, and no memory errors occur on the way, otherwise
+ NULL will be returned.
+
+ It will also open an eet file for writing. This will, if successful,
+ delete the original file and replace it with a new empty file, till
+ the eet file handle is closed or flushed. If it cannot be opened for
+ writing or a memory error occurs, NULL is returned.
+
+ You can also open the file for read/write. If you then write a key that
+ does not exist it will be created, if the key exists it will be replaced
+ by the new data.
+
+ If the same file is opened multiple times, then the same file handle will
+ be returned as eet maintains an internal list of all currently open
+ files. Note that it considers files opened for read only and those opened
+ for read/write and write only as 2 separate sets. Those that do not write
+ to the file and those that do. Eet will allow 2 handles to the same file
+ if they are in the 2 separate lists/groups. That means opening a file for
+ read only looks in the read only set, and returns a handle to that file
+ handle and increments its reference count. If you open a file for read/write
+ or write only it looks in the write set and returns a handle after
+ incrementing the reference count. You need to close an eet file handle
+ as many times as it has been opened to maintain correct reference counts.
+ Files whose modified timestamp or size do not match those of the existing
+ referenced file handles will not be returned and a new handle will be
+ returned instead.
+
+ :since: 1.0.0
+
+ """
+ if isinstance(filename, unicode): PyUnicode_AsUTF8String(filename)
+ self.ef = eet_open(filename, mode)
+
+ # @classmethod
+ # def mmap(self, file):
+ # """
+
+ # Open an eet file on disk from an Eina_File handle, and returns a handle to it.
+
+ # :param file: The Eina_File handle to map to an eet file.
+ # :return: An opened eet file handle.
+
+ # This function will open an exiting eet file for reading, and build
+ # the directory table in memory and return a handle to the file, if it
+ # exists and can be read, and no memory errors occur on the way, otherwise
+ # NULL will be returned.
+
+ # This function can't open file for writing only read only mode is supported for now.
+
+ # If the same file is opened multiple times, then the same file handle will
+ # be returned as eet maintains an internal list of all currently open
+ # files. That means opening a file for read only looks in the read only set,
+ # and returns a handle to that file handle and increments its reference count.
+ # You need to close an eet file handle as many times as it has been opened to
+ # maintain correct reference counts.
+
+ # :since: 1.8.0
+
+ # """
+ # Eet_File *eet_mmap(const Eina_File *file)
+
+ # @classmethod
+ # def memopen_read(self, data, size):
+ # """
+
+ # Open an eet file directly from a memory location. The data is not copied,
+ # so you must keep it around as long as the eet file is open. There is
+ # currently no cache for this kind of Eet_File, so it's reopened every time
+ # you use eet_memopen_read.
+
+ # :param data: Address of file in memory.
+ # :param size: Size of memory to be read.
+ # :return: A handle to the file.
+
+ # Files opened this way will always be in read-only mode.
+
+ # :since: 1.1.0
+
+ # """
+ # Eet_File *eet_memopen_read(const void *data, size_t size)
+
+ property mode:
+ """
+
+ Get the mode an Eet_File was opened with.
+
+ :type: Eet_File_Mode
+
+ :since: 1.0.0
+
+ """
+ def __get__(self):
+ return eet_mode_get(self.ef)
+
+ def close(self):
+ """
+
+ Close an eet file handle and flush pending writes.
+
+ :return: An eet error identifier.
+
+ This function will flush any pending writes to disk if the eet file
+ was opened for write, and free all data associated with the file handle
+ and file, and close the file. If it was opened for read (or read/write),
+ the file handle may still be held open internally for caching purposes.
+ To flush speculatively held eet file handles use eet_clearcache().
+
+ If the eet file handle is not valid nothing will be done.
+
+ :since: 1.0.0
+
+ :see: eet_clearcache()
+
+ """
+ cdef Eet_Error ret = eet_close(self.ef)
+ if ret != enums.EET_ERROR_NONE:
+ raise EetError(ret)
+
+ def sync(self):
+ """
+
+ Sync content of an eet file handle, flushing pending writes.
+
+ :return: An eet error identifier.
+
+ This function will flush any pending writes to disk. The eet file must
+ be opened for write.
+
+ If the eet file handle is not valid nothing will be done.
+
+ :since: 1.2.4
+
+ """
+ cdef Eet_Error ret = eet_sync(self.ef)
+ if ret != enums.EET_ERROR_NONE:
+ raise EetError(ret)
+
+ property dictionary:
+ """
+
+ Return a handle to the shared string dictionary of the Eet file
+
+ :return: A handle to the dictionary of the file
+
+ This function returns a handle to the dictionary of an Eet file whose
+ handle is @p ef, if a dictionary exists. NULL is returned otherwise or
+ if the file handle is known to be invalid.
+
+ :see: eet_dictionary_string_check() to know if given string came
+ from the dictionary or it was dynamically allocated using
+ the #Eet_Data_Descriptor_Class instructions.
+
+ :since: 1.0.0
+
+ """
+ def __get__(self):
+ cdef EetDictionary ret = EetDictionary.__new__(EetDictionary)
+ ret.ed = eet_dictionary_get(self.ef)
+ return ret
+
+ def read_string(self, name):
+ """
+
+ Read a specified entry from an eet file and return data
+
+ :param name: Name of the entry. eg: "/base/file_i_want".
+ :param size_ret: Number of bytes read from entry and returned.
+ :return: The data stored in that entry in the eet file.
+
+ This function finds an entry in the eet file that is stored under the
+ name specified, and returns that data, decompressed, if successful.
+ NULL is returned if the lookup fails or if memory errors are
+ encountered. It is the job of the calling program to call free() on
+ the returned data. The number of bytes in the returned data chunk are
+ placed in size_ret.
+
+ If the eet file handle is not valid NULL is returned and size_ret is
+ filled with 0.
+
+ :see: eet_read_cipher()
+
+ :since: 1.0.0
+
+ """
+ cdef:
+ void *buf
+ int size_ret
+
+ if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+
+ buf = eet_read(self.ef, name, &size_ret)
+
+ ret = buf
+
+ free(buf)
+
+ return ret
+
+ # def read_direct(self, name):
+ # """
+
+ # Read a specified entry from an eet file and return data
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param size_ret: Number of bytes read from entry and returned.
+ # :return: The data stored in that entry in the eet file.
+
+ # This function finds an entry in the eet file that is stored under the
+ # name specified, and returns that data if not compressed and successful.
+ # NULL is returned if the lookup fails or if memory errors are
+ # encountered or if the data is compressed. The calling program must never
+ # call free() on the returned data. The number of bytes in the returned
+ # data chunk are placed in size_ret.
+
+ # If the eet file handle is not valid NULL is returned and size_ret is
+ # filled with 0.
+
+ # :since: 1.0.0
+
+ # """
+ # cdef:
+ # const_void *ret
+ # int size_ret
+
+ # if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+ # ret = eet_read_direct(self.ef, name, &size_ret)
+
+ # def write(self, name, data, int size, bint compress):
+ # """
+
+ # Write a specified entry to an eet file handle
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param data: Pointer to the data to be stored.
+ # :param size: Length in bytes in the data to be stored.
+ # :param compress: Compression flags (1 == compress, 0 = don't compress).
+ # :return: bytes written on successful write, 0 on failure.
+
+ # This function will write the specified chunk of data to the eet file
+ # and return greater than 0 on success. 0 will be returned on failure.
+
+ # The eet file handle must be a valid file handle for an eet file opened
+ # for writing. If it is not, 0 will be returned and no action will be
+ # performed.
+
+ # Name, and data must not be NULL, and size must be > 0. If these
+ # conditions are not met, 0 will be returned.
+
+ # The data will be copied (and optionally compressed) in ram, pending
+ # a flush to disk (it will stay in ram till the eet file handle is
+ # closed though).
+
+ # :see: eet_write_cipher()
+
+ # :since: 1.0.0
+
+ # """
+ # cdef:
+ # const_void *ret
+ # int size_ret
+
+ # if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+
+ # ret = eet_write(self.ef, name, data, size, compress)
+ # if ret == 0:
+ # raise RuntimeError
+
+ def delete(self, name):
+ """
+
+ Delete a specified entry from an Eet file being written or re-written
+
+ :param name: Name of the entry. eg: "/base/file_i_want".
+ :return: Success or failure of the delete.
+
+ This function will delete the specified chunk of data from the eet file
+ and return greater than 0 on success. 0 will be returned on failure.
+
+ The eet file handle must be a valid file handle for an eet file opened
+ for writing. If it is not, 0 will be returned and no action will be
+ performed.
+
+ Name, must not be NULL, otherwise 0 will be returned.
+
+ :since: 1.0.0
+
+ """
+ if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+ if not eet_delete(self.ef, name):
+ raise RuntimeError
+
+ def alias(self, name, destination, int compress):
+ """
+
+ Alias a specific section to another one. Destination may exist or not,
+ no checks are done.
+
+ :param name: Name of the new entry. eg: "/base/file_i_want".
+ :param destination: Actual source of the aliased entry eg: "/base/the_real_stuff_i_want".
+ :param compress: Compression flags (1 == compress, 0 = don't compress).
+ :return: EINA_TRUE on success, EINA_FALSE on failure.
+
+ Name and Destination must not be NULL, otherwise EINA_FALSE will be returned.
+ The equivalent of this would be calling 'ln -s destination name'
+
+ :since: 1.3.3
+
+ """
+ if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+ if isinstance(destination, unicode):
+ destination = PyUnicode_AsUTF8String(destination)
+
+ if not eet_alias(self.ef, name, destination, compress):
+ raise RuntimeError
+
+ property filename:
+ """
+
+ Retrieve the filename of an Eet_File
+
+ :type: string
+
+ .. note::
+
+ This function will return None for files opened with
+ :py:meth:`memopen_read`
+
+ :since: 1.6
+
+ """
+ def __get__(self):
+ return _ctouni(eet_file_get(self.ef))
+
+ def alias_get(self, name):
+ """
+
+ Retrieve the destination name of an alias
+
+ :param name: Name of the entry. eg: "/base/file_i_want"
+ :return: Destination of the alias. eg: "/base/the_real_stuff_i_want", NULL on failure
+
+ Name must not be NULL, otherwise NULL will be returned.
+
+ :since: 1.5
+
+ """
+ if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+ return _ctouni(eet_alias_get(self.ef, name))
+
+ def list(self, glob):
+ """
+
+ List all entries in eet file matching shell glob.
+
+ :param glob: A shell glob to match against.
+ :param count_ret: Number of entries found to match.
+ :return: Pointer to an array of strings.
+
+ This function will list all entries in the eet file matching the
+ supplied shell glob and return an allocated list of their names, if
+ there are any, and if no memory errors occur.
+
+ The eet file handle must be valid and glob must not be NULL, or NULL
+ will be returned and count_ret will be filled with 0.
+
+ The calling program must call free() on the array returned, but NOT
+ on the string pointers in the array. They are taken as read-only
+ internals from the eet file handle. They are only valid as long as
+ the file handle is not closed. When it is closed those pointers in the
+ array are now not valid and should not be used.
+
+ On success the array returned will have a list of string pointers
+ that are the names of the entries that matched, and count_ret will have
+ the number of entries in this array placed in it.
+
+ Hint: an easy way to list all entries in an eet file is to use a glob
+ value of "*".
+
+ :since: 1.0.0
+
+ """
+ cdef:
+ int count_ret
+ char **cret
+ list ret
+
+ if isinstance(glob, unicode): glob = PyUnicode_AsUTF8String(glob)
+
+ cret = eet_list(self.ef, glob, &count_ret)
+ ret = array_of_strings_to_python_list(cret, count_ret)
+ free(cret)
+ return ret
+
+ # def list_entries(self):
+ # """
+
+ # Return an iterator that will describe each entry of an Eet_File.
+
+ # :return: An interator of Eet_Entry.
+
+ # :since: 1.8.0
+
+ # """
+
+ # Eina_Iterator *eet_list_entries(self.ef)
+
+ property num_entries:
+ """
+
+ Return the number of entries in the specified eet file.
+
+ :return: Number of entries in ef or -1 if the number of entries
+ cannot be read due to open mode restrictions.
+
+ :since: 1.0.0
+
+ """
+ def __get__(self):
+ return eet_num_entries(self.ef)
+
+ # def read_cipher(self, name, cipher_key):
+ # """
+
+ # Read a specified entry from an eet file and return data using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param size_ret: Number of bytes read from entry and returned.
+ # :param cipher_key: The key to use as cipher.
+ # :return: The data stored in that entry in the eet file.
+
+ # This function finds an entry in the eet file that is stored under the
+ # name specified, and returns that data, decompressed, if successful.
+ # NULL is returned if the lookup fails or if memory errors are
+ # encountered. It is the job of the calling program to call free() on
+ # the returned data. The number of bytes in the returned data chunk are
+ # placed in size_ret.
+
+ # If the eet file handle is not valid NULL is returned and size_ret is
+ # filled with 0.
+
+ # :see: eet_read()
+
+ # :since: 1.0.0
+
+ # """
+ # void *
+ # eet_read_cipher(self.ef,
+ # const char *name,
+ # int *size_ret,
+ # const char *cipher_key)
+
+ # def write_cipher(self, name, data, size, compress, cipher_key):
+ # """
+
+ # Write a specified entry to an eet file handle using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param data: Pointer to the data to be stored.
+ # :param size: Length in bytes in the data to be stored.
+ # :param compress: Compression flags (1 == compress, 0 = don't compress).
+ # :param cipher_key: The key to use as cipher.
+ # :return: bytes written on successful write, 0 on failure.
+
+ # This function will write the specified chunk of data to the eet file
+ # and return greater than 0 on success. 0 will be returned on failure.
+
+ # The eet file handle must be a valid file handle for an eet file opened
+ # for writing. If it is not, 0 will be returned and no action will be
+ # performed.
+
+ # Name, and data must not be NULL, and size must be > 0. If these
+ # conditions are not met, 0 will be returned.
+
+ # The data will be copied (and optionally compressed) in ram, pending
+ # a flush to disk (it will stay in ram till the eet file handle is
+ # closed though).
+
+ # :see: eet_write()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_write_cipher(self.ef,
+ # const char *name,
+ # const void *data,
+ # int size,
+ # int compress,
+ # const char *cipher_key)
+
+ # def data_image_header_read(self, name, w, h, alpha, compress, quality, lossy):
+ # """
+
+ # Read just the header data for an image and dont decode the pixels.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param w: A pointer to the unsigned int to hold the width in pixels.
+ # :param h: A pointer to the unsigned int to hold the height in pixels.
+ # :param alpha: A pointer to the int to hold the alpha flag.
+ # :param compress: A pointer to the int to hold the compression amount.
+ # :param quality: A pointer to the int to hold the quality amount.
+ # :param lossy: A pointer to the int to hold the lossiness flag.
+ # :return: 1 on successful decode, 0 otherwise
+
+ # Reads and decodes the image header data stored under the given key and
+ # Eet file.
+
+ # The information decoded is placed in each of the parameters, which must be
+ # provided. The width and height, measured in pixels, will be stored under
+ # the variables pointed by @p w and @p h, respectively. If the read or
+ # decode of the header fails, this values will be 0. The @p alpha parameter
+ # will be 1 or 0, denoting if the alpha channel of the image is used or not.
+ # If the image was losslessly compressed, the @p compress parameter will hold
+ # the compression amount used, ranging from 0 to 9 and @p lossy will be 0.
+ # In the case of lossy compression, @p lossy will be 1, and the compression
+ # quality will be placed under @p quality, with a value ranging from 0 to 100.
+
+ # :see: eet_data_image_header_decode()
+ # :see: eet_data_image_header_read_cipher()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_image_header_read(self.ef,
+ # const char *name,
+ # unsigned int *w,
+ # unsigned int *h,
+ # int *alpha,
+ # int *compress,
+ # int *quality,
+ # int *lossy)
+
+ # def data_image_read(self, name, w, h, alpha, compress, quality, lossy):
+ # """
+
+ # Read image data from the named key in the eet file.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param w: A pointer to the unsigned int to hold the width in pixels.
+ # :param h: A pointer to the unsigned int to hold the height in pixels.
+ # :param alpha: A pointer to the int to hold the alpha flag.
+ # :param compress: A pointer to the int to hold the compression amount.
+ # :param quality: A pointer to the int to hold the quality amount.
+ # :param lossy: A pointer to the int to hold the lossiness flag.
+ # :return: The image pixel data decoded
+
+ # Reads and decodes the image stored in the given Eet file under the named
+ # key.
+
+ # The returned pixel data is a linear array of pixels starting from the
+ # top-left of the image, scanning row by row from left to right. Each pile
+ # is a 32bit value, with the high byte being the alpha channel, the next being
+ # red, then green, and the low byte being blue.
+
+ # The rest of the parameters are the same as in eet_data_image_header_read().
+
+ # On success the function returns a pointer to the image data decoded. The
+ # calling application is responsible for calling free() on the image data
+ # when it is done with it. On failure NULL is returned and the parameter
+ # values may not contain any sensible data.
+
+ # :see: eet_data_image_header_read()
+ # :see: eet_data_image_decode()
+ # :see: eet_data_image_read_cipher()
+ # :see: eet_data_image_read_to_surface()
+
+ # :since: 1.0.0
+
+ # """
+ # void *
+ # eet_data_image_read(self.ef,
+ # const char *name,
+ # unsigned int *w,
+ # unsigned int *h,
+ # int *alpha,
+ # int *compress,
+ # int *quality,
+ # int *lossy)
+
+ # def data_image_read_to_surface(self, name, src_x, src_y, d, w, h, row_stride, alpha, compress, quality, lossy):
+ # """
+
+ # Read image data from the named key in the eet file and store it in the given buffer.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param src_x: The starting x coordinate from where to dump the stream.
+ # :param src_y: The starting y coordinate from where to dump the stream.
+ # :param d: A pointer to the pixel surface.
+ # :param w: The expected width in pixels of the pixel surface to decode.
+ # :param h: The expected height in pixels of the pixel surface to decode.
+ # :param row_stride: The length of a pixels line in the destination surface.
+ # :param alpha: A pointer to the int to hold the alpha flag.
+ # :param compress: A pointer to the int to hold the compression amount.
+ # :param quality: A pointer to the int to hold the quality amount.
+ # :param lossy: A pointer to the int to hold the lossiness flag.
+ # :return: 1 on success, 0 otherwise.
+
+ # Reads and decodes the image stored in the given Eet file, placing the
+ # resulting pixel data in the buffer pointed by the user.
+
+ # Like eet_data_image_read(), it takes the image data stored under the
+ # @p name key in the @p ef file, but instead of returning a new buffer with
+ # the pixel data, it places the result in the buffer pointed by @p d, which
+ # must be provided by the user and of sufficient size to hold the requested
+ # portion of the image.
+
+ # The @p src_x and @p src_y parameters indicate the top-left corner of the
+ # section of the image to decode. These have to be higher or equal than 0 and
+ # less than the respective total width and height of the image. The width
+ # and height of the section of the image to decode are given in @p w and @p h
+ # and also can't be higher than the total width and height of the image.
+
+ # The @p row_stride parameter indicates the length in bytes of each line in
+ # the destination buffer and it has to be at least @p w * 4.
+
+ # All the other parameters are the same as in eet_data_image_read().
+
+ # On success the function returns 1, and 0 on failure. On failure the
+ # parameter values may not contain any sensible data.
+
+ # :see: eet_data_image_read()
+ # :see: eet_data_image_decode()
+ # :see: eet_data_image_decode_to_surface()
+ # :see: eet_data_image_read_to_surface_cipher()
+
+ # :since: 1.0.2
+
+ # """
+ # int
+ # eet_data_image_read_to_surface(self.ef,
+ # const char *name,
+ # unsigned int src_x,
+ # unsigned int src_y,
+ # unsigned int *d,
+ # unsigned int w,
+ # unsigned int h,
+ # unsigned int row_stride,
+ # int *alpha,
+ # int *compress,
+ # int *quality,
+ # int *lossy)
+
+ # def data_image_write(self, name, data, w, h, alpha, compress, quality, lossy):
+ # """
+
+ # Write image data to the named key in an eet file.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param data: A pointer to the image pixel data.
+ # :param w: The width of the image in pixels.
+ # :param h: The height of the image in pixels.
+ # :param alpha: The alpha channel flag.
+ # :param compress: The compression amount.
+ # :param quality: The quality encoding amount.
+ # :param lossy: The lossiness flag.
+ # :return: Success if the data was encoded and written or not.
+
+ # This function takes image pixel data and encodes it in an eet file
+ # stored under the supplied name key, and returns how many bytes were
+ # actually written to encode the image data.
+
+ # The data expected is the same format as returned by eet_data_image_read.
+ # If this is not the case weird things may happen. Width and height must
+ # be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
+ # the alpha values are not useful and 1 meaning they are). Compress can
+ # be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
+ # This is only used if the image is not lossily encoded. Quality is used on
+ # lossy compression and should be a value from 0 to 100. The lossy flag
+ # can be 0 or 1. 0 means encode losslessly and 1 means to encode with
+ # image quality loss (but then have a much smaller encoding).
+
+ # On success this function returns the number of bytes that were required
+ # to encode the image data, or on failure it returns 0.
+
+ # :see: eet_data_image_read()
+ # :see: eet_data_image_encode()
+ # :see: eet_data_image_write_cipher()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_image_write(self.ef,
+ # const char *name,
+ # const void *data,
+ # unsigned int w,
+ # unsigned int h,
+ # int alpha,
+ # int compress,
+ # int quality,
+ # int lossy)
+
+ # def data_image_header_read_cipher(self, name, cipher_key, w, h, alpha, compress, quality, lossy):
+ # """
+
+ # Read just the header data for an image and dont decode the pixels using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param cipher_key: The key to use as cipher.
+ # :param w: A pointer to the unsigned int to hold the width in pixels.
+ # :param h: A pointer to the unsigned int to hold the height in pixels.
+ # :param alpha: A pointer to the int to hold the alpha flag.
+ # :param compress: A pointer to the int to hold the compression amount.
+ # :param quality: A pointer to the int to hold the quality amount.
+ # :param lossy: A pointer to the int to hold the lossiness flag.
+ # :return: 1 on successful decode, 0 otherwise
+
+ # This function reads an image from an eet file stored under the named
+ # key in the eet file and return a pointer to the decompressed pixel data.
+
+ # The other parameters of the image (width, height etc.) are placed into
+ # the values pointed to (they must be supplied). The pixel data is a linear
+ # array of pixels starting from the top-left of the image scanning row by
+ # row from left to right. Each pixel is a 32bit value, with the high byte
+ # being the alpha channel, the next being red, then green, and the low byte
+ # being blue. The width and height are measured in pixels and will be
+ # greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
+ # that the alpha channel is not used. 1 denotes that it is significant.
+ # Compress is filled with the compression value/amount the image was
+ # stored with. The quality value is filled with the quality encoding of
+ # the image file (0 - 100). The lossy flags is either 0 or 1 as to if
+ # the image was encoded lossily or not.
+
+ # On success the function returns 1 indicating the header was read and
+ # decoded properly, or 0 on failure.
+
+ # :see: eet_data_image_header_read()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_image_header_read_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key,
+ # unsigned int *w,
+ # unsigned int *h,
+ # int *alpha,
+ # int *compress,
+ # int *quality,
+ # int *lossy)
+
+ # def data_image_read_cipher(self, name, cipher_key, w, h, alpha, compress, quality, lossy):
+ # """
+
+ # Read image data from the named key in the eet file using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param cipher_key: The key to use as cipher.
+ # :param w: A pointer to the unsigned int to hold the width in pixels.
+ # :param h: A pointer to the unsigned int to hold the height in pixels.
+ # :param alpha: A pointer to the int to hold the alpha flag.
+ # :param compress: A pointer to the int to hold the compression amount.
+ # :param quality: A pointer to the int to hold the quality amount.
+ # :param lossy: A pointer to the int to hold the lossiness flag.
+ # :return: The image pixel data decoded
+
+ # This function reads an image from an eet file stored under the named
+ # key in the eet file and return a pointer to the decompressed pixel data.
+
+ # The other parameters of the image (width, height etc.) are placed into
+ # the values pointed to (they must be supplied). The pixel data is a linear
+ # array of pixels starting from the top-left of the image scanning row by
+ # row from left to right. Each pixel is a 32bit value, with the high byte
+ # being the alpha channel, the next being red, then green, and the low byte
+ # being blue. The width and height are measured in pixels and will be
+ # greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
+ # that the alpha channel is not used. 1 denotes that it is significant.
+ # Compress is filled with the compression value/amount the image was
+ # stored with. The quality value is filled with the quality encoding of
+ # the image file (0 - 100). The lossy flags is either 0 or 1 as to if
+ # the image was encoded lossily or not.
+
+ # On success the function returns a pointer to the image data decoded. The
+ # calling application is responsible for calling free() on the image data
+ # when it is done with it. On failure NULL is returned and the parameter
+ # values may not contain any sensible data.
+
+ # :see: eet_data_image_read()
+
+ # :since: 1.0.0
+
+ # """
+ # void *
+ # eet_data_image_read_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key,
+ # unsigned int *w,
+ # unsigned int *h,
+ # int *alpha,
+ # int *compress,
+ # int *quality,
+ # int *lossy)
+
+ # def data_image_read_to_surface_cipher(self, name, cipher_key, src_x, src_y, d, w, h, row_stride, alpha, compress, quality, lossy):
+ # """
+
+ # Read image data from the named key in the eet file using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param cipher_key: The key to use as cipher.
+ # :param src_x: The starting x coordinate from where to dump the stream.
+ # :param src_y: The starting y coordinate from where to dump the stream.
+ # :param d: A pointer to the pixel surface.
+ # :param w: The expected width in pixels of the pixel surface to decode.
+ # :param h: The expected height in pixels of the pixel surface to decode.
+ # :param row_stride: The length of a pixels line in the destination surface.
+ # :param alpha: A pointer to the int to hold the alpha flag.
+ # :param compress: A pointer to the int to hold the compression amount.
+ # :param quality: A pointer to the int to hold the quality amount.
+ # :param lossy: A pointer to the int to hold the lossiness flag.
+ # :return: 1 on success, 0 otherwise.
+
+ # This function reads an image from an eet file stored under the named
+ # key in the eet file and return a pointer to the decompressed pixel data.
+
+ # The other parameters of the image (width, height etc.) are placed into
+ # the values pointed to (they must be supplied). The pixel data is a linear
+ # array of pixels starting from the top-left of the image scanning row by
+ # row from left to right. Each pixel is a 32bit value, with the high byte
+ # being the alpha channel, the next being red, then green, and the low byte
+ # being blue. The width and height are measured in pixels and will be
+ # greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
+ # that the alpha channel is not used. 1 denotes that it is significant.
+ # Compress is filled with the compression value/amount the image was
+ # stored with. The quality value is filled with the quality encoding of
+ # the image file (0 - 100). The lossy flags is either 0 or 1 as to if
+ # the image was encoded lossily or not.
+
+ # On success the function returns 1, and 0 on failure. On failure the
+ # parameter values may not contain any sensible data.
+
+ # :see: eet_data_image_read_to_surface()
+
+ # :since: 1.0.2
+
+ # """
+ # int
+ # eet_data_image_read_to_surface_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key,
+ # unsigned int src_x,
+ # unsigned int src_y,
+ # unsigned int *d,
+ # unsigned int w,
+ # unsigned int h,
+ # unsigned int row_stride,
+ # int *alpha,
+ # int *compress,
+ # int *quality,
+ # int *lossy)
+
+ # def data_image_write_cipher(self, name, cipher_key, data, w, h, alpha, compress, quality, lossy):
+ # """
+
+ # Write image data to the named key in an eet file using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param cipher_key: The key to use as cipher.
+ # :param data: A pointer to the image pixel data.
+ # :param w: The width of the image in pixels.
+ # :param h: The height of the image in pixels.
+ # :param alpha: The alpha channel flag.
+ # :param compress: The compression amount.
+ # :param quality: The quality encoding amount.
+ # :param lossy: The lossiness flag.
+ # :return: Success if the data was encoded and written or not.
+
+ # This function takes image pixel data and encodes it in an eet file
+ # stored under the supplied name key, and returns how many bytes were
+ # actually written to encode the image data.
+
+ # The data expected is the same format as returned by eet_data_image_read.
+ # If this is not the case weird things may happen. Width and height must
+ # be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
+ # the alpha values are not useful and 1 meaning they are). Compress can
+ # be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
+ # This is only used if the image is not lossily encoded. Quality is used on
+ # lossy compression and should be a value from 0 to 100. The lossy flag
+ # can be 0 or 1. 0 means encode losslessly and 1 means to encode with
+ # image quality loss (but then have a much smaller encoding).
+
+ # On success this function returns the number of bytes that were required
+ # to encode the image data, or on failure it returns 0.
+
+ # :see: eet_data_image_write()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_image_write_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key,
+ # const void *data,
+ # unsigned int w,
+ # unsigned int h,
+ # int alpha,
+ # int compress,
+ # int quality,
+ # int lossy)
+
+ # property identity:
+ # """
+
+ # Set a key to sign a file
+
+
+ # :param key: the key handle to set as identity.
+ # :return: #EET_ERROR_BAD_OBJECT if @p ef is invalid or
+ # #enums.EET_ERROR_NONE on success.
+
+ # :since: 1.2.0
+
+ # """
+ # def __set__(self, key):
+ # Eet_Error eet_identity_set(self.ef, Eet_Key *key)
+
+ # property identity_x509:
+ # """
+
+ # Get the x509 der certificate associated with an Eet_File. Will return NULL
+ # if the file is not signed.
+
+
+ # :param der_length: The length of returned data, may be @c NULL.
+ # :return: the x509 certificate or @c NULL on error.
+
+ # :since: 1.2.0
+
+ # """
+ # def __get__(self):
+ # const void *eet_identity_x509(self.ef, int *der_length)
+
+ # property identity_signature:
+ # """
+
+ # Get the raw signature associated with an Eet_File. Will return NULL
+ # if the file is not signed.
+
+
+ # :param signature_length: The length of returned data, may be @c NULL.
+ # :return: the raw signature or @c NULL on error.
+
+
+ # """
+ # const void *
+ # eet_identity_signature(self.ef,
+ # int *signature_length)
+
+ # property identity_sha1:
+ # """
+
+ # Get the SHA1 associated with a file. Could be the one used to
+ # sign the data or if the data where not signed, it will be the
+ # SHA1 of the file.
+
+
+ # :param sha1_length: The length of returned data, may be @c NULL.
+ # :return: the associated SHA1 or @c NULL on error.
+
+ # :since: 1.2.0
+
+ # """
+ # const void *
+ # eet_identity_sha1(self.ef,
+ # int *sha1_length)
+
+ # def data_read(self, EetDataDecriptor edd, name):
+ # """
+
+ # Read a data structure from an eet file and decodes it.
+
+ # :param edd: The data descriptor handle to use when decoding.
+ # :param name: The key the data is stored under in the eet file.
+ # :return: A pointer to the decoded data structure.
+
+ # This function decodes a data structure stored in an eet file, returning
+ # a pointer to it if it decoded successfully, or NULL on failure. This
+ # can save a programmer dozens of hours of work in writing configuration
+ # file parsing and writing code, as eet does all that work for the program
+ # and presents a program-friendly data structure, just as the programmer
+ # likes. Eet can handle members being added or deleted from the data in
+ # storage and safely zero-fills unfilled members if they were not found
+ # in the data. It checks sizes and headers whenever it reads data, allowing
+ # the programmer to not worry about corrupt data.
+
+ # Once a data structure has been described by the programmer with the
+ # fields they wish to save or load, storing or retrieving a data structure
+ # from an eet file, or from a chunk of memory is as simple as a single
+ # function call.
+
+ # :see: eet_data_read_cipher()
+
+ # :since: 1.0.0
+
+ # """
+ # cdef:
+ # void *ret
+ # if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+ # ret = eet_data_read(self.ef, edd.edd, name)
+
+ # def data_write(self, EetDataDecriptor edd, name, data, int compress):
+ # """
+
+ # Write a data structure from memory and store in an eet file.
+
+ # :param edd: The data descriptor to use when encoding.
+ # :param name: The key to store the data under in the eet file.
+ # :param data: A pointer to the data structure to save and encode.
+ # :param compress: Compression flags for storage.
+ # :return: bytes written on successful write, 0 on failure.
+
+ # This function is the reverse of eet_data_read(), saving a data structure
+ # to an eet file. The file must have been opening in write mode and the data
+ # will be kept in memory until the file is either closed or eet_sync() is
+ # called to flush any unwritten changes.
+
+ # :see: eet_data_write_cipher()
+
+ # :since: 1.0.0
+
+ # """
+ # cdef void *cdata
+ # if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
+ # int eet_data_write(self.ef, edd.edd, name, cdata, compress)
+
+ # def data_dump(self, name, dumpfunc, dumpdata):
+ # """
+
+ # Dump an eet encoded data structure from an eet file into ascii text
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param dumpfunc: The function to call passed a string when new
+ # data is converted to text
+ # :param dumpdata: The data to pass to the @p dumpfunc callback.
+ # :return: 1 on success, 0 on failure
+
+ # This function will take an open and valid eet file from
+ # eet_open() request the data encoded by
+ # eet_data_descriptor_encode() corresponding to the key @p name
+ # and convert it into human readable ascii text. It does this by
+ # calling the @p dumpfunc callback for all new text that is
+ # generated. This callback should append to any existing text
+ # buffer and will be passed the pointer @p dumpdata as a parameter
+ # as well as a string with new text to be appended.
+
+ # :see: eet_data_dump_cipher()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_dump(self.ef,
+ # const char *name,
+ # Eet_Dump_Callback dumpfunc,
+ # void *dumpdata)
+
+ # def data_undump(self, name, text, textlen, compress):
+ # """
+
+ # Take an ascii encoding from eet_data_dump() and re-encode in binary.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param text: The pointer to the string data to parse and encode.
+ # :param textlen: The size of the string in bytes (not including 0
+ # byte terminator).
+ # :param compress: Compression flags (1 == compress, 0 = don't compress).
+ # :return: 1 on success, 0 on failure
+
+ # This function will parse the string pointed to by @p text,
+ # encode it the same way eet_data_descriptor_encode() takes an
+ # in-memory data struct and encodes into a binary blob.
+
+ # The data (optionally compressed) will be in ram, pending a flush to
+ # disk (it will stay in ram till the eet file handle is closed though).
+
+ # :see: eet_data_undump_cipher()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_undump(self.ef,
+ # const char *name,
+ # const char *text,
+ # int textlen,
+ # int compress)
+
+ # def data_read_cipher(self, edd, name, cipher_key):
+ # """
+
+ # Read a data structure from an eet file and decodes it using a cipher.
+
+ # :param edd: The data descriptor handle to use when decoding.
+ # :param name: The key the data is stored under in the eet file.
+ # :param cipher_key: The key to use as cipher.
+ # :return: A pointer to the decoded data structure.
+
+ # This function decodes a data structure stored in an eet file, returning
+ # a pointer to it if it decoded successfully, or NULL on failure. This
+ # can save a programmer dozens of hours of work in writing configuration
+ # file parsing and writing code, as eet does all that work for the program
+ # and presents a program-friendly data structure, just as the programmer
+ # likes. Eet can handle members being added or deleted from the data in
+ # storage and safely zero-fills unfilled members if they were not found
+ # in the data. It checks sizes and headers whenever it reads data, allowing
+ # the programmer to not worry about corrupt data.
+
+ # Once a data structure has been described by the programmer with the
+ # fields they wish to save or load, storing or retrieving a data structure
+ # from an eet file, or from a chunk of memory is as simple as a single
+ # function call.
+
+ # :see: eet_data_read()
+
+ # :since: 1.0.0
+
+ # """
+ # void *
+ # eet_data_read_cipher(self.ef,
+ # Eet_Data_Descriptor *edd,
+ # const char *name,
+ # const char *cipher_key)
+
+ # def data_write_cipher(self, edd, name, cipher_key, data, compress):
+ # """
+
+ # Write a data structure from memory and store in an eet file
+ # using a cipher.
+
+ # :param edd: The data descriptor to use when encoding.
+ # :param name: The key to store the data under in the eet file.
+ # :param cipher_key: The key to use as cipher.
+ # :param data: A pointer to the data structure to save and encode.
+ # :param compress: Compression flags for storage.
+ # :return: bytes written on successful write, 0 on failure.
+
+ # This function is the reverse of eet_data_read_cipher(), saving a data structure
+ # to an eet file.
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_write_cipher(self.ef,
+ # Eet_Data_Descriptor *edd,
+ # const char *name,
+ # const char *cipher_key,
+ # const void *data,
+ # int compress)
+
+ # def data_dump_cipher(self, name, cipher_key, dumpfunc, dumpdata):
+ # """
+
+ # Dump an eet encoded data structure from an eet file into ascii
+ # text using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param cipher_key: The key to use as cipher.
+ # :param dumpfunc: The function to call passed a string when new
+ # data is converted to text
+ # :param dumpdata: The data to pass to the @p dumpfunc callback.
+ # :return: 1 on success, 0 on failure
+
+ # This function will take an open and valid eet file from
+ # eet_open() request the data encoded by
+ # eet_data_descriptor_encode() corresponding to the key @p name
+ # and convert it into human readable ascii text. It does this by
+ # calling the @p dumpfunc callback for all new text that is
+ # generated. This callback should append to any existing text
+ # buffer and will be passed the pointer @p dumpdata as a parameter
+ # as well as a string with new text to be appended.
+
+ # :see: eet_data_dump()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_dump_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key,
+ # Eet_Dump_Callback dumpfunc,
+ # void *dumpdata)
+
+ # def data_undump_cipher(self, name, cipher_key, dumpfunc, dumpdata):
+ # """
+
+ # Take an ascii encoding from eet_data_dump() and re-encode in
+ # binary using a cipher.
+
+ # :param name: Name of the entry. eg: "/base/file_i_want".
+ # :param cipher_key: The key to use as cipher.
+ # :param text: The pointer to the string data to parse and encode.
+ # :param textlen: The size of the string in bytes (not including 0
+ # byte terminator).
+ # :param compress: Compression flags (1 == compress, 0 = don't compress).
+ # :return: 1 on success, 0 on failure
+
+ # This function will parse the string pointed to by @p text,
+ # encode it the same way eet_data_descriptor_encode() takes an
+ # in-memory data struct and encodes into a binary blob.
+
+ # The data (optionally compressed) will be in ram, pending a flush to
+ # disk (it will stay in ram till the eet file handle is closed though).
+
+ # :see: eet_data_undump()
+
+ # :since: 1.0.0
+
+ # """
+ # int
+ # eet_data_undump_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key,
+ # const char *text,
+ # int textlen,
+ # int compress)
+
+ # def data_node_read_cipher(self, name, cipher_key):
+ # """
+
+ # TODO FIX ME
+
+ # """
+ # Eet_Node *
+ # eet_data_node_read_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key)
+
+ # def data_node_write_cipher(self, name, cipher_key, node, compress):
+ # """
+
+ # TODO FIX ME
+
+ # """
+ # int
+ # eet_data_node_write_cipher(self.ef,
+ # const char *name,
+ # const char *cipher_key,
+ # Eet_Node *node,
+ # int compress)
diff --git a/efl/eet/key.pxi b/efl/eet/key.pxi
new file mode 100644
index 0000000..5451077
--- /dev/null
+++ b/efl/eet/key.pxi
@@ -0,0 +1,80 @@
+
+
+
+"""
+
+@typedef Eet_Key
+Opaque handle that defines an identity (also known as key)
+in Eet's cipher system.
+
+"""
+typedef struct _Eet_Key Eet_Key;
+
+
+"""
+
+Callback used to request if needed the password of a private key.
+
+:param buffer: the buffer where to store the password.
+:param size: the maximum password size (size of buffer, including '@\0').
+:param rwflag: if the buffer is also readable or just writable.
+:param data: currently unused, may contain some context in future.
+:return: 1 on success and password was set to @p buffer, 0 on failure.
+
+:since: 1.2.0
+
+"""
+typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag, void *data);
+
+"""
+
+Create an Eet_Key needed for signing an eet file.
+
+The certificate should provide the public that match the private key.
+No verification is done to ensure that.
+
+:param certificate_file: The file where to find the certificate.
+:param private_key_file: The file that contains the private key.
+:param cb: Function to callback if password is required to unlock
+ private key.
+:return: A key handle to use, or @c NULL on failure.
+
+@see eet_identity_close()
+
+@warning You need to compile signature support in EET.
+:since: 1.2.0
+
+"""
+EAPI Eet_Key *
+eet_identity_open(const char *certificate_file,
+ const char *private_key_file,
+ Eet_Key_Password_Callback cb);
+
+"""
+
+Close and release all resource used by an Eet_Key. An
+reference counter prevent it from being freed until all file
+using it are also closed.
+
+:param key: the key handle to close and free resources.
+
+:since: 1.2.0
+
+"""
+EAPI void
+eet_identity_close(Eet_Key *key);
+
+"""
+
+Display both private and public key of an Eet_Key.
+
+:param key: the handle to print.
+:param out: where to print.
+
+@warning You need to compile signature support in EET.
+:since: 1.2.0
+
+"""
+EAPI void
+eet_identity_print(Eet_Key *key,
+ FILE *out);
diff --git a/efl/eet/node.pxi b/efl/eet/node.pxi
new file mode 100644
index 0000000..182d5e2
--- /dev/null
+++ b/efl/eet/node.pxi
@@ -0,0 +1,328 @@
+"""
+
+@typedef Eet_Node
+Opaque handle to manage serialization node.
+
+"""
+typedef struct _Eet_Node Eet_Node;
+
+"""
+
+@typedef Eet_Node_Data
+Contains an union that can fit any kind of node.
+
+"""
+typedef struct _Eet_Node_Data Eet_Node_Data;
+
+"""
+
+@struct _Eet_Node_Data
+Contains an union that can fit any kind of node.
+
+"""
+struct _Eet_Node_Data
+{
+ union {
+ char c;
+ short s;
+ int i;
+ long long l;
+ float f;
+ double d;
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long long ul;
+ const char *str;
+ } value;
+};
+
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_char_new(const char *name,
+ char c);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_short_new(const char *name,
+ short s);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_int_new(const char *name,
+ int i);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_long_long_new(const char *name,
+ long long l);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_float_new(const char *name,
+ float f);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_double_new(const char *name,
+ double d);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_unsigned_char_new(const char *name,
+ unsigned char uc);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_unsigned_short_new(const char *name,
+ unsigned short us);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_unsigned_int_new(const char *name,
+ unsigned int ui);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_unsigned_long_long_new(const char *name,
+ unsigned long long l);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_string_new(const char *name,
+ const char *str);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_inlined_string_new(const char *name,
+ const char *str);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_null_new(const char *name);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_list_new(const char *name,
+ Eina_List *nodes);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_array_new(const char *name,
+ int count,
+ Eina_List *nodes);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_var_array_new(const char *name,
+ Eina_List *nodes);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_hash_new(const char *name,
+ const char *key,
+ Eet_Node *node);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_struct_new(const char *name,
+ Eina_List *nodes);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI Eet_Node *
+eet_node_struct_child_new(const char *parent,
+ Eet_Node *child);
+
+"""
+
+@brief Get a node's child nodes
+:param node: The node
+:return: The first child node which contains a pointer to the
+next child node and the parent.
+:since: 1.5
+
+"""
+EAPI Eet_Node *
+eet_node_children_get(Eet_Node *node);
+
+"""
+
+@brief Get the next node in a list of nodes
+:param node: The node
+:return: A node which contains a pointer to the
+next child node and the parent.
+:since: 1.5
+
+"""
+EAPI Eet_Node *
+eet_node_next_get(Eet_Node *node);
+
+"""
+
+@brief Get the parent node of a node
+:param node: The node
+:return: The parent node of @p node
+:since: 1.5
+
+"""
+EAPI Eet_Node *
+eet_node_parent_get(Eet_Node *node);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI void
+eet_node_list_append(Eet_Node *parent,
+ const char *name,
+ Eet_Node *child);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI void
+eet_node_struct_append(Eet_Node *parent,
+ const char *name,
+ Eet_Node *child);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI void
+eet_node_hash_add(Eet_Node *parent,
+ const char *name,
+ const char *key,
+ Eet_Node *child);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI void
+eet_node_dump(Eet_Node *n,
+ int dumplevel,
+ Eet_Dump_Callback dumpfunc,
+ void *dumpdata);
+
+"""
+
+@brief Return the type of a node
+:param node: The node
+:return: The node's type (EET_T_$TYPE)
+:since: 1.5
+
+"""
+EAPI int
+eet_node_type_get(Eet_Node *node);
+
+"""
+
+@brief Return the node's data
+:param node: The node
+:return: The data contained in the node
+:since: 1.5
+
+"""
+EAPI Eet_Node_Data *
+eet_node_value_get(Eet_Node *node);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI void
+eet_node_del(Eet_Node *n);
+
+"""
+
+TODO FIX ME
+
+"""
+EAPI void *
+eet_data_node_encode_cipher(Eet_Node *node,
+ const char *cipher_key,
+ int *size_ret);
diff --git a/include/efl.eet.enums.pxd b/include/efl.eet.enums.pxd
new file mode 100644
index 0000000..ea4a9ab
--- /dev/null
+++ b/include/efl.eet.enums.pxd
@@ -0,0 +1,50 @@
+
+cdef extern from "Eet.h":
+
+ enum _Eet_Error:
+ EET_ERROR_NONE #No error, it's all fine!
+ EET_ERROR_BAD_OBJECT #Given object or handle is NULL or invalid
+ EET_ERROR_EMPTY #There was nothing to do
+ EET_ERROR_NOT_WRITABLE #Could not write to file or file is #EET_FILE_MODE_READ
+ EET_ERROR_OUT_OF_MEMORY #Could not allocate memory
+ EET_ERROR_WRITE_ERROR #Failed to write data to destination
+ EET_ERROR_WRITE_ERROR_FILE_TOO_BIG #Failed to write file since it is too big
+ EET_ERROR_WRITE_ERROR_IO_ERROR #Failed to write due a generic Input/Output error
+ EET_ERROR_WRITE_ERROR_OUT_OF_SPACE #Failed to write due out of space
+ EET_ERROR_WRITE_ERROR_FILE_CLOSED #Failed to write because file was closed
+ EET_ERROR_MMAP_FAILED #Could not mmap file
+ EET_ERROR_X509_ENCODING_FAILED #Could not encode using X509
+ EET_ERROR_SIGNATURE_FAILED #Could not validate signature
+ EET_ERROR_INVALID_SIGNATURE #Signature is invalid
+ EET_ERROR_NOT_SIGNED #File or contents are not signed
+ EET_ERROR_NOT_IMPLEMENTED #Function is not implemented
+ EET_ERROR_PRNG_NOT_SEEDED #Could not introduce random seed
+ EET_ERROR_ENCRYPT_FAILED #Could not encrypt contents
+ EET_ERROR_DECRYPT_FAILED #Could not decrypt contents
+
+ ctypedef _Eet_Error Eet_Error
+
+ ctypedef enum _Eet_Compression:
+ EET_COMPRESSION_NONE #No compression at all @since 1.7
+ EET_COMPRESSION_DEFAULT #Default compression (Zlib) @since 1.7
+ EET_COMPRESSION_LOW #Fast but minimal compression (Zlib) @since 1.7
+ EET_COMPRESSION_MED #Medium compression level (Zlib) @since 1.7
+ EET_COMPRESSION_HI #Slow but high compression level (Zlib) @since 1.7
+ EET_COMPRESSION_VERYFAST #Very fast, but lower compression ratio (LZ4HC) @since 1.7
+ EET_COMPRESSION_SUPERFAST #Very fast, but lower compression ratio (faster to compress than EET_COMPRESSION_VERYFAST) (LZ4) @since 1.7
+
+ EET_COMPRESSION_LOW2 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_MED1 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_MED2 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_HI1 #Space filler for compatibility. Don't use it @since 1.7
+ EET_COMPRESSION_HI2 #Space filler for compatibility. Don't use it @since 1.7
+
+ ctypedef _Eet_Compression Eet_Compression
+
+ ctypedef enum _Eet_File_Mode:
+ EET_FILE_MODE_INVALID
+ EET_FILE_MODE_READ #File is read-only.
+ EET_FILE_MODE_WRITE #File is write-only.
+ EET_FILE_MODE_READ_WRITE #File is for both read and write
+
+ ctypedef _Eet_File_Mode Eet_File_Mode
diff --git a/setup.py b/setup.py
index ec82c75..a8cde0d 100755
--- a/setup.py
+++ b/setup.py
@@ -189,6 +189,16 @@ if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
)
modules.append(eo_ext)
+ # === Eet ===
+ eet_cflags, eet_libs = pkg_config('Eet', 'eet', EFL_MIN_VERSION)
+ eet_ext = Extension(
+ "eet", ["efl/eet/eet"+module_suffix],
+ include_dirs=['include/'],
+ extra_compile_args=eet_cflags,
+ extra_link_args=eet_libs + eina_libs
+ )
+ modules.append(eet_ext)
+
# === Utilities ===
utils_ext = [
Extension(