autogen/include/Clownfish/String.h

filter: Statementstmt 66.6% 4 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 66.6% 4 / 6 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« lib/Clownfish/Test.xs ↑ Summary autogen/include/cfish_parcel.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_STRING
28 #define H_CLOWNFISH_STRING 1
29  
30  
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34  
35 #include "cfish_parcel.h"
36  
37 // For strlen
38 #include <string.h>
39  
40 // For CFISH_ALLOCA_OBJ.
41 #include "Clownfish/Class.h"
42  
43 // For CFISH_ERR_FUNC_MACRO.
44 #include "Clownfish/Err.h"
45  
46  
47 /* Include the header for this class's parent.
48 */
49  
50 #include "Clownfish/Obj.h"
51  
52 /* Define the struct layout for instances of this class.
53 */
54  
55 #ifdef C_CFISH_STRING
56 extern uint32_t cfish_Str_IVARS_OFFSET;
57 typedef struct cfish_StringIVARS cfish_StringIVARS;
58 static CFISH_INLINE cfish_StringIVARS*
59 cfish_Str_IVARS(cfish_String *self) {
60 char *ptr = (char*)self + cfish_Str_IVARS_OFFSET;
61 return (cfish_StringIVARS*)ptr;
62 }
63 #ifdef CFISH_USE_SHORT_NAMES
64 #define StringIVARS cfish_StringIVARS
65 #define Str_IVARS cfish_Str_IVARS
66 #endif
67  
68 struct cfish_String {
69 CFISH_OBJ_HEAD
70 cfish_Class* klass;
71 const char* ptr;
72 size_t size;
73 cfish_String* origin;
74 };
75  
76 #endif /* C_CFISH_STRING */
77  
78 /* Declare this class's inert variables.
79 */
80  
81  
82  
83 /* Declare both this class's inert functions and the C functions which
84 * implement this class's dynamic methods.
85 */
86  
87 CFISH_VISIBLE bool
88 cfish_Str_utf8_valid(const char* ptr, size_t len);
89  
90 CFISH_VISIBLE void
91 cfish_Str_validate_utf8(const char* text, size_t size, const char* file, int line, const char* func);
92  
93 CFISH_VISIBLE bool
94 cfish_Str_is_whitespace(int32_t code_point);
95  
96 CFISH_VISIBLE uint32_t
97 cfish_Str_encode_utf8_char(int32_t code_point, void* buffer);
98  
99 CFISH_VISIBLE cfish_String*
100 cfish_Str_new_from_utf8(const char* utf8, size_t size);
101  
102 CFISH_VISIBLE cfish_String*
103 cfish_Str_new_from_trusted_utf8(const char* utf8, size_t size);
104  
105 CFISH_VISIBLE cfish_String*
106 cfish_Str_init_from_trusted_utf8(cfish_String* self, const char* utf8, size_t size);
107  
108 CFISH_VISIBLE cfish_String*
109 cfish_Str_new_steal_utf8(char* utf8, size_t size);
110  
111 CFISH_VISIBLE cfish_String*
112 cfish_Str_new_steal_trusted_utf8(char* utf8, size_t size);
113  
114 CFISH_VISIBLE cfish_String*
115 cfish_Str_init_steal_trusted_utf8(cfish_String* self, char* utf8, size_t size);
116  
117 CFISH_VISIBLE cfish_String*
118 cfish_Str_new_wrap_utf8(const char* utf8, size_t size);
119  
120 CFISH_VISIBLE cfish_String*
121 cfish_Str_new_wrap_trusted_utf8(const char* utf8, size_t size);
122  
123 CFISH_VISIBLE cfish_String*
124 cfish_Str_init_stack_string(void* allocation, const char* utf8, size_t size);
125  
126 CFISH_VISIBLE cfish_String*
127 cfish_Str_init_wrap_trusted_utf8(cfish_String* self, const char* utf8, size_t size);
128  
129 CFISH_VISIBLE cfish_String*
130 cfish_Str_new_from_char(int32_t code_point);
131  
132 CFISH_VISIBLE cfish_String*
133 cfish_Str_newf(const char* pattern, ...);
134  
135 void*
136 CFISH_Str_To_Host_IMP(cfish_String* self, void* vcache);
137  
138 cfish_String*
139 CFISH_Str_Cat_IMP(cfish_String* self, cfish_String* other);
140  
141 cfish_String*
142 CFISH_Str_Cat_Utf8_IMP(cfish_String* self, const char* utf8, size_t size);
143  
144 cfish_String*
145 CFISH_Str_Cat_Trusted_Utf8_IMP(cfish_String* self, const char* utf8, size_t size);
146  
147 int64_t
148 CFISH_Str_To_I64_IMP(cfish_String* self);
149  
150 int64_t
151 CFISH_Str_BaseX_To_I64_IMP(cfish_String* self, uint32_t base);
152  
153 double
154 CFISH_Str_To_F64_IMP(cfish_String* self);
155  
156 bool
157 CFISH_Str_Starts_With_IMP(cfish_String* self, cfish_String* prefix);
158  
159 bool
160 CFISH_Str_Starts_With_Utf8_IMP(cfish_String* self, const char* utf8, size_t size);
161  
162 bool
163 CFISH_Str_Ends_With_IMP(cfish_String* self, cfish_String* suffix);
164  
165 bool
166 CFISH_Str_Ends_With_Utf8_IMP(cfish_String* self, const char* utf8, size_t size);
167  
168 bool
169 CFISH_Str_Contains_IMP(cfish_String* self, cfish_String* substring);
170  
171 bool
172 CFISH_Str_Contains_Utf8_IMP(cfish_String* self, const char* utf8, size_t size);
173  
174 cfish_StringIterator*
175 CFISH_Str_Find_IMP(cfish_String* self, cfish_String* substring);
176  
177 cfish_StringIterator*
178 CFISH_Str_Find_Utf8_IMP(cfish_String* self, const char* utf8, size_t size);
179  
180 bool
181 CFISH_Str_Equals_IMP(cfish_String* self, cfish_Obj* other);
182  
183 bool
184 CFISH_Str_Equals_Utf8_IMP(cfish_String* self, const char* utf8, size_t size);
185  
186 size_t
187 CFISH_Str_Length_IMP(cfish_String* self);
188  
189 size_t
190 CFISH_Str_Get_Size_IMP(cfish_String* self);
191  
192 const char*
193 CFISH_Str_Get_Ptr8_IMP(cfish_String* self);
194  
195 char*
196 CFISH_Str_To_Utf8_IMP(cfish_String* self);
197  
198 cfish_ByteBuf*
199 CFISH_Str_To_ByteBuf_IMP(cfish_String* self);
200  
201 cfish_String*
202 CFISH_Str_Clone_IMP(cfish_String* self);
203  
204 bool
205 CFISH_Str_Is_Copy_On_IncRef_IMP(cfish_String* self);
206  
207 int32_t
208 CFISH_Str_Compare_To_IMP(cfish_String* self, cfish_Obj* other);
209  
210 size_t
211 CFISH_Str_Hash_Sum_IMP(cfish_String* self);
212  
213 cfish_String*
214 CFISH_Str_To_String_IMP(cfish_String* self);
215  
216 cfish_String*
217 CFISH_Str_Trim_IMP(cfish_String* self);
218  
219 cfish_String*
220 CFISH_Str_Trim_Top_IMP(cfish_String* self);
221  
222 cfish_String*
223 CFISH_Str_Trim_Tail_IMP(cfish_String* self);
224  
225 int32_t
226 CFISH_Str_Code_Point_At_IMP(cfish_String* self, size_t tick);
227  
228 int32_t
229 CFISH_Str_Code_Point_From_IMP(cfish_String* self, size_t tick);
230  
231 cfish_String*
232 CFISH_Str_SubString_IMP(cfish_String* self, size_t offset, size_t length);
233  
234 cfish_StringIterator*
235 CFISH_Str_Top_IMP(cfish_String* self);
236  
237 cfish_StringIterator*
238 CFISH_Str_Tail_IMP(cfish_String* self);
239  
240 void
241 CFISH_Str_Destroy_IMP(cfish_String* self);
242  
243  
244  
245 /* Define typedefs for each dynamic method, allowing us to cast generic
246 * pointers to the appropriate function pointer type more cleanly.
247 */
248  
249 typedef void*
250 (*CFISH_Str_To_Host_t)(cfish_String* self, void* vcache);
251  
252 typedef cfish_String*
253 (*CFISH_Str_Clone_t)(cfish_String* self);
254  
255 typedef bool
256 (*CFISH_Str_Equals_t)(cfish_String* self, cfish_Obj* other);
257  
258 typedef int32_t
259 (*CFISH_Str_Compare_To_t)(cfish_String* self, cfish_Obj* other);
260  
261 typedef void
262 (*CFISH_Str_Destroy_t)(cfish_String* self);
263  
264 typedef cfish_String*
265 (*CFISH_Str_To_String_t)(cfish_String* self);
266  
267 typedef cfish_String*
268 (*CFISH_Str_Cat_t)(cfish_String* self, cfish_String* other);
269  
270 typedef cfish_String*
271 (*CFISH_Str_Cat_Utf8_t)(cfish_String* self, const char* utf8, size_t size);
272  
273 typedef cfish_String*
274 (*CFISH_Str_Cat_Trusted_Utf8_t)(cfish_String* self, const char* utf8, size_t size);
275  
276 typedef int64_t
277 (*CFISH_Str_To_I64_t)(cfish_String* self);
278  
279 typedef int64_t
280 (*CFISH_Str_BaseX_To_I64_t)(cfish_String* self, uint32_t base);
281  
282 typedef double
283 (*CFISH_Str_To_F64_t)(cfish_String* self);
284  
285 typedef bool
286 (*CFISH_Str_Starts_With_t)(cfish_String* self, cfish_String* prefix);
287  
288 typedef bool
289 (*CFISH_Str_Starts_With_Utf8_t)(cfish_String* self, const char* utf8, size_t size);
290  
291 typedef bool
292 (*CFISH_Str_Ends_With_t)(cfish_String* self, cfish_String* suffix);
293  
294 typedef bool
295 (*CFISH_Str_Ends_With_Utf8_t)(cfish_String* self, const char* utf8, size_t size);
296  
297 typedef bool
298 (*CFISH_Str_Contains_t)(cfish_String* self, cfish_String* substring);
299  
300 typedef bool
301 (*CFISH_Str_Contains_Utf8_t)(cfish_String* self, const char* utf8, size_t size);
302  
303 typedef cfish_StringIterator*
304 (*CFISH_Str_Find_t)(cfish_String* self, cfish_String* substring);
305  
306 typedef cfish_StringIterator*
307 (*CFISH_Str_Find_Utf8_t)(cfish_String* self, const char* utf8, size_t size);
308  
309 typedef bool
310 (*CFISH_Str_Equals_Utf8_t)(cfish_String* self, const char* utf8, size_t size);
311  
312 typedef size_t
313 (*CFISH_Str_Length_t)(cfish_String* self);
314  
315 typedef size_t
316 (*CFISH_Str_Get_Size_t)(cfish_String* self);
317  
318 typedef const char*
319 (*CFISH_Str_Get_Ptr8_t)(cfish_String* self);
320  
321 typedef char*
322 (*CFISH_Str_To_Utf8_t)(cfish_String* self);
323  
324 typedef cfish_ByteBuf*
325 (*CFISH_Str_To_ByteBuf_t)(cfish_String* self);
326  
327 typedef bool
328 (*CFISH_Str_Is_Copy_On_IncRef_t)(cfish_String* self);
329  
330 typedef size_t
331 (*CFISH_Str_Hash_Sum_t)(cfish_String* self);
332  
333 typedef cfish_String*
334 (*CFISH_Str_Trim_t)(cfish_String* self);
335  
336 typedef cfish_String*
337 (*CFISH_Str_Trim_Top_t)(cfish_String* self);
338  
339 typedef cfish_String*
340 (*CFISH_Str_Trim_Tail_t)(cfish_String* self);
341  
342 typedef int32_t
343 (*CFISH_Str_Code_Point_At_t)(cfish_String* self, size_t tick);
344  
345 typedef int32_t
346 (*CFISH_Str_Code_Point_From_t)(cfish_String* self, size_t tick);
347  
348 typedef cfish_String*
349 (*CFISH_Str_SubString_t)(cfish_String* self, size_t offset, size_t length);
350  
351 typedef cfish_StringIterator*
352 (*CFISH_Str_Top_t)(cfish_String* self);
353  
354 typedef cfish_StringIterator*
355 (*CFISH_Str_Tail_t)(cfish_String* self);
356  
357  
358  
359 /* Define type-safe wrappers for inert functions of Obj.
360 */
361  
362 static CFISH_INLINE cfish_Class*
363 cfish_Str_get_class(cfish_String *self) {
364 return cfish_Obj_get_class((cfish_Obj*)self);
365 }
366  
367 static CFISH_INLINE cfish_String*
368 cfish_Str_get_class_name(cfish_String *self) {
369 return cfish_Obj_get_class_name((cfish_Obj*)self);
370 }
371  
372 static CFISH_INLINE bool
373 cfish_Str_is_a(cfish_String *self, cfish_Class *ancestor) {
374 return cfish_Obj_is_a((cfish_Obj*)self, ancestor);
375 }
376  
377  
378 /* Define the inline functions which implement this class's virtual methods.
379 */
380  
381 extern CFISH_VISIBLE uint32_t CFISH_Str_To_Host_OFFSET;
382 static CFISH_INLINE void*
383 1 CFISH_Str_To_Host(cfish_String* self, void* vcache) {
384 #ifdef CFP_CFISH
385 1 return CFISH_Str_To_Host_IMP(self, vcache);
386 #else
387 const CFISH_Str_To_Host_t method = (CFISH_Str_To_Host_t)cfish_obj_method(self, CFISH_Str_To_Host_OFFSET);
388 return method(self, vcache);
389 #endif
390 }
391  
392 extern CFISH_VISIBLE uint32_t CFISH_Str_Clone_OFFSET;
393 static CFISH_INLINE cfish_String*
394 CFISH_Str_Clone(cfish_String* self) {
395 #ifdef CFP_CFISH
396 return CFISH_Str_Clone_IMP(self);
397 #else
398 const CFISH_Str_Clone_t method = (CFISH_Str_Clone_t)cfish_obj_method(self, CFISH_Str_Clone_OFFSET);
399 return method(self);
400 #endif
401 }
402  
403 extern CFISH_VISIBLE uint32_t CFISH_Str_Equals_OFFSET;
404 static CFISH_INLINE bool
405 CFISH_Str_Equals(cfish_String* self, cfish_Obj* other) {
406 #ifdef CFP_CFISH
407 return CFISH_Str_Equals_IMP(self, other);
408 #else
409 const CFISH_Str_Equals_t method = (CFISH_Str_Equals_t)cfish_obj_method(self, CFISH_Str_Equals_OFFSET);
410 return method(self, other);
411 #endif
412 }
413  
414 extern CFISH_VISIBLE uint32_t CFISH_Str_Compare_To_OFFSET;
415 static CFISH_INLINE int32_t
416 CFISH_Str_Compare_To(cfish_String* self, cfish_Obj* other) {
417 #ifdef CFP_CFISH
418 return CFISH_Str_Compare_To_IMP(self, other);
419 #else
420 const CFISH_Str_Compare_To_t method = (CFISH_Str_Compare_To_t)cfish_obj_method(self, CFISH_Str_Compare_To_OFFSET);
421 return method(self, other);
422 #endif
423 }
424  
425 extern CFISH_VISIBLE uint32_t CFISH_Str_Destroy_OFFSET;
426 static CFISH_INLINE void
427 CFISH_Str_Destroy(cfish_String* self) {
428 #ifdef CFP_CFISH
429 CFISH_Str_Destroy_IMP(self);
430 #else
431 const CFISH_Str_Destroy_t method = (CFISH_Str_Destroy_t)cfish_obj_method(self, CFISH_Str_Destroy_OFFSET);
432 method(self);
433 #endif
434 }
435  
436 extern CFISH_VISIBLE uint32_t CFISH_Str_To_String_OFFSET;
437 static CFISH_INLINE cfish_String*
438 CFISH_Str_To_String(cfish_String* self) {
439 #ifdef CFP_CFISH
440 return CFISH_Str_To_String_IMP(self);
441 #else
442 const CFISH_Str_To_String_t method = (CFISH_Str_To_String_t)cfish_obj_method(self, CFISH_Str_To_String_OFFSET);
443 return method(self);
444 #endif
445 }
446  
447 extern CFISH_VISIBLE uint32_t CFISH_Str_Cat_OFFSET;
448 static CFISH_INLINE cfish_String*
449 CFISH_Str_Cat(cfish_String* self, cfish_String* other) {
450 #ifdef CFP_CFISH
451 return CFISH_Str_Cat_IMP(self, other);
452 #else
453 const CFISH_Str_Cat_t method = (CFISH_Str_Cat_t)cfish_obj_method(self, CFISH_Str_Cat_OFFSET);
454 return method(self, other);
455 #endif
456 }
457  
458 extern CFISH_VISIBLE uint32_t CFISH_Str_Cat_Utf8_OFFSET;
459 static CFISH_INLINE cfish_String*
460 CFISH_Str_Cat_Utf8(cfish_String* self, const char* utf8, size_t size) {
461 #ifdef CFP_CFISH
462 return CFISH_Str_Cat_Utf8_IMP(self, utf8, size);
463 #else
464 const CFISH_Str_Cat_Utf8_t method = (CFISH_Str_Cat_Utf8_t)cfish_obj_method(self, CFISH_Str_Cat_Utf8_OFFSET);
465 return method(self, utf8, size);
466 #endif
467 }
468  
469 extern CFISH_VISIBLE uint32_t CFISH_Str_Cat_Trusted_Utf8_OFFSET;
470 static CFISH_INLINE cfish_String*
471 CFISH_Str_Cat_Trusted_Utf8(cfish_String* self, const char* utf8, size_t size) {
472 #ifdef CFP_CFISH
473 return CFISH_Str_Cat_Trusted_Utf8_IMP(self, utf8, size);
474 #else
475 const CFISH_Str_Cat_Trusted_Utf8_t method = (CFISH_Str_Cat_Trusted_Utf8_t)cfish_obj_method(self, CFISH_Str_Cat_Trusted_Utf8_OFFSET);
476 return method(self, utf8, size);
477 #endif
478 }
479  
480 extern CFISH_VISIBLE uint32_t CFISH_Str_To_I64_OFFSET;
481 static CFISH_INLINE int64_t
482 CFISH_Str_To_I64(cfish_String* self) {
483 #ifdef CFP_CFISH
484 return CFISH_Str_To_I64_IMP(self);
485 #else
486 const CFISH_Str_To_I64_t method = (CFISH_Str_To_I64_t)cfish_obj_method(self, CFISH_Str_To_I64_OFFSET);
487 return method(self);
488 #endif
489 }
490  
491 extern CFISH_VISIBLE uint32_t CFISH_Str_BaseX_To_I64_OFFSET;
492 static CFISH_INLINE int64_t
493 CFISH_Str_BaseX_To_I64(cfish_String* self, uint32_t base) {
494 #ifdef CFP_CFISH
495 return CFISH_Str_BaseX_To_I64_IMP(self, base);
496 #else
497 const CFISH_Str_BaseX_To_I64_t method = (CFISH_Str_BaseX_To_I64_t)cfish_obj_method(self, CFISH_Str_BaseX_To_I64_OFFSET);
498 return method(self, base);
499 #endif
500 }
501  
502 extern CFISH_VISIBLE uint32_t CFISH_Str_To_F64_OFFSET;
503 static CFISH_INLINE double
504 CFISH_Str_To_F64(cfish_String* self) {
505 #ifdef CFP_CFISH
506 return CFISH_Str_To_F64_IMP(self);
507 #else
508 const CFISH_Str_To_F64_t method = (CFISH_Str_To_F64_t)cfish_obj_method(self, CFISH_Str_To_F64_OFFSET);
509 return method(self);
510 #endif
511 }
512  
513 extern CFISH_VISIBLE uint32_t CFISH_Str_Starts_With_OFFSET;
514 static CFISH_INLINE bool
515 CFISH_Str_Starts_With(cfish_String* self, cfish_String* prefix) {
516 #ifdef CFP_CFISH
517 return CFISH_Str_Starts_With_IMP(self, prefix);
518 #else
519 const CFISH_Str_Starts_With_t method = (CFISH_Str_Starts_With_t)cfish_obj_method(self, CFISH_Str_Starts_With_OFFSET);
520 return method(self, prefix);
521 #endif
522 }
523  
524 extern CFISH_VISIBLE uint32_t CFISH_Str_Starts_With_Utf8_OFFSET;
525 static CFISH_INLINE bool
526 CFISH_Str_Starts_With_Utf8(cfish_String* self, const char* utf8, size_t size) {
527 #ifdef CFP_CFISH
528 return CFISH_Str_Starts_With_Utf8_IMP(self, utf8, size);
529 #else
530 const CFISH_Str_Starts_With_Utf8_t method = (CFISH_Str_Starts_With_Utf8_t)cfish_obj_method(self, CFISH_Str_Starts_With_Utf8_OFFSET);
531 return method(self, utf8, size);
532 #endif
533 }
534  
535 extern CFISH_VISIBLE uint32_t CFISH_Str_Ends_With_OFFSET;
536 static CFISH_INLINE bool
537 CFISH_Str_Ends_With(cfish_String* self, cfish_String* suffix) {
538 #ifdef CFP_CFISH
539 return CFISH_Str_Ends_With_IMP(self, suffix);
540 #else
541 const CFISH_Str_Ends_With_t method = (CFISH_Str_Ends_With_t)cfish_obj_method(self, CFISH_Str_Ends_With_OFFSET);
542 return method(self, suffix);
543 #endif
544 }
545  
546 extern CFISH_VISIBLE uint32_t CFISH_Str_Ends_With_Utf8_OFFSET;
547 static CFISH_INLINE bool
548 CFISH_Str_Ends_With_Utf8(cfish_String* self, const char* utf8, size_t size) {
549 #ifdef CFP_CFISH
550 return CFISH_Str_Ends_With_Utf8_IMP(self, utf8, size);
551 #else
552 const CFISH_Str_Ends_With_Utf8_t method = (CFISH_Str_Ends_With_Utf8_t)cfish_obj_method(self, CFISH_Str_Ends_With_Utf8_OFFSET);
553 return method(self, utf8, size);
554 #endif
555 }
556  
557 extern CFISH_VISIBLE uint32_t CFISH_Str_Contains_OFFSET;
558 static CFISH_INLINE bool
559 CFISH_Str_Contains(cfish_String* self, cfish_String* substring) {
560 #ifdef CFP_CFISH
561 return CFISH_Str_Contains_IMP(self, substring);
562 #else
563 const CFISH_Str_Contains_t method = (CFISH_Str_Contains_t)cfish_obj_method(self, CFISH_Str_Contains_OFFSET);
564 return method(self, substring);
565 #endif
566 }
567  
568 extern CFISH_VISIBLE uint32_t CFISH_Str_Contains_Utf8_OFFSET;
569 static CFISH_INLINE bool
570 CFISH_Str_Contains_Utf8(cfish_String* self, const char* utf8, size_t size) {
571 #ifdef CFP_CFISH
572 return CFISH_Str_Contains_Utf8_IMP(self, utf8, size);
573 #else
574 const CFISH_Str_Contains_Utf8_t method = (CFISH_Str_Contains_Utf8_t)cfish_obj_method(self, CFISH_Str_Contains_Utf8_OFFSET);
575 return method(self, utf8, size);
576 #endif
577 }
578  
579 extern CFISH_VISIBLE uint32_t CFISH_Str_Find_OFFSET;
580 static CFISH_INLINE cfish_StringIterator*
581 CFISH_Str_Find(cfish_String* self, cfish_String* substring) {
582 #ifdef CFP_CFISH
583 return CFISH_Str_Find_IMP(self, substring);
584 #else
585 const CFISH_Str_Find_t method = (CFISH_Str_Find_t)cfish_obj_method(self, CFISH_Str_Find_OFFSET);
586 return method(self, substring);
587 #endif
588 }
589  
590 extern CFISH_VISIBLE uint32_t CFISH_Str_Find_Utf8_OFFSET;
591 static CFISH_INLINE cfish_StringIterator*
592 CFISH_Str_Find_Utf8(cfish_String* self, const char* utf8, size_t size) {
593 #ifdef CFP_CFISH
594 return CFISH_Str_Find_Utf8_IMP(self, utf8, size);
595 #else
596 const CFISH_Str_Find_Utf8_t method = (CFISH_Str_Find_Utf8_t)cfish_obj_method(self, CFISH_Str_Find_Utf8_OFFSET);
597 return method(self, utf8, size);
598 #endif
599 }
600  
601 extern CFISH_VISIBLE uint32_t CFISH_Str_Equals_Utf8_OFFSET;
602 static CFISH_INLINE bool
603 CFISH_Str_Equals_Utf8(cfish_String* self, const char* utf8, size_t size) {
604 #ifdef CFP_CFISH
605 return CFISH_Str_Equals_Utf8_IMP(self, utf8, size);
606 #else
607 const CFISH_Str_Equals_Utf8_t method = (CFISH_Str_Equals_Utf8_t)cfish_obj_method(self, CFISH_Str_Equals_Utf8_OFFSET);
608 return method(self, utf8, size);
609 #endif
610 }
611  
612 extern CFISH_VISIBLE uint32_t CFISH_Str_Length_OFFSET;
613 static CFISH_INLINE size_t
614 CFISH_Str_Length(cfish_String* self) {
615 #ifdef CFP_CFISH
616 return CFISH_Str_Length_IMP(self);
617 #else
618 const CFISH_Str_Length_t method = (CFISH_Str_Length_t)cfish_obj_method(self, CFISH_Str_Length_OFFSET);
619 return method(self);
620 #endif
621 }
622  
623 extern CFISH_VISIBLE uint32_t CFISH_Str_Get_Size_OFFSET;
624 static CFISH_INLINE size_t
625 CFISH_Str_Get_Size(cfish_String* self) {
626 #ifdef CFP_CFISH
627 return CFISH_Str_Get_Size_IMP(self);
628 #else
629 const CFISH_Str_Get_Size_t method = (CFISH_Str_Get_Size_t)cfish_obj_method(self, CFISH_Str_Get_Size_OFFSET);
630 return method(self);
631 #endif
632 }
633  
634 extern CFISH_VISIBLE uint32_t CFISH_Str_Get_Ptr8_OFFSET;
635 static CFISH_INLINE const char*
636 CFISH_Str_Get_Ptr8(cfish_String* self) {
637 #ifdef CFP_CFISH
638 return CFISH_Str_Get_Ptr8_IMP(self);
639 #else
640 const CFISH_Str_Get_Ptr8_t method = (CFISH_Str_Get_Ptr8_t)cfish_obj_method(self, CFISH_Str_Get_Ptr8_OFFSET);
641 return method(self);
642 #endif
643 }
644  
645 extern CFISH_VISIBLE uint32_t CFISH_Str_To_Utf8_OFFSET;
646 static CFISH_INLINE char*
647 CFISH_Str_To_Utf8(cfish_String* self) {
648 #ifdef CFP_CFISH
649 return CFISH_Str_To_Utf8_IMP(self);
650 #else
651 const CFISH_Str_To_Utf8_t method = (CFISH_Str_To_Utf8_t)cfish_obj_method(self, CFISH_Str_To_Utf8_OFFSET);
652 return method(self);
653 #endif
654 }
655  
656 extern CFISH_VISIBLE uint32_t CFISH_Str_To_ByteBuf_OFFSET;
657 static CFISH_INLINE cfish_ByteBuf*
658 CFISH_Str_To_ByteBuf(cfish_String* self) {
659 #ifdef CFP_CFISH
660 return CFISH_Str_To_ByteBuf_IMP(self);
661 #else
662 const CFISH_Str_To_ByteBuf_t method = (CFISH_Str_To_ByteBuf_t)cfish_obj_method(self, CFISH_Str_To_ByteBuf_OFFSET);
663 return method(self);
664 #endif
665 }
666  
667 extern CFISH_VISIBLE uint32_t CFISH_Str_Is_Copy_On_IncRef_OFFSET;
668 static CFISH_INLINE bool
669 CFISH_Str_Is_Copy_On_IncRef(cfish_String* self) {
670 #ifdef CFP_CFISH
671 return CFISH_Str_Is_Copy_On_IncRef_IMP(self);
672 #else
673 const CFISH_Str_Is_Copy_On_IncRef_t method = (CFISH_Str_Is_Copy_On_IncRef_t)cfish_obj_method(self, CFISH_Str_Is_Copy_On_IncRef_OFFSET);
674 return method(self);
675 #endif
676 }
677  
678 extern CFISH_VISIBLE uint32_t CFISH_Str_Hash_Sum_OFFSET;
679 static CFISH_INLINE size_t
680 CFISH_Str_Hash_Sum(cfish_String* self) {
681 #ifdef CFP_CFISH
682 return CFISH_Str_Hash_Sum_IMP(self);
683 #else
684 const CFISH_Str_Hash_Sum_t method = (CFISH_Str_Hash_Sum_t)cfish_obj_method(self, CFISH_Str_Hash_Sum_OFFSET);
685 return method(self);
686 #endif
687 }
688  
689 extern CFISH_VISIBLE uint32_t CFISH_Str_Trim_OFFSET;
690 static CFISH_INLINE cfish_String*
691 CFISH_Str_Trim(cfish_String* self) {
692 #ifdef CFP_CFISH
693 return CFISH_Str_Trim_IMP(self);
694 #else
695 const CFISH_Str_Trim_t method = (CFISH_Str_Trim_t)cfish_obj_method(self, CFISH_Str_Trim_OFFSET);
696 return method(self);
697 #endif
698 }
699  
700 extern CFISH_VISIBLE uint32_t CFISH_Str_Trim_Top_OFFSET;
701 static CFISH_INLINE cfish_String*
702 CFISH_Str_Trim_Top(cfish_String* self) {
703 #ifdef CFP_CFISH
704 return CFISH_Str_Trim_Top_IMP(self);
705 #else
706 const CFISH_Str_Trim_Top_t method = (CFISH_Str_Trim_Top_t)cfish_obj_method(self, CFISH_Str_Trim_Top_OFFSET);
707 return method(self);
708 #endif
709 }
710  
711 extern CFISH_VISIBLE uint32_t CFISH_Str_Trim_Tail_OFFSET;
712 static CFISH_INLINE cfish_String*
713 CFISH_Str_Trim_Tail(cfish_String* self) {
714 #ifdef CFP_CFISH
715 return CFISH_Str_Trim_Tail_IMP(self);
716 #else
717 const CFISH_Str_Trim_Tail_t method = (CFISH_Str_Trim_Tail_t)cfish_obj_method(self, CFISH_Str_Trim_Tail_OFFSET);
718 return method(self);
719 #endif
720 }
721  
722 extern CFISH_VISIBLE uint32_t CFISH_Str_Code_Point_At_OFFSET;
723 static CFISH_INLINE int32_t
724 CFISH_Str_Code_Point_At(cfish_String* self, size_t tick) {
725 #ifdef CFP_CFISH
726 return CFISH_Str_Code_Point_At_IMP(self, tick);
727 #else
728 const CFISH_Str_Code_Point_At_t method = (CFISH_Str_Code_Point_At_t)cfish_obj_method(self, CFISH_Str_Code_Point_At_OFFSET);
729 return method(self, tick);
730 #endif
731 }
732  
733 extern CFISH_VISIBLE uint32_t CFISH_Str_Code_Point_From_OFFSET;
734 static CFISH_INLINE int32_t
735 CFISH_Str_Code_Point_From(cfish_String* self, size_t tick) {
736 #ifdef CFP_CFISH
737 return CFISH_Str_Code_Point_From_IMP(self, tick);
738 #else
739 const CFISH_Str_Code_Point_From_t method = (CFISH_Str_Code_Point_From_t)cfish_obj_method(self, CFISH_Str_Code_Point_From_OFFSET);
740 return method(self, tick);
741 #endif
742 }
743  
744 extern CFISH_VISIBLE uint32_t CFISH_Str_SubString_OFFSET;
745 static CFISH_INLINE cfish_String*
746 CFISH_Str_SubString(cfish_String* self, size_t offset, size_t length) {
747 #ifdef CFP_CFISH
748 return CFISH_Str_SubString_IMP(self, offset, length);
749 #else
750 const CFISH_Str_SubString_t method = (CFISH_Str_SubString_t)cfish_obj_method(self, CFISH_Str_SubString_OFFSET);
751 return method(self, offset, length);
752 #endif
753 }
754  
755 extern CFISH_VISIBLE uint32_t CFISH_Str_Top_OFFSET;
756 static CFISH_INLINE cfish_StringIterator*
757 CFISH_Str_Top(cfish_String* self) {
758 #ifdef CFP_CFISH
759 return CFISH_Str_Top_IMP(self);
760 #else
761 const CFISH_Str_Top_t method = (CFISH_Str_Top_t)cfish_obj_method(self, CFISH_Str_Top_OFFSET);
762 return method(self);
763 #endif
764 }
765  
766 extern CFISH_VISIBLE uint32_t CFISH_Str_Tail_OFFSET;
767 static CFISH_INLINE cfish_StringIterator*
768 CFISH_Str_Tail(cfish_String* self) {
769 #ifdef CFP_CFISH
770 return CFISH_Str_Tail_IMP(self);
771 #else
772 const CFISH_Str_Tail_t method = (CFISH_Str_Tail_t)cfish_obj_method(self, CFISH_Str_Tail_OFFSET);
773 return method(self);
774 #endif
775 }
776  
777  
778  
779 /* Declare callbacks for wrapping host overrides.
780 */
781  
782 #ifdef CFISH_NO_DYNAMIC_OVERRIDES
783 #else
784 #endif
785  
786  
787 /* Define "short names" for this class's symbols.
788 */
789  
790 #ifdef CFISH_USE_SHORT_NAMES
791 #define String cfish_String
792 #define STRING CFISH_STRING
793 #define Str_utf8_valid cfish_Str_utf8_valid
794 #define Str_validate_utf8 cfish_Str_validate_utf8
795 #define Str_is_whitespace cfish_Str_is_whitespace
796 #define Str_encode_utf8_char cfish_Str_encode_utf8_char
797 #define Str_new_from_utf8 cfish_Str_new_from_utf8
798 #define Str_new_from_trusted_utf8 cfish_Str_new_from_trusted_utf8
799 #define Str_init_from_trusted_utf8 cfish_Str_init_from_trusted_utf8
800 #define Str_new_steal_utf8 cfish_Str_new_steal_utf8
801 #define Str_new_steal_trusted_utf8 cfish_Str_new_steal_trusted_utf8
802 #define Str_init_steal_trusted_utf8 cfish_Str_init_steal_trusted_utf8
803 #define Str_new_wrap_utf8 cfish_Str_new_wrap_utf8
804 #define Str_new_wrap_trusted_utf8 cfish_Str_new_wrap_trusted_utf8
805 #define Str_init_stack_string cfish_Str_init_stack_string
806 #define Str_init_wrap_trusted_utf8 cfish_Str_init_wrap_trusted_utf8
807 #define Str_new_from_char cfish_Str_new_from_char
808 #define Str_newf cfish_Str_newf
809 #define Str_get_class cfish_Str_get_class
810 #define Str_get_class_name cfish_Str_get_class_name
811 #define Str_is_a cfish_Str_is_a
812 #define Str_To_Host_IMP CFISH_Str_To_Host_IMP
813 #define Str_Cat_IMP CFISH_Str_Cat_IMP
814 #define Str_Cat_Utf8_IMP CFISH_Str_Cat_Utf8_IMP
815 #define Str_Cat_Trusted_Utf8_IMP CFISH_Str_Cat_Trusted_Utf8_IMP
816 #define Str_To_I64_IMP CFISH_Str_To_I64_IMP
817 #define Str_BaseX_To_I64_IMP CFISH_Str_BaseX_To_I64_IMP
818 #define Str_To_F64_IMP CFISH_Str_To_F64_IMP
819 #define Str_Starts_With_IMP CFISH_Str_Starts_With_IMP
820 #define Str_Starts_With_Utf8_IMP CFISH_Str_Starts_With_Utf8_IMP
821 #define Str_Ends_With_IMP CFISH_Str_Ends_With_IMP
822 #define Str_Ends_With_Utf8_IMP CFISH_Str_Ends_With_Utf8_IMP
823 #define Str_Contains_IMP CFISH_Str_Contains_IMP
824 #define Str_Contains_Utf8_IMP CFISH_Str_Contains_Utf8_IMP
825 #define Str_Find_IMP CFISH_Str_Find_IMP
826 #define Str_Find_Utf8_IMP CFISH_Str_Find_Utf8_IMP
827 #define Str_Equals_IMP CFISH_Str_Equals_IMP
828 #define Str_Equals_Utf8_IMP CFISH_Str_Equals_Utf8_IMP
829 #define Str_Length_IMP CFISH_Str_Length_IMP
830 #define Str_Get_Size_IMP CFISH_Str_Get_Size_IMP
831 #define Str_Get_Ptr8_IMP CFISH_Str_Get_Ptr8_IMP
832 #define Str_To_Utf8_IMP CFISH_Str_To_Utf8_IMP
833 #define Str_To_ByteBuf_IMP CFISH_Str_To_ByteBuf_IMP
834 #define Str_Clone_IMP CFISH_Str_Clone_IMP
835 #define Str_Is_Copy_On_IncRef_IMP CFISH_Str_Is_Copy_On_IncRef_IMP
836 #define Str_Compare_To_IMP CFISH_Str_Compare_To_IMP
837 #define Str_Hash_Sum_IMP CFISH_Str_Hash_Sum_IMP
838 #define Str_To_String_IMP CFISH_Str_To_String_IMP
839 #define Str_Trim_IMP CFISH_Str_Trim_IMP
840 #define Str_Trim_Top_IMP CFISH_Str_Trim_Top_IMP
841 #define Str_Trim_Tail_IMP CFISH_Str_Trim_Tail_IMP
842 #define Str_Code_Point_At_IMP CFISH_Str_Code_Point_At_IMP
843 #define Str_Code_Point_From_IMP CFISH_Str_Code_Point_From_IMP
844 #define Str_SubString_IMP CFISH_Str_SubString_IMP
845 #define Str_Top_IMP CFISH_Str_Top_IMP
846 #define Str_Tail_IMP CFISH_Str_Tail_IMP
847 #define Str_Destroy_IMP CFISH_Str_Destroy_IMP
848 #define Str_To_Host CFISH_Str_To_Host
849 #define Str_To_Host_t CFISH_Str_To_Host_t
850 #define Str_Clone CFISH_Str_Clone
851 #define Str_Clone_t CFISH_Str_Clone_t
852 #define Str_Equals CFISH_Str_Equals
853 #define Str_Equals_t CFISH_Str_Equals_t
854 #define Str_Compare_To CFISH_Str_Compare_To
855 #define Str_Compare_To_t CFISH_Str_Compare_To_t
856 #define Str_Destroy CFISH_Str_Destroy
857 #define Str_Destroy_t CFISH_Str_Destroy_t
858 #define Str_To_String CFISH_Str_To_String
859 #define Str_To_String_t CFISH_Str_To_String_t
860 #define Str_Cat CFISH_Str_Cat
861 #define Str_Cat_t CFISH_Str_Cat_t
862 #define Str_Cat_Utf8 CFISH_Str_Cat_Utf8
863 #define Str_Cat_Utf8_t CFISH_Str_Cat_Utf8_t
864 #define Str_Cat_Trusted_Utf8 CFISH_Str_Cat_Trusted_Utf8
865 #define Str_Cat_Trusted_Utf8_t CFISH_Str_Cat_Trusted_Utf8_t
866 #define Str_To_I64 CFISH_Str_To_I64
867 #define Str_To_I64_t CFISH_Str_To_I64_t
868 #define Str_BaseX_To_I64 CFISH_Str_BaseX_To_I64
869 #define Str_BaseX_To_I64_t CFISH_Str_BaseX_To_I64_t
870 #define Str_To_F64 CFISH_Str_To_F64
871 #define Str_To_F64_t CFISH_Str_To_F64_t
872 #define Str_Starts_With CFISH_Str_Starts_With
873 #define Str_Starts_With_t CFISH_Str_Starts_With_t
874 #define Str_Starts_With_Utf8 CFISH_Str_Starts_With_Utf8
875 #define Str_Starts_With_Utf8_t CFISH_Str_Starts_With_Utf8_t
876 #define Str_Ends_With CFISH_Str_Ends_With
877 #define Str_Ends_With_t CFISH_Str_Ends_With_t
878 #define Str_Ends_With_Utf8 CFISH_Str_Ends_With_Utf8
879 #define Str_Ends_With_Utf8_t CFISH_Str_Ends_With_Utf8_t
880 #define Str_Contains CFISH_Str_Contains
881 #define Str_Contains_t CFISH_Str_Contains_t
882 #define Str_Contains_Utf8 CFISH_Str_Contains_Utf8
883 #define Str_Contains_Utf8_t CFISH_Str_Contains_Utf8_t
884 #define Str_Find CFISH_Str_Find
885 #define Str_Find_t CFISH_Str_Find_t
886 #define Str_Find_Utf8 CFISH_Str_Find_Utf8
887 #define Str_Find_Utf8_t CFISH_Str_Find_Utf8_t
888 #define Str_Equals_Utf8 CFISH_Str_Equals_Utf8
889 #define Str_Equals_Utf8_t CFISH_Str_Equals_Utf8_t
890 #define Str_Length CFISH_Str_Length
891 #define Str_Length_t CFISH_Str_Length_t
892 #define Str_Get_Size CFISH_Str_Get_Size
893 #define Str_Get_Size_t CFISH_Str_Get_Size_t
894 #define Str_Get_Ptr8 CFISH_Str_Get_Ptr8
895 #define Str_Get_Ptr8_t CFISH_Str_Get_Ptr8_t
896 #define Str_To_Utf8 CFISH_Str_To_Utf8
897 #define Str_To_Utf8_t CFISH_Str_To_Utf8_t
898 #define Str_To_ByteBuf CFISH_Str_To_ByteBuf
899 #define Str_To_ByteBuf_t CFISH_Str_To_ByteBuf_t
900 #define Str_Is_Copy_On_IncRef CFISH_Str_Is_Copy_On_IncRef
901 #define Str_Is_Copy_On_IncRef_t CFISH_Str_Is_Copy_On_IncRef_t
902 #define Str_Hash_Sum CFISH_Str_Hash_Sum
903 #define Str_Hash_Sum_t CFISH_Str_Hash_Sum_t
904 #define Str_Trim CFISH_Str_Trim
905 #define Str_Trim_t CFISH_Str_Trim_t
906 #define Str_Trim_Top CFISH_Str_Trim_Top
907 #define Str_Trim_Top_t CFISH_Str_Trim_Top_t
908 #define Str_Trim_Tail CFISH_Str_Trim_Tail
909 #define Str_Trim_Tail_t CFISH_Str_Trim_Tail_t
910 #define Str_Code_Point_At CFISH_Str_Code_Point_At
911 #define Str_Code_Point_At_t CFISH_Str_Code_Point_At_t
912 #define Str_Code_Point_From CFISH_Str_Code_Point_From
913 #define Str_Code_Point_From_t CFISH_Str_Code_Point_From_t
914 #define Str_SubString CFISH_Str_SubString
915 #define Str_SubString_t CFISH_Str_SubString_t
916 #define Str_Top CFISH_Str_Top
917 #define Str_Top_t CFISH_Str_Top_t
918 #define Str_Tail CFISH_Str_Tail
919 #define Str_Tail_t CFISH_Str_Tail_t
920 #endif /* CFISH_USE_SHORT_NAMES */
921  
922  
923  
924 /* Include the header for this class's parent.
925 */
926  
927 #include "Clownfish/Obj.h"
928  
929 /* Define the struct layout for instances of this class.
930 */
931  
932 #ifdef C_CFISH_STRINGITERATOR
933 extern uint32_t cfish_StrIter_IVARS_OFFSET;
934 typedef struct cfish_StringIteratorIVARS cfish_StringIteratorIVARS;
935 static CFISH_INLINE cfish_StringIteratorIVARS*
936 cfish_StrIter_IVARS(cfish_StringIterator *self) {
937 char *ptr = (char*)self + cfish_StrIter_IVARS_OFFSET;
938 return (cfish_StringIteratorIVARS*)ptr;
939 }
940 #ifdef CFISH_USE_SHORT_NAMES
941 #define StringIteratorIVARS cfish_StringIteratorIVARS
942 #define StrIter_IVARS cfish_StrIter_IVARS
943 #endif
944  
945 struct cfish_StringIterator {
946 CFISH_OBJ_HEAD
947 cfish_Class* klass;
948 cfish_String* string;
949 size_t byte_offset;
950 };
951  
952 #endif /* C_CFISH_STRINGITERATOR */
953  
954 /* Declare this class's inert variables.
955 */
956  
957  
958  
959 /* Declare both this class's inert functions and the C functions which
960 * implement this class's dynamic methods.
961 */
962  
963 CFISH_VISIBLE cfish_StringIterator*
964 cfish_StrIter_new(cfish_String* string, size_t byte_offset);
965  
966 CFISH_VISIBLE cfish_String*
967 cfish_StrIter_crop(cfish_StringIterator* top, cfish_StringIterator* tail);
968  
969 cfish_StringIterator*
970 CFISH_StrIter_Clone_IMP(cfish_StringIterator* self);
971  
972 void
973 CFISH_StrIter_Assign_IMP(cfish_StringIterator* self, cfish_StringIterator* other);
974  
975 bool
976 CFISH_StrIter_Equals_IMP(cfish_StringIterator* self, cfish_Obj* other);
977  
978 int32_t
979 CFISH_StrIter_Compare_To_IMP(cfish_StringIterator* self, cfish_Obj* other);
980  
981 bool
982 CFISH_StrIter_Has_Next_IMP(cfish_StringIterator* self);
983  
984 bool
985 CFISH_StrIter_Has_Prev_IMP(cfish_StringIterator* self);
986  
987 int32_t
988 CFISH_StrIter_Next_IMP(cfish_StringIterator* self);
989  
990 int32_t
991 CFISH_StrIter_Prev_IMP(cfish_StringIterator* self);
992  
993 size_t
994 CFISH_StrIter_Advance_IMP(cfish_StringIterator* self, size_t num);
995  
996 size_t
997 CFISH_StrIter_Recede_IMP(cfish_StringIterator* self, size_t num);
998  
999 size_t
1000 CFISH_StrIter_Skip_Whitespace_IMP(cfish_StringIterator* self);
1001  
1002 size_t
1003 CFISH_StrIter_Skip_Whitespace_Back_IMP(cfish_StringIterator* self);
1004  
1005 bool
1006 CFISH_StrIter_Starts_With_IMP(cfish_StringIterator* self, cfish_String* prefix);
1007  
1008 bool
1009 CFISH_StrIter_Starts_With_Utf8_IMP(cfish_StringIterator* self, const char* utf8, size_t size);
1010  
1011 bool
1012 CFISH_StrIter_Ends_With_IMP(cfish_StringIterator* self, cfish_String* suffix);
1013  
1014 bool
1015 CFISH_StrIter_Ends_With_Utf8_IMP(cfish_StringIterator* self, const char* utf8, size_t size);
1016  
1017 void
1018 CFISH_StrIter_Destroy_IMP(cfish_StringIterator* self);
1019  
1020  
1021  
1022 /* Define typedefs for each dynamic method, allowing us to cast generic
1023 * pointers to the appropriate function pointer type more cleanly.
1024 */
1025  
1026 typedef void*
1027 (*CFISH_StrIter_To_Host_t)(cfish_StringIterator* self, void* vcache);
1028  
1029 typedef cfish_StringIterator*
1030 (*CFISH_StrIter_Clone_t)(cfish_StringIterator* self);
1031  
1032 typedef bool
1033 (*CFISH_StrIter_Equals_t)(cfish_StringIterator* self, cfish_Obj* other);
1034  
1035 typedef int32_t
1036 (*CFISH_StrIter_Compare_To_t)(cfish_StringIterator* self, cfish_Obj* other);
1037  
1038 typedef void
1039 (*CFISH_StrIter_Destroy_t)(cfish_StringIterator* self);
1040  
1041 typedef cfish_String*
1042 (*CFISH_StrIter_To_String_t)(cfish_StringIterator* self);
1043  
1044 typedef void
1045 (*CFISH_StrIter_Assign_t)(cfish_StringIterator* self, cfish_StringIterator* other);
1046  
1047 typedef bool
1048 (*CFISH_StrIter_Has_Next_t)(cfish_StringIterator* self);
1049  
1050 typedef bool
1051 (*CFISH_StrIter_Has_Prev_t)(cfish_StringIterator* self);
1052  
1053 typedef int32_t
1054 (*CFISH_StrIter_Next_t)(cfish_StringIterator* self);
1055  
1056 typedef int32_t
1057 (*CFISH_StrIter_Prev_t)(cfish_StringIterator* self);
1058  
1059 typedef size_t
1060 (*CFISH_StrIter_Advance_t)(cfish_StringIterator* self, size_t num);
1061  
1062 typedef size_t
1063 (*CFISH_StrIter_Recede_t)(cfish_StringIterator* self, size_t num);
1064  
1065 typedef size_t
1066 (*CFISH_StrIter_Skip_Whitespace_t)(cfish_StringIterator* self);
1067  
1068 typedef size_t
1069 (*CFISH_StrIter_Skip_Whitespace_Back_t)(cfish_StringIterator* self);
1070  
1071 typedef bool
1072 (*CFISH_StrIter_Starts_With_t)(cfish_StringIterator* self, cfish_String* prefix);
1073  
1074 typedef bool
1075 (*CFISH_StrIter_Starts_With_Utf8_t)(cfish_StringIterator* self, const char* utf8, size_t size);
1076  
1077 typedef bool
1078 (*CFISH_StrIter_Ends_With_t)(cfish_StringIterator* self, cfish_String* suffix);
1079  
1080 typedef bool
1081 (*CFISH_StrIter_Ends_With_Utf8_t)(cfish_StringIterator* self, const char* utf8, size_t size);
1082  
1083  
1084  
1085 /* Define type-safe wrappers for inert functions of Obj.
1086 */
1087  
1088 static CFISH_INLINE cfish_Class*
1089 cfish_StrIter_get_class(cfish_StringIterator *self) {
1090 return cfish_Obj_get_class((cfish_Obj*)self);
1091 }
1092  
1093 static CFISH_INLINE cfish_String*
1094 cfish_StrIter_get_class_name(cfish_StringIterator *self) {
1095 return cfish_Obj_get_class_name((cfish_Obj*)self);
1096 }
1097  
1098 static CFISH_INLINE bool
1099 cfish_StrIter_is_a(cfish_StringIterator *self, cfish_Class *ancestor) {
1100 return cfish_Obj_is_a((cfish_Obj*)self, ancestor);
1101 }
1102  
1103  
1104 /* Define the inline functions which implement this class's virtual methods.
1105 */
1106  
1107 extern CFISH_VISIBLE uint32_t CFISH_StrIter_To_Host_OFFSET;
1108 static CFISH_INLINE void*
1109 CFISH_StrIter_To_Host(cfish_StringIterator* self, void* vcache) {
1110 #ifdef CFP_CFISH
1111 return CFISH_Obj_To_Host_IMP((cfish_Obj*)self, vcache);
1112 #else
1113 const CFISH_StrIter_To_Host_t method = (CFISH_StrIter_To_Host_t)cfish_obj_method(self, CFISH_StrIter_To_Host_OFFSET);
1114 return method(self, vcache);
1115 #endif
1116 }
1117  
1118 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Clone_OFFSET;
1119 static CFISH_INLINE cfish_StringIterator*
1120 CFISH_StrIter_Clone(cfish_StringIterator* self) {
1121 #ifdef CFP_CFISH
1122 return CFISH_StrIter_Clone_IMP(self);
1123 #else
1124 const CFISH_StrIter_Clone_t method = (CFISH_StrIter_Clone_t)cfish_obj_method(self, CFISH_StrIter_Clone_OFFSET);
1125 return method(self);
1126 #endif
1127 }
1128  
1129 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Equals_OFFSET;
1130 static CFISH_INLINE bool
1131 CFISH_StrIter_Equals(cfish_StringIterator* self, cfish_Obj* other) {
1132 #ifdef CFP_CFISH
1133 return CFISH_StrIter_Equals_IMP(self, other);
1134 #else
1135 const CFISH_StrIter_Equals_t method = (CFISH_StrIter_Equals_t)cfish_obj_method(self, CFISH_StrIter_Equals_OFFSET);
1136 return method(self, other);
1137 #endif
1138 }
1139  
1140 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Compare_To_OFFSET;
1141 static CFISH_INLINE int32_t
1142 CFISH_StrIter_Compare_To(cfish_StringIterator* self, cfish_Obj* other) {
1143 #ifdef CFP_CFISH
1144 return CFISH_StrIter_Compare_To_IMP(self, other);
1145 #else
1146 const CFISH_StrIter_Compare_To_t method = (CFISH_StrIter_Compare_To_t)cfish_obj_method(self, CFISH_StrIter_Compare_To_OFFSET);
1147 return method(self, other);
1148 #endif
1149 }
1150  
1151 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Destroy_OFFSET;
1152 static CFISH_INLINE void
1153 CFISH_StrIter_Destroy(cfish_StringIterator* self) {
1154 #ifdef CFP_CFISH
1155 CFISH_StrIter_Destroy_IMP(self);
1156 #else
1157 const CFISH_StrIter_Destroy_t method = (CFISH_StrIter_Destroy_t)cfish_obj_method(self, CFISH_StrIter_Destroy_OFFSET);
1158 method(self);
1159 #endif
1160 }
1161  
1162 extern CFISH_VISIBLE uint32_t CFISH_StrIter_To_String_OFFSET;
1163 static CFISH_INLINE cfish_String*
1164 CFISH_StrIter_To_String(cfish_StringIterator* self) {
1165 #ifdef CFP_CFISH
1166 return CFISH_Obj_To_String_IMP((cfish_Obj*)self);
1167 #else
1168 const CFISH_StrIter_To_String_t method = (CFISH_StrIter_To_String_t)cfish_obj_method(self, CFISH_StrIter_To_String_OFFSET);
1169 return method(self);
1170 #endif
1171 }
1172  
1173 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Assign_OFFSET;
1174 static CFISH_INLINE void
1175 CFISH_StrIter_Assign(cfish_StringIterator* self, cfish_StringIterator* other) {
1176 #ifdef CFP_CFISH
1177 CFISH_StrIter_Assign_IMP(self, other);
1178 #else
1179 const CFISH_StrIter_Assign_t method = (CFISH_StrIter_Assign_t)cfish_obj_method(self, CFISH_StrIter_Assign_OFFSET);
1180 method(self, other);
1181 #endif
1182 }
1183  
1184 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Has_Next_OFFSET;
1185 static CFISH_INLINE bool
1186 CFISH_StrIter_Has_Next(cfish_StringIterator* self) {
1187 #ifdef CFP_CFISH
1188 return CFISH_StrIter_Has_Next_IMP(self);
1189 #else
1190 const CFISH_StrIter_Has_Next_t method = (CFISH_StrIter_Has_Next_t)cfish_obj_method(self, CFISH_StrIter_Has_Next_OFFSET);
1191 return method(self);
1192 #endif
1193 }
1194  
1195 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Has_Prev_OFFSET;
1196 static CFISH_INLINE bool
1197 CFISH_StrIter_Has_Prev(cfish_StringIterator* self) {
1198 #ifdef CFP_CFISH
1199 return CFISH_StrIter_Has_Prev_IMP(self);
1200 #else
1201 const CFISH_StrIter_Has_Prev_t method = (CFISH_StrIter_Has_Prev_t)cfish_obj_method(self, CFISH_StrIter_Has_Prev_OFFSET);
1202 return method(self);
1203 #endif
1204 }
1205  
1206 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Next_OFFSET;
1207 static CFISH_INLINE int32_t
1208 7 CFISH_StrIter_Next(cfish_StringIterator* self) {
1209 #ifdef CFP_CFISH
1210 7 return CFISH_StrIter_Next_IMP(self);
1211 #else
1212 const CFISH_StrIter_Next_t method = (CFISH_StrIter_Next_t)cfish_obj_method(self, CFISH_StrIter_Next_OFFSET);
1213 return method(self);
1214 #endif
1215 }
1216  
1217 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Prev_OFFSET;
1218 static CFISH_INLINE int32_t
1219 0 CFISH_StrIter_Prev(cfish_StringIterator* self) {
1220 #ifdef CFP_CFISH
1221 0 return CFISH_StrIter_Prev_IMP(self);
1222 #else
1223 const CFISH_StrIter_Prev_t method = (CFISH_StrIter_Prev_t)cfish_obj_method(self, CFISH_StrIter_Prev_OFFSET);
1224 return method(self);
1225 #endif
1226 }
1227  
1228 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Advance_OFFSET;
1229 static CFISH_INLINE size_t
1230 CFISH_StrIter_Advance(cfish_StringIterator* self, size_t num) {
1231 #ifdef CFP_CFISH
1232 return CFISH_StrIter_Advance_IMP(self, num);
1233 #else
1234 const CFISH_StrIter_Advance_t method = (CFISH_StrIter_Advance_t)cfish_obj_method(self, CFISH_StrIter_Advance_OFFSET);
1235 return method(self, num);
1236 #endif
1237 }
1238  
1239 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Recede_OFFSET;
1240 static CFISH_INLINE size_t
1241 CFISH_StrIter_Recede(cfish_StringIterator* self, size_t num) {
1242 #ifdef CFP_CFISH
1243 return CFISH_StrIter_Recede_IMP(self, num);
1244 #else
1245 const CFISH_StrIter_Recede_t method = (CFISH_StrIter_Recede_t)cfish_obj_method(self, CFISH_StrIter_Recede_OFFSET);
1246 return method(self, num);
1247 #endif
1248 }
1249  
1250 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Skip_Whitespace_OFFSET;
1251 static CFISH_INLINE size_t
1252 CFISH_StrIter_Skip_Whitespace(cfish_StringIterator* self) {
1253 #ifdef CFP_CFISH
1254 return CFISH_StrIter_Skip_Whitespace_IMP(self);
1255 #else
1256 const CFISH_StrIter_Skip_Whitespace_t method = (CFISH_StrIter_Skip_Whitespace_t)cfish_obj_method(self, CFISH_StrIter_Skip_Whitespace_OFFSET);
1257 return method(self);
1258 #endif
1259 }
1260  
1261 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Skip_Whitespace_Back_OFFSET;
1262 static CFISH_INLINE size_t
1263 CFISH_StrIter_Skip_Whitespace_Back(cfish_StringIterator* self) {
1264 #ifdef CFP_CFISH
1265 return CFISH_StrIter_Skip_Whitespace_Back_IMP(self);
1266 #else
1267 const CFISH_StrIter_Skip_Whitespace_Back_t method = (CFISH_StrIter_Skip_Whitespace_Back_t)cfish_obj_method(self, CFISH_StrIter_Skip_Whitespace_Back_OFFSET);
1268 return method(self);
1269 #endif
1270 }
1271  
1272 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Starts_With_OFFSET;
1273 static CFISH_INLINE bool
1274 CFISH_StrIter_Starts_With(cfish_StringIterator* self, cfish_String* prefix) {
1275 #ifdef CFP_CFISH
1276 return CFISH_StrIter_Starts_With_IMP(self, prefix);
1277 #else
1278 const CFISH_StrIter_Starts_With_t method = (CFISH_StrIter_Starts_With_t)cfish_obj_method(self, CFISH_StrIter_Starts_With_OFFSET);
1279 return method(self, prefix);
1280 #endif
1281 }
1282  
1283 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Starts_With_Utf8_OFFSET;
1284 static CFISH_INLINE bool
1285 CFISH_StrIter_Starts_With_Utf8(cfish_StringIterator* self, const char* utf8, size_t size) {
1286 #ifdef CFP_CFISH
1287 return CFISH_StrIter_Starts_With_Utf8_IMP(self, utf8, size);
1288 #else
1289 const CFISH_StrIter_Starts_With_Utf8_t method = (CFISH_StrIter_Starts_With_Utf8_t)cfish_obj_method(self, CFISH_StrIter_Starts_With_Utf8_OFFSET);
1290 return method(self, utf8, size);
1291 #endif
1292 }
1293  
1294 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Ends_With_OFFSET;
1295 static CFISH_INLINE bool
1296 CFISH_StrIter_Ends_With(cfish_StringIterator* self, cfish_String* suffix) {
1297 #ifdef CFP_CFISH
1298 return CFISH_StrIter_Ends_With_IMP(self, suffix);
1299 #else
1300 const CFISH_StrIter_Ends_With_t method = (CFISH_StrIter_Ends_With_t)cfish_obj_method(self, CFISH_StrIter_Ends_With_OFFSET);
1301 return method(self, suffix);
1302 #endif
1303 }
1304  
1305 extern CFISH_VISIBLE uint32_t CFISH_StrIter_Ends_With_Utf8_OFFSET;
1306 static CFISH_INLINE bool
1307 CFISH_StrIter_Ends_With_Utf8(cfish_StringIterator* self, const char* utf8, size_t size) {
1308 #ifdef CFP_CFISH
1309 return CFISH_StrIter_Ends_With_Utf8_IMP(self, utf8, size);
1310 #else
1311 const CFISH_StrIter_Ends_With_Utf8_t method = (CFISH_StrIter_Ends_With_Utf8_t)cfish_obj_method(self, CFISH_StrIter_Ends_With_Utf8_OFFSET);
1312 return method(self, utf8, size);
1313 #endif
1314 }
1315  
1316  
1317  
1318 /* Declare callbacks for wrapping host overrides.
1319 */
1320  
1321 #ifdef CFISH_NO_DYNAMIC_OVERRIDES
1322 #else
1323 #endif
1324  
1325  
1326 /* Define "short names" for this class's symbols.
1327 */
1328  
1329 #ifdef CFISH_USE_SHORT_NAMES
1330 #define StringIterator cfish_StringIterator
1331 #define STRINGITERATOR CFISH_STRINGITERATOR
1332 #define StrIter_new cfish_StrIter_new
1333 #define StrIter_crop cfish_StrIter_crop
1334 #define StrIter_get_class cfish_StrIter_get_class
1335 #define StrIter_get_class_name cfish_StrIter_get_class_name
1336 #define StrIter_is_a cfish_StrIter_is_a
1337 #define StrIter_Clone_IMP CFISH_StrIter_Clone_IMP
1338 #define StrIter_Assign_IMP CFISH_StrIter_Assign_IMP
1339 #define StrIter_Equals_IMP CFISH_StrIter_Equals_IMP
1340 #define StrIter_Compare_To_IMP CFISH_StrIter_Compare_To_IMP
1341 #define StrIter_Has_Next_IMP CFISH_StrIter_Has_Next_IMP
1342 #define StrIter_Has_Prev_IMP CFISH_StrIter_Has_Prev_IMP
1343 #define StrIter_Next_IMP CFISH_StrIter_Next_IMP
1344 #define StrIter_Prev_IMP CFISH_StrIter_Prev_IMP
1345 #define StrIter_Advance_IMP CFISH_StrIter_Advance_IMP
1346 #define StrIter_Recede_IMP CFISH_StrIter_Recede_IMP
1347 #define StrIter_Skip_Whitespace_IMP CFISH_StrIter_Skip_Whitespace_IMP
1348 #define StrIter_Skip_Whitespace_Back_IMP CFISH_StrIter_Skip_Whitespace_Back_IMP
1349 #define StrIter_Starts_With_IMP CFISH_StrIter_Starts_With_IMP
1350 #define StrIter_Starts_With_Utf8_IMP CFISH_StrIter_Starts_With_Utf8_IMP
1351 #define StrIter_Ends_With_IMP CFISH_StrIter_Ends_With_IMP
1352 #define StrIter_Ends_With_Utf8_IMP CFISH_StrIter_Ends_With_Utf8_IMP
1353 #define StrIter_Destroy_IMP CFISH_StrIter_Destroy_IMP
1354 #define StrIter_To_Host CFISH_StrIter_To_Host
1355 #define StrIter_To_Host_t CFISH_StrIter_To_Host_t
1356 #define StrIter_Clone CFISH_StrIter_Clone
1357 #define StrIter_Clone_t CFISH_StrIter_Clone_t
1358 #define StrIter_Equals CFISH_StrIter_Equals
1359 #define StrIter_Equals_t CFISH_StrIter_Equals_t
1360 #define StrIter_Compare_To CFISH_StrIter_Compare_To
1361 #define StrIter_Compare_To_t CFISH_StrIter_Compare_To_t
1362 #define StrIter_Destroy CFISH_StrIter_Destroy
1363 #define StrIter_Destroy_t CFISH_StrIter_Destroy_t
1364 #define StrIter_To_String CFISH_StrIter_To_String
1365 #define StrIter_To_String_t CFISH_StrIter_To_String_t
1366 #define StrIter_Assign CFISH_StrIter_Assign
1367 #define StrIter_Assign_t CFISH_StrIter_Assign_t
1368 #define StrIter_Has_Next CFISH_StrIter_Has_Next
1369 #define StrIter_Has_Next_t CFISH_StrIter_Has_Next_t
1370 #define StrIter_Has_Prev CFISH_StrIter_Has_Prev
1371 #define StrIter_Has_Prev_t CFISH_StrIter_Has_Prev_t
1372 #define StrIter_Next CFISH_StrIter_Next
1373 #define StrIter_Next_t CFISH_StrIter_Next_t
1374 #define StrIter_Prev CFISH_StrIter_Prev
1375 #define StrIter_Prev_t CFISH_StrIter_Prev_t
1376 #define StrIter_Advance CFISH_StrIter_Advance
1377 #define StrIter_Advance_t CFISH_StrIter_Advance_t
1378 #define StrIter_Recede CFISH_StrIter_Recede
1379 #define StrIter_Recede_t CFISH_StrIter_Recede_t
1380 #define StrIter_Skip_Whitespace CFISH_StrIter_Skip_Whitespace
1381 #define StrIter_Skip_Whitespace_t CFISH_StrIter_Skip_Whitespace_t
1382 #define StrIter_Skip_Whitespace_Back CFISH_StrIter_Skip_Whitespace_Back
1383 #define StrIter_Skip_Whitespace_Back_t CFISH_StrIter_Skip_Whitespace_Back_t
1384 #define StrIter_Starts_With CFISH_StrIter_Starts_With
1385 #define StrIter_Starts_With_t CFISH_StrIter_Starts_With_t
1386 #define StrIter_Starts_With_Utf8 CFISH_StrIter_Starts_With_Utf8
1387 #define StrIter_Starts_With_Utf8_t CFISH_StrIter_Starts_With_Utf8_t
1388 #define StrIter_Ends_With CFISH_StrIter_Ends_With
1389 #define StrIter_Ends_With_t CFISH_StrIter_Ends_With_t
1390 #define StrIter_Ends_With_Utf8 CFISH_StrIter_Ends_With_Utf8
1391 #define StrIter_Ends_With_Utf8_t CFISH_StrIter_Ends_With_Utf8_t
1392 #endif /* CFISH_USE_SHORT_NAMES */
1393  
1394  
1395  
1396 #define CFISH_VALIDATE_UTF8(text, size) \
1397 cfish_Str_validate_utf8(text, size, \
1398 __FILE__, __LINE__, CFISH_ERR_FUNC_MACRO)
1399  
1400 #define CFISH_SSTR_BLANK() \
1401 cfish_Str_init_stack_string(CFISH_ALLOCA_OBJ(CFISH_STRING), "", 0)
1402  
1403 #define CFISH_SSTR_WRAP_C(ptr) \
1404 cfish_Str_init_stack_string(CFISH_ALLOCA_OBJ(CFISH_STRING), ptr, \
1405 strlen(ptr))
1406  
1407 #define CFISH_SSTR_WRAP_UTF8(ptr, size) \
1408 cfish_Str_init_stack_string(CFISH_ALLOCA_OBJ(CFISH_STRING), ptr, size)
1409  
1410 #define CFISH_STR_OOB -1
1411  
1412 #ifdef CFISH_USE_SHORT_NAMES
1413 #define VALIDATE_UTF8 CFISH_VALIDATE_UTF8
1414 #define SSTR_BLANK CFISH_SSTR_BLANK
1415 #define SSTR_WRAP_C CFISH_SSTR_WRAP_C
1416 #define SSTR_WRAP_UTF8 CFISH_SSTR_WRAP_UTF8
1417 #define STR_OOB CFISH_STR_OOB
1418 #endif
1419  
1420  
1421  
1422 #ifdef __cplusplus
1423 }
1424 #endif
1425  
1426 #endif /* H_CLOWNFISH_STRING */
1427  
1428  
1429  
1430  
« lib/Clownfish/Test.xs ↑ Summary autogen/include/cfish_parcel.h »