autogen/include/Clownfish/ByteBuf.h

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 3 / 3 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Charmony.pm ↑ Summary autogen/include/Clownfish/String.h »
1 /*
2 * ***********************************************
3 *
4 * !!!! DO NOT EDIT !!!!
5 *
6 * This file was auto-generated by Build.PL.
7 *
8 * ***********************************************
9 *
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed with
12 * this work for additional information regarding copyright ownership.
13 * The ASF licenses this file to You under the Apache License, Version 2.0
14 * (the "License"); you may not use this file except in compliance with
15 * the License. You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 */
25  
26  
27 #ifndef H_CLOWNFISH_BYTEBUF
28 #define H_CLOWNFISH_BYTEBUF 1
29  
30  
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34  
35 #include "cfish_parcel.h"
36  
37 /* Include the header for this class's parent.
38 */
39  
40 #include "Clownfish/Obj.h"
41  
42 /* Define the struct layout for instances of this class.
43 */
44  
45 #ifdef C_CFISH_BYTEBUF
46 extern uint32_t cfish_BB_IVARS_OFFSET;
47 typedef struct cfish_ByteBufIVARS cfish_ByteBufIVARS;
48 static CFISH_INLINE cfish_ByteBufIVARS*
49 cfish_BB_IVARS(cfish_ByteBuf *self) {
50 char *ptr = (char*)self + cfish_BB_IVARS_OFFSET;
51 return (cfish_ByteBufIVARS*)ptr;
52 }
53 #ifdef CFISH_USE_SHORT_NAMES
54 #define ByteBufIVARS cfish_ByteBufIVARS
55 #define BB_IVARS cfish_BB_IVARS
56 #endif
57  
58 struct cfish_ByteBuf {
59 CFISH_OBJ_HEAD
60 cfish_Class* klass;
61 char* buf;
62 size_t size;
63 size_t cap;
64 };
65  
66 #endif /* C_CFISH_BYTEBUF */
67  
68 /* Declare this class's inert variables.
69 */
70  
71  
72  
73 /* Declare both this class's inert functions and the C functions which
74 * implement this class's dynamic methods.
75 */
76  
77 CFISH_VISIBLE cfish_ByteBuf*
78 cfish_BB_new(size_t capacity);
79  
80 CFISH_VISIBLE cfish_ByteBuf*
81 cfish_BB_init(cfish_ByteBuf* self, size_t capacity);
82  
83 CFISH_VISIBLE cfish_ByteBuf*
84 cfish_BB_new_bytes(const void* bytes, size_t size);
85  
86 CFISH_VISIBLE cfish_ByteBuf*
87 cfish_BB_init_bytes(cfish_ByteBuf* self, const void* bytes, size_t size);
88  
89 CFISH_VISIBLE cfish_ByteBuf*
90 cfish_BB_new_steal_bytes(void* bytes, size_t size, size_t capacity);
91  
92 CFISH_VISIBLE cfish_ByteBuf*
93 cfish_BB_init_steal_bytes(cfish_ByteBuf* self, void* bytes, size_t size, size_t capacity);
94  
95 void*
96 CFISH_BB_To_Host_IMP(cfish_ByteBuf* self, void* vcache);
97  
98 void
99 CFISH_BB_Set_Size_IMP(cfish_ByteBuf* self, size_t size);
100  
101 size_t
102 CFISH_BB_Get_Size_IMP(cfish_ByteBuf* self);
103  
104 char*
105 CFISH_BB_Get_Buf_IMP(cfish_ByteBuf* self);
106  
107 size_t
108 CFISH_BB_Get_Capacity_IMP(cfish_ByteBuf* self);
109  
110 void
111 CFISH_BB_Cat_Bytes_IMP(cfish_ByteBuf* self, const void* bytes, size_t size);
112  
113 void
114 CFISH_BB_Cat_IMP(cfish_ByteBuf* self, cfish_Blob* blob);
115  
116 char*
117 CFISH_BB_Grow_IMP(cfish_ByteBuf* self, size_t capacity);
118  
119 cfish_Blob*
120 CFISH_BB_Yield_Blob_IMP(cfish_ByteBuf* self);
121  
122 cfish_String*
123 CFISH_BB_Utf8_To_String_IMP(cfish_ByteBuf* self);
124  
125 cfish_String*
126 CFISH_BB_Trusted_Utf8_To_String_IMP(cfish_ByteBuf* self);
127  
128 bool
129 CFISH_BB_Equals_IMP(cfish_ByteBuf* self, cfish_Obj* other);
130  
131 bool
132 CFISH_BB_Equals_Bytes_IMP(cfish_ByteBuf* self, const void* bytes, size_t size);
133  
134 int32_t
135 CFISH_BB_Compare_To_IMP(cfish_ByteBuf* self, cfish_Obj* other);
136  
137 cfish_ByteBuf*
138 CFISH_BB_Clone_IMP(cfish_ByteBuf* self);
139  
140 void
141 CFISH_BB_Destroy_IMP(cfish_ByteBuf* self);
142  
143  
144  
145 /* Define typedefs for each dynamic method, allowing us to cast generic
146 * pointers to the appropriate function pointer type more cleanly.
147 */
148  
149 typedef void*
150 (*CFISH_BB_To_Host_t)(cfish_ByteBuf* self, void* vcache);
151  
152 typedef cfish_ByteBuf*
153 (*CFISH_BB_Clone_t)(cfish_ByteBuf* self);
154  
155 typedef bool
156 (*CFISH_BB_Equals_t)(cfish_ByteBuf* self, cfish_Obj* other);
157  
158 typedef int32_t
159 (*CFISH_BB_Compare_To_t)(cfish_ByteBuf* self, cfish_Obj* other);
160  
161 typedef void
162 (*CFISH_BB_Destroy_t)(cfish_ByteBuf* self);
163  
164 typedef cfish_String*
165 (*CFISH_BB_To_String_t)(cfish_ByteBuf* self);
166  
167 typedef void
168 (*CFISH_BB_Set_Size_t)(cfish_ByteBuf* self, size_t size);
169  
170 typedef size_t
171 (*CFISH_BB_Get_Size_t)(cfish_ByteBuf* self);
172  
173 typedef char*
174 (*CFISH_BB_Get_Buf_t)(cfish_ByteBuf* self);
175  
176 typedef size_t
177 (*CFISH_BB_Get_Capacity_t)(cfish_ByteBuf* self);
178  
179 typedef void
180 (*CFISH_BB_Cat_Bytes_t)(cfish_ByteBuf* self, const void* bytes, size_t size);
181  
182 typedef void
183 (*CFISH_BB_Cat_t)(cfish_ByteBuf* self, cfish_Blob* blob);
184  
185 typedef char*
186 (*CFISH_BB_Grow_t)(cfish_ByteBuf* self, size_t capacity);
187  
188 typedef cfish_Blob*
189 (*CFISH_BB_Yield_Blob_t)(cfish_ByteBuf* self);
190  
191 typedef cfish_String*
192 (*CFISH_BB_Utf8_To_String_t)(cfish_ByteBuf* self);
193  
194 typedef cfish_String*
195 (*CFISH_BB_Trusted_Utf8_To_String_t)(cfish_ByteBuf* self);
196  
197 typedef bool
198 (*CFISH_BB_Equals_Bytes_t)(cfish_ByteBuf* self, const void* bytes, size_t size);
199  
200  
201  
202 /* Define type-safe wrappers for inert functions of Obj.
203 */
204  
205 static CFISH_INLINE cfish_Class*
206 cfish_BB_get_class(cfish_ByteBuf *self) {
207 return cfish_Obj_get_class((cfish_Obj*)self);
208 }
209  
210 static CFISH_INLINE cfish_String*
211 cfish_BB_get_class_name(cfish_ByteBuf *self) {
212 return cfish_Obj_get_class_name((cfish_Obj*)self);
213 }
214  
215 static CFISH_INLINE bool
216 cfish_BB_is_a(cfish_ByteBuf *self, cfish_Class *ancestor) {
217 return cfish_Obj_is_a((cfish_Obj*)self, ancestor);
218 }
219  
220  
221 /* Define the inline functions which implement this class's virtual methods.
222 */
223  
224 extern CFISH_VISIBLE uint32_t CFISH_BB_To_Host_OFFSET;
225 static CFISH_INLINE void*
226 69 CFISH_BB_To_Host(cfish_ByteBuf* self, void* vcache) {
227 #ifdef CFP_CFISH
228 return CFISH_BB_To_Host_IMP(self, vcache);
229 #else
230 69 const CFISH_BB_To_Host_t method = (CFISH_BB_To_Host_t)cfish_obj_method(self, CFISH_BB_To_Host_OFFSET);
231 69 return method(self, vcache);
232 #endif
233 }
234  
235 extern CFISH_VISIBLE uint32_t CFISH_BB_Clone_OFFSET;
236 static CFISH_INLINE cfish_ByteBuf*
237 CFISH_BB_Clone(cfish_ByteBuf* self) {
238 #ifdef CFP_CFISH
239 return CFISH_BB_Clone_IMP(self);
240 #else
241 const CFISH_BB_Clone_t method = (CFISH_BB_Clone_t)cfish_obj_method(self, CFISH_BB_Clone_OFFSET);
242 return method(self);
243 #endif
244 }
245  
246 extern CFISH_VISIBLE uint32_t CFISH_BB_Equals_OFFSET;
247 static CFISH_INLINE bool
248 CFISH_BB_Equals(cfish_ByteBuf* self, cfish_Obj* other) {
249 #ifdef CFP_CFISH
250 return CFISH_BB_Equals_IMP(self, other);
251 #else
252 const CFISH_BB_Equals_t method = (CFISH_BB_Equals_t)cfish_obj_method(self, CFISH_BB_Equals_OFFSET);
253 return method(self, other);
254 #endif
255 }
256  
257 extern CFISH_VISIBLE uint32_t CFISH_BB_Compare_To_OFFSET;
258 static CFISH_INLINE int32_t
259 CFISH_BB_Compare_To(cfish_ByteBuf* self, cfish_Obj* other) {
260 #ifdef CFP_CFISH
261 return CFISH_BB_Compare_To_IMP(self, other);
262 #else
263 const CFISH_BB_Compare_To_t method = (CFISH_BB_Compare_To_t)cfish_obj_method(self, CFISH_BB_Compare_To_OFFSET);
264 return method(self, other);
265 #endif
266 }
267  
268 extern CFISH_VISIBLE uint32_t CFISH_BB_Destroy_OFFSET;
269 static CFISH_INLINE void
270 CFISH_BB_Destroy(cfish_ByteBuf* self) {
271 #ifdef CFP_CFISH
272 CFISH_BB_Destroy_IMP(self);
273 #else
274 const CFISH_BB_Destroy_t method = (CFISH_BB_Destroy_t)cfish_obj_method(self, CFISH_BB_Destroy_OFFSET);
275 method(self);
276 #endif
277 }
278  
279 extern CFISH_VISIBLE uint32_t CFISH_BB_To_String_OFFSET;
280 static CFISH_INLINE cfish_String*
281 CFISH_BB_To_String(cfish_ByteBuf* self) {
282 #ifdef CFP_CFISH
283 return CFISH_Obj_To_String_IMP((cfish_Obj*)self);
284 #else
285 const CFISH_BB_To_String_t method = (CFISH_BB_To_String_t)cfish_obj_method(self, CFISH_BB_To_String_OFFSET);
286 return method(self);
287 #endif
288 }
289  
290 extern CFISH_VISIBLE uint32_t CFISH_BB_Set_Size_OFFSET;
291 static CFISH_INLINE void
292 CFISH_BB_Set_Size(cfish_ByteBuf* self, size_t size) {
293 #ifdef CFP_CFISH
294 CFISH_BB_Set_Size_IMP(self, size);
295 #else
296 const CFISH_BB_Set_Size_t method = (CFISH_BB_Set_Size_t)cfish_obj_method(self, CFISH_BB_Set_Size_OFFSET);
297 method(self, size);
298 #endif
299 }
300  
301 extern CFISH_VISIBLE uint32_t CFISH_BB_Get_Size_OFFSET;
302 static CFISH_INLINE size_t
303 CFISH_BB_Get_Size(cfish_ByteBuf* self) {
304 #ifdef CFP_CFISH
305 return CFISH_BB_Get_Size_IMP(self);
306 #else
307 const CFISH_BB_Get_Size_t method = (CFISH_BB_Get_Size_t)cfish_obj_method(self, CFISH_BB_Get_Size_OFFSET);
308 return method(self);
309 #endif
310 }
311  
312 extern CFISH_VISIBLE uint32_t CFISH_BB_Get_Buf_OFFSET;
313 static CFISH_INLINE char*
314 CFISH_BB_Get_Buf(cfish_ByteBuf* self) {
315 #ifdef CFP_CFISH
316 return CFISH_BB_Get_Buf_IMP(self);
317 #else
318 const CFISH_BB_Get_Buf_t method = (CFISH_BB_Get_Buf_t)cfish_obj_method(self, CFISH_BB_Get_Buf_OFFSET);
319 return method(self);
320 #endif
321 }
322  
323 extern CFISH_VISIBLE uint32_t CFISH_BB_Get_Capacity_OFFSET;
324 static CFISH_INLINE size_t
325 CFISH_BB_Get_Capacity(cfish_ByteBuf* self) {
326 #ifdef CFP_CFISH
327 return CFISH_BB_Get_Capacity_IMP(self);
328 #else
329 const CFISH_BB_Get_Capacity_t method = (CFISH_BB_Get_Capacity_t)cfish_obj_method(self, CFISH_BB_Get_Capacity_OFFSET);
330 return method(self);
331 #endif
332 }
333  
334 extern CFISH_VISIBLE uint32_t CFISH_BB_Cat_Bytes_OFFSET;
335 static CFISH_INLINE void
336 CFISH_BB_Cat_Bytes(cfish_ByteBuf* self, const void* bytes, size_t size) {
337 #ifdef CFP_CFISH
338 CFISH_BB_Cat_Bytes_IMP(self, bytes, size);
339 #else
340 const CFISH_BB_Cat_Bytes_t method = (CFISH_BB_Cat_Bytes_t)cfish_obj_method(self, CFISH_BB_Cat_Bytes_OFFSET);
341 method(self, bytes, size);
342 #endif
343 }
344  
345 extern CFISH_VISIBLE uint32_t CFISH_BB_Cat_OFFSET;
346 static CFISH_INLINE void
347 CFISH_BB_Cat(cfish_ByteBuf* self, cfish_Blob* blob) {
348 #ifdef CFP_CFISH
349 CFISH_BB_Cat_IMP(self, blob);
350 #else
351 const CFISH_BB_Cat_t method = (CFISH_BB_Cat_t)cfish_obj_method(self, CFISH_BB_Cat_OFFSET);
352 method(self, blob);
353 #endif
354 }
355  
356 extern CFISH_VISIBLE uint32_t CFISH_BB_Grow_OFFSET;
357 static CFISH_INLINE char*
358 CFISH_BB_Grow(cfish_ByteBuf* self, size_t capacity) {
359 #ifdef CFP_CFISH
360 return CFISH_BB_Grow_IMP(self, capacity);
361 #else
362 const CFISH_BB_Grow_t method = (CFISH_BB_Grow_t)cfish_obj_method(self, CFISH_BB_Grow_OFFSET);
363 return method(self, capacity);
364 #endif
365 }
366  
367 extern CFISH_VISIBLE uint32_t CFISH_BB_Yield_Blob_OFFSET;
368 static CFISH_INLINE cfish_Blob*
369 CFISH_BB_Yield_Blob(cfish_ByteBuf* self) {
370 #ifdef CFP_CFISH
371 return CFISH_BB_Yield_Blob_IMP(self);
372 #else
373 const CFISH_BB_Yield_Blob_t method = (CFISH_BB_Yield_Blob_t)cfish_obj_method(self, CFISH_BB_Yield_Blob_OFFSET);
374 return method(self);
375 #endif
376 }
377  
378 extern CFISH_VISIBLE uint32_t CFISH_BB_Utf8_To_String_OFFSET;
379 static CFISH_INLINE cfish_String*
380 CFISH_BB_Utf8_To_String(cfish_ByteBuf* self) {
381 #ifdef CFP_CFISH
382 return CFISH_BB_Utf8_To_String_IMP(self);
383 #else
384 const CFISH_BB_Utf8_To_String_t method = (CFISH_BB_Utf8_To_String_t)cfish_obj_method(self, CFISH_BB_Utf8_To_String_OFFSET);
385 return method(self);
386 #endif
387 }
388  
389 extern CFISH_VISIBLE uint32_t CFISH_BB_Trusted_Utf8_To_String_OFFSET;
390 static CFISH_INLINE cfish_String*
391 CFISH_BB_Trusted_Utf8_To_String(cfish_ByteBuf* self) {
392 #ifdef CFP_CFISH
393 return CFISH_BB_Trusted_Utf8_To_String_IMP(self);
394 #else
395 const CFISH_BB_Trusted_Utf8_To_String_t method = (CFISH_BB_Trusted_Utf8_To_String_t)cfish_obj_method(self, CFISH_BB_Trusted_Utf8_To_String_OFFSET);
396 return method(self);
397 #endif
398 }
399  
400 extern CFISH_VISIBLE uint32_t CFISH_BB_Equals_Bytes_OFFSET;
401 static CFISH_INLINE bool
402 CFISH_BB_Equals_Bytes(cfish_ByteBuf* self, const void* bytes, size_t size) {
403 #ifdef CFP_CFISH
404 return CFISH_BB_Equals_Bytes_IMP(self, bytes, size);
405 #else
406 const CFISH_BB_Equals_Bytes_t method = (CFISH_BB_Equals_Bytes_t)cfish_obj_method(self, CFISH_BB_Equals_Bytes_OFFSET);
407 return method(self, bytes, size);
408 #endif
409 }
410  
411  
412  
413 /* Declare callbacks for wrapping host overrides.
414 */
415  
416 #ifdef CFISH_NO_DYNAMIC_OVERRIDES
417 #else
418 #endif
419  
420  
421 /* Define "short names" for this class's symbols.
422 */
423  
424 #ifdef CFISH_USE_SHORT_NAMES
425 #define ByteBuf cfish_ByteBuf
426 #define BYTEBUF CFISH_BYTEBUF
427 #define BB_new cfish_BB_new
428 #define BB_init cfish_BB_init
429 #define BB_new_bytes cfish_BB_new_bytes
430 #define BB_init_bytes cfish_BB_init_bytes
431 #define BB_new_steal_bytes cfish_BB_new_steal_bytes
432 #define BB_init_steal_bytes cfish_BB_init_steal_bytes
433 #define BB_get_class cfish_BB_get_class
434 #define BB_get_class_name cfish_BB_get_class_name
435 #define BB_is_a cfish_BB_is_a
436 #define BB_To_Host_IMP CFISH_BB_To_Host_IMP
437 #define BB_Set_Size_IMP CFISH_BB_Set_Size_IMP
438 #define BB_Get_Size_IMP CFISH_BB_Get_Size_IMP
439 #define BB_Get_Buf_IMP CFISH_BB_Get_Buf_IMP
440 #define BB_Get_Capacity_IMP CFISH_BB_Get_Capacity_IMP
441 #define BB_Cat_Bytes_IMP CFISH_BB_Cat_Bytes_IMP
442 #define BB_Cat_IMP CFISH_BB_Cat_IMP
443 #define BB_Grow_IMP CFISH_BB_Grow_IMP
444 #define BB_Yield_Blob_IMP CFISH_BB_Yield_Blob_IMP
445 #define BB_Utf8_To_String_IMP CFISH_BB_Utf8_To_String_IMP
446 #define BB_Trusted_Utf8_To_String_IMP CFISH_BB_Trusted_Utf8_To_String_IMP
447 #define BB_Equals_IMP CFISH_BB_Equals_IMP
448 #define BB_Equals_Bytes_IMP CFISH_BB_Equals_Bytes_IMP
449 #define BB_Compare_To_IMP CFISH_BB_Compare_To_IMP
450 #define BB_Clone_IMP CFISH_BB_Clone_IMP
451 #define BB_Destroy_IMP CFISH_BB_Destroy_IMP
452 #define BB_To_Host CFISH_BB_To_Host
453 #define BB_To_Host_t CFISH_BB_To_Host_t
454 #define BB_Clone CFISH_BB_Clone
455 #define BB_Clone_t CFISH_BB_Clone_t
456 #define BB_Equals CFISH_BB_Equals
457 #define BB_Equals_t CFISH_BB_Equals_t
458 #define BB_Compare_To CFISH_BB_Compare_To
459 #define BB_Compare_To_t CFISH_BB_Compare_To_t
460 #define BB_Destroy CFISH_BB_Destroy
461 #define BB_Destroy_t CFISH_BB_Destroy_t
462 #define BB_To_String CFISH_BB_To_String
463 #define BB_To_String_t CFISH_BB_To_String_t
464 #define BB_Set_Size CFISH_BB_Set_Size
465 #define BB_Set_Size_t CFISH_BB_Set_Size_t
466 #define BB_Get_Size CFISH_BB_Get_Size
467 #define BB_Get_Size_t CFISH_BB_Get_Size_t
468 #define BB_Get_Buf CFISH_BB_Get_Buf
469 #define BB_Get_Buf_t CFISH_BB_Get_Buf_t
470 #define BB_Get_Capacity CFISH_BB_Get_Capacity
471 #define BB_Get_Capacity_t CFISH_BB_Get_Capacity_t
472 #define BB_Cat_Bytes CFISH_BB_Cat_Bytes
473 #define BB_Cat_Bytes_t CFISH_BB_Cat_Bytes_t
474 #define BB_Cat CFISH_BB_Cat
475 #define BB_Cat_t CFISH_BB_Cat_t
476 #define BB_Grow CFISH_BB_Grow
477 #define BB_Grow_t CFISH_BB_Grow_t
478 #define BB_Yield_Blob CFISH_BB_Yield_Blob
479 #define BB_Yield_Blob_t CFISH_BB_Yield_Blob_t
480 #define BB_Utf8_To_String CFISH_BB_Utf8_To_String
481 #define BB_Utf8_To_String_t CFISH_BB_Utf8_To_String_t
482 #define BB_Trusted_Utf8_To_String CFISH_BB_Trusted_Utf8_To_String
483 #define BB_Trusted_Utf8_To_String_t CFISH_BB_Trusted_Utf8_To_String_t
484 #define BB_Equals_Bytes CFISH_BB_Equals_Bytes
485 #define BB_Equals_Bytes_t CFISH_BB_Equals_Bytes_t
486 #endif /* CFISH_USE_SHORT_NAMES */
487  
488  
489  
490  
491  
492 #ifdef __cplusplus
493 }
494 #endif
495  
496 #endif /* H_CLOWNFISH_BYTEBUF */
497  
498  
499  
500  
« Charmony.pm ↑ Summary autogen/include/Clownfish/String.h »