1357 lines
53 KiB
Cython
1357 lines
53 KiB
Cython
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 = <char *>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)
|