summaryrefslogtreecommitdiff
path: root/src/lib/emile
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-03-17 08:50:33 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-17 09:58:19 +0100
commit2734fde87f3862616489c7235d4194371e2c7d69 (patch)
tree8dd5ccb169d338d93b4556e488b598692d303b90 /src/lib/emile
parent274be9ac24e0530468c4567b37c11738e52c2330 (diff)
emile: add documentation for compression function.
Diffstat (limited to 'src/lib/emile')
-rw-r--r--src/lib/emile/emile_compression.h72
1 files changed, 70 insertions, 2 deletions
diff --git a/src/lib/emile/emile_compression.h b/src/lib/emile/emile_compression.h
index 89688f18a8..891d5c481c 100644
--- a/src/lib/emile/emile_compression.h
+++ b/src/lib/emile/emile_compression.h
@@ -1,6 +1,23 @@
1#ifndef EMILE_COMPRESSION_H_ 1#ifndef EMILE_COMPRESSION_H_
2#define EMILE_COMPRESSION_H_ 2#define EMILE_COMPRESSION_H_
3 3
4/**
5 * @defgroup Emile_Group_Compression Non destructive general purpose compression functions.
6 * @ingroup Emile
7 * Function that allow the compression and expansion of Eina_Binbuf with
8 * non destructive algorithm.
9 *
10 * @{
11 */
12
13/**
14 * Supported type of compression algorithm.
15 * @since 1.14.0
16 *
17 * @see emile_binbuf_compress()
18 * @see emile_binbuf_uncompress()
19 * @see emile_binbuf_expand()
20 */
4typedef enum 21typedef enum
5{ 22{
6 EMILE_ZLIB, 23 EMILE_ZLIB,
@@ -8,6 +25,12 @@ typedef enum
8 EMILE_LZ4HC 25 EMILE_LZ4HC
9} Emile_Compressor_Type; 26} Emile_Compressor_Type;
10 27
28/**
29 * Compression level to apply.
30 * @since 1.14.0
31 *
32 * @see emile_binbuf_compress();
33 */
11typedef enum 34typedef enum
12{ 35{
13 EMILE_DEFAULT = -1, 36 EMILE_DEFAULT = -1,
@@ -16,13 +39,58 @@ typedef enum
16 EMILE_BEST_COMPRESSION = 9 39 EMILE_BEST_COMPRESSION = 9
17} Emile_Compressor_Level; 40} Emile_Compressor_Level;
18 41
42/**
43 * @brief Compress an Eina_Binbuf into a new Eina_Binbuf
44 *
45 * @param in Buffer to compress.
46 * @param t Type of compression logic to use.
47 * @param level Level of compression to apply.
48 *
49 * @return On success it will return a buffer that contains
50 * the compressed data, @c NULL otherwise.
51 *
52 * @since 1.14.0
53 */
19EAPI Eina_Binbuf *emile_binbuf_compress(const Eina_Binbuf *in, 54EAPI Eina_Binbuf *emile_binbuf_compress(const Eina_Binbuf *in,
20 Emile_Compressor_Type t, int level); 55 Emile_Compressor_Type t,
56 Emile_Compressor_Level level);
57/**
58 * @brief Uncompress a buffer into a newly allocated buffer.
59 *
60 * @param in Buffer to uncompress.
61 * @param t Type of compression logic to use.
62 * @param dest_length Expected length of the decompressed data.
63 *
64 * @return a newly allocated buffer with the uncompressed data,
65 * @c NULL if it failed.
66 *
67 * @since 1.14.0
68 *
69 * @note That if dest_length doesn't match the expanded data, it will
70 * just fail and return @c NULL.
71 */
21EAPI Eina_Binbuf *emile_binbuf_uncompress(const Eina_Binbuf *in, 72EAPI Eina_Binbuf *emile_binbuf_uncompress(const Eina_Binbuf *in,
22 Emile_Compressor_Type t, 73 Emile_Compressor_Type t,
23 unsigned int dest_length); 74 unsigned int dest_length);
75
76/**
77 * @brief Uncompress a buffer into an existing buffer.
78 *
79 * @param in Buffer to uncompress.
80 * @param out Buffer to expand data into.
81 * @param t Type of compression logic to use.
82 *
83 * @return EINA_TRUE if it succeed, EINA_FALSE if it failed.
84 * @since 1.14.0
85 *
86 * @note The out buffer should have the necessary size to hold the
87 * expanded data or it will fail. In case of failure, random garbage
88 * could fill the out buffer.
89 */
24EAPI Eina_Bool emile_binbuf_expand(const Eina_Binbuf *in, 90EAPI Eina_Bool emile_binbuf_expand(const Eina_Binbuf *in,
25 Eina_Binbuf *out, 91 Eina_Binbuf *out,
26 Emile_Compressor_Type t); 92 Emile_Compressor_Type t);
27 93/**
94 * @}
95 */
28#endif 96#endif