diff options
Diffstat (limited to 'libraries/eina/src/lib/eina_binbuf_template_c.x')
-rw-r--r-- | libraries/eina/src/lib/eina_binbuf_template_c.x | 153 |
1 files changed, 0 insertions, 153 deletions
diff --git a/libraries/eina/src/lib/eina_binbuf_template_c.x b/libraries/eina/src/lib/eina_binbuf_template_c.x deleted file mode 100644 index 7e0c539..0000000 --- a/libraries/eina/src/lib/eina_binbuf_template_c.x +++ /dev/null | |||
@@ -1,153 +0,0 @@ | |||
1 | /* | ||
2 | * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 | ||
3 | */ | ||
4 | |||
5 | /* This file should be included from files implementing binbuf. | ||
6 | * The including file should define the following macros: | ||
7 | * _STRBUF_DATA_TYPE | ||
8 | * _STRBUF_CSIZE | ||
9 | * _STRBUF_STRUCT_NAME | ||
10 | * _STRBUF_MAGIC | ||
11 | * _STRBUF_MAGIC_STR | ||
12 | * _FUNC_EXPAND | ||
13 | * See how it's done in eina_ustrbuf.c and eina_strbuf.c. This just makes things | ||
14 | * a lot easier since those are essentially the same just with different sizes. | ||
15 | */ | ||
16 | |||
17 | /*============================================================================* | ||
18 | * Global * | ||
19 | *============================================================================*/ | ||
20 | |||
21 | /** | ||
22 | * @internal | ||
23 | * @brief Initialize the strbuf module. | ||
24 | * | ||
25 | * @return #EINA_TRUE on success, #EINA_FALSE on failure. | ||
26 | * | ||
27 | * This function sets up the strbuf module of Eina. It is called by | ||
28 | * eina_init(). | ||
29 | * | ||
30 | * @see eina_init() | ||
31 | */ | ||
32 | Eina_Bool | ||
33 | _FUNC_EXPAND(init)(void) | ||
34 | { | ||
35 | eina_magic_string_static_set(_STRBUF_MAGIC, _STRBUF_MAGIC_STR); | ||
36 | return eina_strbuf_common_init(); | ||
37 | } | ||
38 | |||
39 | /** | ||
40 | * @internal | ||
41 | * @brief Shut down the strbuf module. | ||
42 | * | ||
43 | * @return #EINA_TRUE on success, #EINA_FALSE on failure. | ||
44 | * | ||
45 | * This function shuts down the strbuf module set up by | ||
46 | * eina_ustrbuf_init(). It is called by eina_shutdown(). | ||
47 | * | ||
48 | * @see eina_shutdown() | ||
49 | */ | ||
50 | Eina_Bool | ||
51 | _FUNC_EXPAND(shutdown)(void) | ||
52 | { | ||
53 | return eina_strbuf_common_shutdown(); | ||
54 | } | ||
55 | |||
56 | /*============================================================================* | ||
57 | * API * | ||
58 | *============================================================================*/ | ||
59 | |||
60 | EAPI _STRBUF_STRUCT_NAME * | ||
61 | _FUNC_EXPAND(new)(void) | ||
62 | { | ||
63 | _STRBUF_STRUCT_NAME *buf = eina_strbuf_common_new(_STRBUF_CSIZE); | ||
64 | EINA_MAGIC_SET(buf, _STRBUF_MAGIC); | ||
65 | return buf; | ||
66 | } | ||
67 | |||
68 | EAPI _STRBUF_STRUCT_NAME * | ||
69 | _FUNC_EXPAND(manage_new_length)(_STRBUF_DATA_TYPE *str, size_t length) | ||
70 | { | ||
71 | _STRBUF_STRUCT_NAME *buf = | ||
72 | eina_strbuf_common_manage_new(_STRBUF_CSIZE, (void *) str, length); | ||
73 | EINA_MAGIC_SET(buf, _STRBUF_MAGIC); | ||
74 | return buf; | ||
75 | } | ||
76 | |||
77 | EAPI void | ||
78 | _FUNC_EXPAND(free)(_STRBUF_STRUCT_NAME *buf) | ||
79 | { | ||
80 | EINA_MAGIC_CHECK_STRBUF(buf); | ||
81 | EINA_MAGIC_SET(buf, EINA_MAGIC_NONE); | ||
82 | eina_strbuf_common_free(buf); | ||
83 | } | ||
84 | |||
85 | EAPI void | ||
86 | _FUNC_EXPAND(reset)(_STRBUF_STRUCT_NAME *buf) | ||
87 | { | ||
88 | EINA_MAGIC_CHECK_STRBUF(buf); | ||
89 | eina_strbuf_common_reset(_STRBUF_CSIZE, buf); | ||
90 | } | ||
91 | |||
92 | EAPI Eina_Bool | ||
93 | _FUNC_EXPAND(append_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length) | ||
94 | { | ||
95 | EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); | ||
96 | return eina_strbuf_common_append_length(_STRBUF_CSIZE, buf, (const void *) str, length); | ||
97 | } | ||
98 | |||
99 | EAPI Eina_Bool | ||
100 | _FUNC_EXPAND(insert_length)(_STRBUF_STRUCT_NAME *buf, const _STRBUF_DATA_TYPE *str, size_t length, size_t pos) | ||
101 | { | ||
102 | EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); | ||
103 | return eina_strbuf_common_insert_length(_STRBUF_CSIZE, buf, (const void *) str, length, pos); | ||
104 | } | ||
105 | |||
106 | EAPI Eina_Bool | ||
107 | _FUNC_EXPAND(append_char)(_STRBUF_STRUCT_NAME *buf, _STRBUF_DATA_TYPE c) | ||
108 | { | ||
109 | EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); | ||
110 | return eina_strbuf_common_append_char(_STRBUF_CSIZE, buf, (const void *) &c); | ||
111 | } | ||
112 | |||
113 | EAPI Eina_Bool | ||
114 | _FUNC_EXPAND(insert_char)(_STRBUF_STRUCT_NAME *buf, _STRBUF_DATA_TYPE c, size_t pos) | ||
115 | { | ||
116 | EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); | ||
117 | return eina_strbuf_common_insert_char(_STRBUF_CSIZE, buf, (const void *) &c, pos); | ||
118 | } | ||
119 | |||
120 | EAPI Eina_Bool | ||
121 | _FUNC_EXPAND(remove)(_STRBUF_STRUCT_NAME *buf, size_t start, size_t end) | ||
122 | { | ||
123 | EINA_MAGIC_CHECK_STRBUF(buf, EINA_FALSE); | ||
124 | return eina_strbuf_common_remove(_STRBUF_CSIZE, buf, start, end); | ||
125 | } | ||
126 | |||
127 | EAPI const _STRBUF_DATA_TYPE * | ||
128 | _FUNC_EXPAND(string_get)(const _STRBUF_STRUCT_NAME *buf) | ||
129 | { | ||
130 | EINA_MAGIC_CHECK_STRBUF(buf, NULL); | ||
131 | return (const _STRBUF_DATA_TYPE *) eina_strbuf_common_string_get(buf); | ||
132 | } | ||
133 | |||
134 | EAPI _STRBUF_DATA_TYPE * | ||
135 | _FUNC_EXPAND(string_steal)(_STRBUF_STRUCT_NAME *buf) | ||
136 | { | ||
137 | EINA_MAGIC_CHECK_STRBUF(buf, NULL); | ||
138 | return (_STRBUF_DATA_TYPE *) eina_strbuf_common_string_steal(_STRBUF_CSIZE, buf); | ||
139 | } | ||
140 | |||
141 | EAPI void | ||
142 | _FUNC_EXPAND(string_free)(_STRBUF_STRUCT_NAME *buf) | ||
143 | { | ||
144 | EINA_MAGIC_CHECK_STRBUF(buf); | ||
145 | eina_strbuf_common_string_free(_STRBUF_CSIZE, buf); | ||
146 | } | ||
147 | |||
148 | EAPI size_t | ||
149 | _FUNC_EXPAND(length_get)(const _STRBUF_STRUCT_NAME *buf) | ||
150 | { | ||
151 | EINA_MAGIC_CHECK_STRBUF(buf, 0); | ||
152 | return eina_strbuf_common_length_get(buf); | ||
153 | } | ||