aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/lib/eina_strbuf_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/lib/eina_strbuf_common.h')
-rw-r--r--libraries/eina/src/lib/eina_strbuf_common.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/libraries/eina/src/lib/eina_strbuf_common.h b/libraries/eina/src/lib/eina_strbuf_common.h
new file mode 100644
index 0000000..06a1353
--- /dev/null
+++ b/libraries/eina/src/lib/eina_strbuf_common.h
@@ -0,0 +1,120 @@
1#ifndef EINA_STRBUF_COMMON_H
2#define EINA_STRBUF_COMMON_H
3
4#include <stdlib.h>
5
6#include "eina_private.h"
7#include "eina_magic.h"
8#include "eina_strbuf.h"
9
10/**
11 * @struct _Eina_Strbuf
12 * String buffer to facilitate string operations.
13 */
14struct _Eina_Strbuf
15{
16 void *buf;
17 size_t len;
18 size_t size;
19 size_t step;
20
21 EINA_MAGIC
22};
23
24#define EINA_MAGIC_CHECK_STRBUF(d, ...) \
25 do { \
26 if (!EINA_MAGIC_CHECK((d), _STRBUF_MAGIC)) \
27 { \
28 EINA_MAGIC_FAIL((d), _STRBUF_MAGIC); \
29 return __VA_ARGS__; \
30 } \
31 } while (0)
32
33Eina_Bool
34eina_strbuf_common_init(void);
35
36Eina_Bool
37eina_strbuf_common_shutdown(void);
38Eina_Strbuf *
39eina_strbuf_common_new(size_t csize);
40Eina_Strbuf *
41eina_strbuf_common_manage_new(size_t csize,
42 void *str,
43 size_t len);
44void
45eina_strbuf_common_free(Eina_Strbuf *buf);
46void
47eina_strbuf_common_reset(size_t csize, Eina_Strbuf *buf);
48Eina_Bool
49eina_strbuf_common_append(size_t csize,
50 Eina_Strbuf *buf,
51 const void *str,
52 size_t len);
53Eina_Bool
54eina_strbuf_common_append_escaped(size_t csize,
55 Eina_Strbuf *buf,
56 const void *str);
57Eina_Bool
58eina_strbuf_common_append_n(size_t csize,
59 Eina_Strbuf *buf,
60 const void *str,
61 size_t len,
62 size_t maxlen);
63Eina_Bool
64eina_strbuf_common_append_length(size_t csize,
65 Eina_Strbuf *buf,
66 const void *str,
67 size_t length);
68Eina_Bool
69eina_strbuf_common_insert(size_t csize,
70 Eina_Strbuf *buf,
71 const void *str,
72 size_t len,
73 size_t pos);
74Eina_Bool
75eina_strbuf_common_insert_escaped(size_t csize,
76 Eina_Strbuf *buf,
77 const void *str,
78 size_t len,
79 size_t pos);
80Eina_Bool
81eina_strbuf_common_insert_n(size_t csize,
82 Eina_Strbuf *buf,
83 const void *str,
84 size_t len,
85 size_t maxlen,
86 size_t pos);
87Eina_Bool
88eina_strbuf_common_insert_length(size_t csize,
89 Eina_Strbuf *buf,
90 const void *str,
91 size_t length,
92 size_t pos);
93Eina_Bool
94eina_strbuf_common_append_char(size_t csize, Eina_Strbuf *buf, const void *c);
95Eina_Bool
96eina_strbuf_common_insert_char(size_t csize,
97 Eina_Strbuf *buf,
98 const void *c,
99 size_t pos);
100Eina_Bool
101eina_strbuf_common_remove(size_t csize,
102 Eina_Strbuf *buf,
103 size_t start,
104 size_t end);
105const void *
106eina_strbuf_common_string_get(const Eina_Strbuf *buf);
107void *
108eina_strbuf_common_string_steal(size_t csize, Eina_Strbuf *buf);
109void
110eina_strbuf_common_string_free(size_t csize, Eina_Strbuf *buf);
111size_t
112eina_strbuf_common_length_get(const Eina_Strbuf *buf);
113
114Eina_Bool
115_eina_strbuf_common_grow(size_t csize, Eina_Strbuf *buf, size_t size);
116/**
117 * @}
118 */
119
120#endif