1 #ifndef EOLIAN_H
2 #define EOLIAN_H
3
4 #ifdef EAPI
5 # undef EAPI
6 #endif
7
8 #ifdef _WIN32
9 # ifdef EFL_BUILD
10 # ifdef DLL_EXPORT
11 # define EAPI __declspec(dllexport)
12 # else
13 # define EAPI
14 # endif
15 # else
16 # define EAPI __declspec(dllimport)
17 # endif
18 #else
19 # ifdef __GNUC__
20 # if __GNUC__ >= 4
21 # define EAPI __attribute__ ((visibility("default")))
22 # else
23 # define EAPI
24 # endif
25 # else
26 # define EAPI
27 # endif
28 #endif
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #include <Eina.h>
35
36 /**
37 * @page eolian_main Eolian
38 *
39 * @date 2014 (created)
40 *
41 * @section eolian_toc Table of Contents
42 *
43 * @li @ref eolian_main_intro
44 * @li @ref eolian_main_compiling
45 * @li @ref eolian_main_next_steps
46 *
47 * @section eolian_main_intro Introduction
48 *
49 * The Eolian EO file parser and code generator.
50
51 * @section eolian_main_compiling How to compile
52 *
53 * Eolian is a library your application links to. The procedure for this is
54 * very simple. You simply have to compile your application with the
55 * appropriate compiler flags that the @c pkg-config script outputs. For
56 * example:
57 *
58 * Compiling C or C++ files into object files:
59 *
60 * @verbatim
61 gcc -c -o main.o main.c `pkg-config --cflags eolian`
62 @endverbatim
63 *
64 * Linking object files into a binary executable:
65 *
66 * @verbatim
67 gcc -o my_application main.o `pkg-config --libs eolian`
68 @endverbatim
69 *
70 * See @ref pkgconfig
71 *
72 * @section eolian_main_next_steps Next Steps
73 *
74 * After you understood what Eolian is and installed it in your system
75 * you should proceed understanding the programming interface.
76 *
77 * Recommended reading:
78 *
79 * @li @ref Eolian
80 *
81 * @addtogroup Eolian
82 * @{
83 */
84
85 /* The maximum format version supported by this version of Eolian */
86 #define EOLIAN_FILE_FORMAT_VERSION 1
87
88 /* State information
89 *
90 * Possible to cast to Eolian_Unit and use as such, as this represents
91 * a master unit as well as other state.
92 *
93 * @ingroup Eolian
94 */
95 typedef struct _Eolian_State Eolian_State;
96
97 /* Any Eolian object
98 *
99 * @see Eolian_Object_Type
100 *
101 * @ingroup Eolian
102 */
103 typedef struct _Eolian_Object Eolian_Object;
104
105 /* Class type used to extract information on classes
106 *
107 * @ingroup Eolian
108 */
109 typedef struct _Eolian_Class Eolian_Class;
110
111 /* Function Id used to extract information on class functions
112 *
113 * @ingroup Eolian
114 */
115 typedef struct _Eolian_Function Eolian_Function;
116
117 /* Part information
118 *
119 * @ingroup Eolian
120 */
121 typedef struct _Eolian_Part Eolian_Part;
122
123 /* Parameter/return type.
124 *
125 * @ingroup Eolian
126 */
127 typedef struct _Eolian_Type Eolian_Type;
128
129 /* Type declaration.
130 *
131 * @ingroup Eolian
132 */
133 typedef struct _Eolian_Typedecl Eolian_Typedecl;
134
135 /* Class function parameter information
136 *
137 * @ingroup Eolian
138 */
139 typedef struct _Eolian_Function_Parameter Eolian_Function_Parameter;
140
141 /* Class implement information
142 *
143 * @ingroup Eolian
144 */
145 typedef struct _Eolian_Implement Eolian_Implement;
146
147 /* Class constructor information
148 *
149 * @ingroup Eolian
150 */
151 typedef struct _Eolian_Constructor Eolian_Constructor;
152
153 /* Event information
154 *
155 * @ingroup Eolian
156 */
157 typedef struct _Eolian_Event Eolian_Event;
158
159 /* Expression information
160 *
161 * @ingroup Eolian
162 */
163 typedef struct _Eolian_Expression Eolian_Expression;
164
165 /* Constant information
166 *
167 * @ingroup Eolian
168 */
169 typedef struct _Eolian_Constant Eolian_Constant;
170
171 /* Error information
172 *
173 * @ingroup Eolian
174 */
175 typedef struct _Eolian_Error Eolian_Error;
176
177 /* Struct field information
178 *
179 * @ingroup Eolian
180 */
181 typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field;
182
183 /* Enum field information
184 *
185 * @ingroup Eolian
186 */
187 typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field;
188
189 /* Documentation information
190 *
191 * @ingroup Eolian
192 */
193 typedef struct _Eolian_Documentation Eolian_Documentation;
194
195 /* Unit information
196 *
197 * @ingroup Eolian
198 */
199 typedef struct _Eolian_Unit Eolian_Unit;
200
201 #ifdef __cplusplus
202 #define EOLIAN_CAST(type, expr) reinterpret_cast<const type *>(expr)
203 #else
204 #define EOLIAN_CAST(type, expr) ((const type *)expr)
205 #endif
206
207 #define EOLIAN_OBJECT(expr) EOLIAN_CAST(Eolian_Object, expr)
208 #define EOLIAN_UNIT(expr) EOLIAN_CAST(Eolian_Unit, expr)
209
210 typedef void (*Eolian_Panic_Cb)(const Eolian_State *state, Eina_Stringshare *msg);
211 typedef void (*Eolian_Error_Cb)(const Eolian_Object *obj, const char *msg, void *data);
212
213 typedef enum
214 {
215 EOLIAN_OBJECT_UNKNOWN = 0,
216 EOLIAN_OBJECT_CLASS,
217 EOLIAN_OBJECT_TYPEDECL,
218 EOLIAN_OBJECT_STRUCT_FIELD,
219 EOLIAN_OBJECT_ENUM_FIELD,
220 EOLIAN_OBJECT_TYPE,
221 EOLIAN_OBJECT_CONSTANT,
222 EOLIAN_OBJECT_EXPRESSION,
223 EOLIAN_OBJECT_FUNCTION,
224 EOLIAN_OBJECT_FUNCTION_PARAMETER,
225 EOLIAN_OBJECT_EVENT,
226 EOLIAN_OBJECT_PART,
227 EOLIAN_OBJECT_IMPLEMENT,
228 EOLIAN_OBJECT_CONSTRUCTOR,
229 EOLIAN_OBJECT_DOCUMENTATION,
230 EOLIAN_OBJECT_ERROR
231 } Eolian_Object_Type;
232
233 typedef enum
234 {
235 EOLIAN_UNRESOLVED = 0,
236 EOLIAN_PROPERTY,
237 EOLIAN_PROP_SET,
238 EOLIAN_PROP_GET,
239 EOLIAN_METHOD,
240 EOLIAN_FUNCTION_POINTER
241 } Eolian_Function_Type;
242
243 typedef enum
244 {
245 EOLIAN_PARAMETER_UNKNOWN = 0,
246 EOLIAN_PARAMETER_IN,
247 EOLIAN_PARAMETER_OUT,
248 EOLIAN_PARAMETER_INOUT
249 } Eolian_Parameter_Direction;
250
251 typedef enum
252 {
253 EOLIAN_CLASS_UNKNOWN_TYPE = 0,
254 EOLIAN_CLASS_REGULAR,
255 EOLIAN_CLASS_ABSTRACT,
256 EOLIAN_CLASS_MIXIN,
257 EOLIAN_CLASS_INTERFACE
258 } Eolian_Class_Type;
259
260 typedef enum
261 {
262 EOLIAN_SCOPE_UNKNOWN = 0,
263 EOLIAN_SCOPE_PUBLIC,
264 EOLIAN_SCOPE_PRIVATE,
265 EOLIAN_SCOPE_PROTECTED
266 } Eolian_Object_Scope;
267
268 typedef enum
269 {
270 EOLIAN_TYPEDECL_UNKNOWN = 0,
271 EOLIAN_TYPEDECL_STRUCT,
272 EOLIAN_TYPEDECL_STRUCT_OPAQUE,
273 EOLIAN_TYPEDECL_ENUM,
274 EOLIAN_TYPEDECL_ALIAS,
275 EOLIAN_TYPEDECL_FUNCTION_POINTER
276 } Eolian_Typedecl_Type;
277
278 typedef enum
279 {
280 EOLIAN_TYPE_UNKNOWN_TYPE = 0,
281 EOLIAN_TYPE_VOID,
282 EOLIAN_TYPE_REGULAR,
283 EOLIAN_TYPE_CLASS,
284 EOLIAN_TYPE_ERROR,
285 #ifdef EFL_BETA_API_SUPPORT
286 EOLIAN_TYPE_UNDEFINED
287 #endif
288 } Eolian_Type_Type;
289
290 typedef enum
291 {
292 EOLIAN_TYPE_BUILTIN_INVALID = 0,
293
294 EOLIAN_TYPE_BUILTIN_BYTE,
295 EOLIAN_TYPE_BUILTIN_UBYTE,
296 EOLIAN_TYPE_BUILTIN_CHAR,
297 EOLIAN_TYPE_BUILTIN_SHORT,
298 EOLIAN_TYPE_BUILTIN_USHORT,
299 EOLIAN_TYPE_BUILTIN_INT,
300 EOLIAN_TYPE_BUILTIN_UINT,
301 EOLIAN_TYPE_BUILTIN_LONG,
302 EOLIAN_TYPE_BUILTIN_ULONG,
303 EOLIAN_TYPE_BUILTIN_LLONG,
304 EOLIAN_TYPE_BUILTIN_ULLONG,
305
306 EOLIAN_TYPE_BUILTIN_INT8,
307 EOLIAN_TYPE_BUILTIN_UINT8,
308 EOLIAN_TYPE_BUILTIN_INT16,
309 EOLIAN_TYPE_BUILTIN_UINT16,
310 EOLIAN_TYPE_BUILTIN_INT32,
311 EOLIAN_TYPE_BUILTIN_UINT32,
312 EOLIAN_TYPE_BUILTIN_INT64,
313 EOLIAN_TYPE_BUILTIN_UINT64,
314 EOLIAN_TYPE_BUILTIN_INT128,
315 EOLIAN_TYPE_BUILTIN_UINT128,
316
317 EOLIAN_TYPE_BUILTIN_SIZE,
318 EOLIAN_TYPE_BUILTIN_SSIZE,
319 EOLIAN_TYPE_BUILTIN_INTPTR,
320 EOLIAN_TYPE_BUILTIN_UINTPTR,
321 EOLIAN_TYPE_BUILTIN_PTRDIFF,
322
323 EOLIAN_TYPE_BUILTIN_TIME,
324
325 EOLIAN_TYPE_BUILTIN_FLOAT,
326 EOLIAN_TYPE_BUILTIN_DOUBLE,
327
328 EOLIAN_TYPE_BUILTIN_BOOL,
329
330 EOLIAN_TYPE_BUILTIN_SLICE,
331 EOLIAN_TYPE_BUILTIN_RW_SLICE,
332
333 EOLIAN_TYPE_BUILTIN_VOID,
334
335 EOLIAN_TYPE_BUILTIN_ACCESSOR,
336 EOLIAN_TYPE_BUILTIN_ARRAY,
337 EOLIAN_TYPE_BUILTIN_FUTURE,
338 EOLIAN_TYPE_BUILTIN_ITERATOR,
339 #ifdef EFL_BETA_API_SUPPORT
340 EOLIAN_TYPE_BUILTIN_LIST,
341 #else
342 // Placeholder when using release API only. Done to prevent offsetting the value below.
343 EOLIAN_TYPE_BUILTIN_BETA_PLACEHOLDER1,
344 #endif
345
346 EOLIAN_TYPE_BUILTIN_ANY_VALUE,
347 EOLIAN_TYPE_BUILTIN_ANY_VALUE_REF,
348 EOLIAN_TYPE_BUILTIN_BINBUF,
349 EOLIAN_TYPE_BUILTIN_EVENT,
350 EOLIAN_TYPE_BUILTIN_MSTRING,
351 EOLIAN_TYPE_BUILTIN_STRING,
352 EOLIAN_TYPE_BUILTIN_STRINGSHARE,
353 EOLIAN_TYPE_BUILTIN_STRBUF,
354
355 #ifdef EFL_BETA_API_SUPPORT
356 EOLIAN_TYPE_BUILTIN_HASH,
357 EOLIAN_TYPE_BUILTIN_VOID_PTR
358 #endif
359 } Eolian_Type_Builtin_Type;
360
361 typedef enum
362 {
363 EOLIAN_EXPR_UNKNOWN = 0,
364 EOLIAN_EXPR_INT,
365 EOLIAN_EXPR_UINT,
366 EOLIAN_EXPR_LONG,
367 EOLIAN_EXPR_ULONG,
368 EOLIAN_EXPR_LLONG,
369 EOLIAN_EXPR_ULLONG,
370 EOLIAN_EXPR_FLOAT,
371 EOLIAN_EXPR_DOUBLE,
372 EOLIAN_EXPR_STRING,
373 EOLIAN_EXPR_CHAR,
374 EOLIAN_EXPR_NULL,
375 EOLIAN_EXPR_BOOL,
376 EOLIAN_EXPR_NAME,
377 EOLIAN_EXPR_UNARY,
378 EOLIAN_EXPR_BINARY
379 } Eolian_Expression_Type;
380
381 typedef enum
382 {
383 EOLIAN_MASK_SINT = 1 << 0,
384 EOLIAN_MASK_UINT = 1 << 1,
385 EOLIAN_MASK_INT = EOLIAN_MASK_SINT | EOLIAN_MASK_UINT,
386 EOLIAN_MASK_FLOAT = 1 << 2,
387 EOLIAN_MASK_BOOL = 1 << 3,
388 EOLIAN_MASK_STRING = 1 << 4,
389 EOLIAN_MASK_CHAR = 1 << 5,
390 EOLIAN_MASK_NULL = 1 << 6,
391 EOLIAN_MASK_SIGNED = EOLIAN_MASK_SINT | EOLIAN_MASK_FLOAT,
392 EOLIAN_MASK_NUMBER = EOLIAN_MASK_INT | EOLIAN_MASK_FLOAT,
393 EOLIAN_MASK_ALL = EOLIAN_MASK_NUMBER | EOLIAN_MASK_BOOL
394 | EOLIAN_MASK_STRING | EOLIAN_MASK_CHAR
395 | EOLIAN_MASK_NULL
396 } Eolian_Expression_Mask;
397
398 typedef union
399 {
400 char c;
401 Eina_Bool b;
402 const char *s;
403 signed int i;
404 unsigned int u;
405 signed long l;
406 unsigned long ul;
407 signed long long ll;
408 unsigned long long ull;
409 float f;
410 double d;
411 } Eolian_Value_Union;
412
413 typedef struct _Eolian_Value
414 {
415 Eolian_Expression_Type type;
416 Eolian_Value_Union value;
417 } Eolian_Value;
418
419 typedef enum
420 {
421 EOLIAN_BINOP_INVALID = 0,
422
423 EOLIAN_BINOP_ADD, /* + int, float */
424 EOLIAN_BINOP_SUB, /* - int, float */
425 EOLIAN_BINOP_MUL, /* * int, float */
426 EOLIAN_BINOP_DIV, /* / int, float */
427 EOLIAN_BINOP_MOD, /* % int */
428
429 EOLIAN_BINOP_EQ, /* == all types */
430 EOLIAN_BINOP_NQ, /* != all types */
431 EOLIAN_BINOP_GT, /* > int, float */
432 EOLIAN_BINOP_LT, /* < int, float */
433 EOLIAN_BINOP_GE, /* >= int, float */
434 EOLIAN_BINOP_LE, /* <= int, float */
435
436 EOLIAN_BINOP_AND, /* && all types */
437 EOLIAN_BINOP_OR, /* || all types */
438
439 EOLIAN_BINOP_BAND, /* & int */
440 EOLIAN_BINOP_BOR, /* | int */
441 EOLIAN_BINOP_BXOR, /* ^ int */
442 EOLIAN_BINOP_LSH, /* << int */
443 EOLIAN_BINOP_RSH /* >> int */
444 } Eolian_Binary_Operator;
445
446 typedef enum
447 {
448 EOLIAN_UNOP_INVALID = 0,
449
450 EOLIAN_UNOP_UNM, /* - sint */
451 EOLIAN_UNOP_UNP, /* + sint */
452
453 EOLIAN_UNOP_NOT, /* ! int, float, bool */
454 EOLIAN_UNOP_BNOT, /* ~ int */
455 } Eolian_Unary_Operator;
456
457 typedef enum
458 {
459 EOLIAN_DOC_TOKEN_UNKNOWN = 0,
460 EOLIAN_DOC_TOKEN_TEXT,
461 EOLIAN_DOC_TOKEN_REF,
462 EOLIAN_DOC_TOKEN_MARK_NOTE,
463 EOLIAN_DOC_TOKEN_MARK_WARNING,
464 EOLIAN_DOC_TOKEN_MARK_REMARK,
465 EOLIAN_DOC_TOKEN_MARK_TODO,
466 EOLIAN_DOC_TOKEN_MARKUP_MONOSPACE
467 } Eolian_Doc_Token_Type;
468
469 typedef struct _Eolian_Doc_Token
470 {
471 Eolian_Doc_Token_Type type;
472 const char *text, *text_end;
473 } Eolian_Doc_Token;
474
475 /*
476 * @brief Init Eolian.
477 *
478 * @ingroup Eolian
479 */
480 EAPI int eolian_init(void);
481
482 /*
483 * @brief Shutdown Eolian.
484 *
485 * @ingroup Eolian
486 */
487 EAPI int eolian_shutdown(void);
488
489 /*
490 * @brief Get the Eolian file format version.
491 *
492 * This is the same as the #EOLIAN_FILE_FORMAT_VERSION macro, but allows
493 * retrieval of the version at runtime, so it can be used by FFI based
494 * bindings in dynamic languages to do runtime checks and so on.
495 */
496 EAPI unsigned short eolian_file_format_version_get(void);
497
498 /*
499 * @brief Create a new Eolian state.
500 *
501 * This creates a new Eolian state that consists of a "master unit" with
502 * the same address (therefore, you can cast it to Eolian_Unit) plus extra
503 * state information.
504 *
505 * You need to free this with eolian_free once you're done.
506 *
507 * This will assign a default panic function, which printers the error
508 * message passed to it into the standard Eolian log.
509 *
510 * @see eolian_state_panic_cb_set
511 *
512 * @return A new state (or NULL on failure).
513 *
514 * @ingroup Eolian
515 */
516 EAPI Eolian_State *eolian_state_new(void);
517
518 /*
519 * @brief Free an Eolian state.
520 *
521 * You can use this to free an Eolian state.
522 *
523 * If the input is NULL, this function has no effect.
524 *
525 * @param[in] state the state to free
526 *
527 */
528 EAPI void eolian_state_free(Eolian_State *state);
529
530 /*
531 * @brief Set the panic function for the state.
532 *
533 * When an unrecoverable error happens in an Eolian API call, the panic
534 * function is called. The default panic function for a state just prints
535 * the error message into the standard Eolian log. After the panic function
536 * is called, Eolian forcibly exits (`exit(EXIT_FAILURE)`). If you don't
537 * want this, you can override the panic function and never return from
538 * it (by doing a long jump, or throwing an exception in C++).
539 *
540 * Unrecoverable errors include cases such as internal errors and memory
541 * allocation failures. Standard parse errors etc. are not considered
542 * unrecoverable, so they are not handled using the panic mechanism.
543 *
544 * After a panic, the Eolian state is left valid; the library does its
545 * best at trying to provide it back to you in the same condition as it
546 * was before the failing call.
547 *
548 * If you set a panic function and jump, you're responsible for the error
549 * message and have to delete it with eina_stringshare_del.
550 *
551 * If you want to catch error messages that are standard (such as parse
552 * errors), there is another, separate mechanism in place.
553 *
554 * @return The old panic callback.
555 *
556 * @see eolian_state_error_cb_set
557 */
558 EAPI Eolian_Panic_Cb eolian_state_panic_cb_set(Eolian_State *state, Eolian_Panic_Cb cb);
559
560 /*
561 * @brief Set the error function for the state.
562 *
563 * When a regular error (such as parse error) happens, you can use this
564 * callback to catch the error. There is no jump involved and the outer
565 * function will fail normally and safely. You are provided with the
566 * object the error happened on (for line/column/file/other information)
567 * as well as the error message. Additionally, a data pointer is passed
568 * in so you can pass some of the information into local memory somewhere.
569 *
570 * @return The old error callback.
571 *
572 * @see eolian_state_panic_cb_set
573 * @see eolian_state_error_data_set
574 */
575 EAPI Eolian_Error_Cb eolian_state_error_cb_set(Eolian_State *state, Eolian_Error_Cb cb);
576
577 /*
578 * @brief Set a data pointer to be passed to the error function.
579 *
580 * By default, the data is `NULL`. You can use this to set a data pointer
581 * to be passed. This is useful to e.g. expose some local memory so you can
582 * write back from the callback without using globals.
583 *
584 * @return The old data pointer.
585 *
586 * @see eolian_state_error_cb_set
587 */
588 EAPI void *eolian_state_error_data_set(Eolian_State *state, void *data);
589
590 /*
591 * @brief Get the type of an Eolian object.
592 *
593 * Most handles returned by Eolian somewhere are Eolian_Objects. You can cast
594 * them to Eolian_Object, store or manipulate them and then use this function
595 * to check their type in order to for example cast it back.
596 *
597 * @see eolian_object_unit_get
598 * @see eolian_object_file_get
599 * @see eolian_object_line_get
600 * @see eolian_object_column_get
601 * @see eolian_object_name_get
602 * @see eolian_object_c_name_get
603 *
604 * @ingroup Eolian
605 */
606 EAPI Eolian_Object_Type eolian_object_type_get(const Eolian_Object *obj);
607
608 /*
609 * @brief Get the unit the object comes from.
610 *
611 * This returns the unit the object is located in.
612 *
613 * @see eolian_object_file_get
614 * @see eolian_object_type_get
615 * @see eolian_object_line_get
616 * @see eolian_object_column_get
617 * @see eolian_object_name_get
618 * @see eolian_object_c_name_get
619 *
620 * @ingroup Eolian
621 */
622 EAPI const Eolian_Unit *eolian_object_unit_get(const Eolian_Object *obj);
623
624 /*
625 * @brief Get the name of the file the object comes from.
626 *
627 * This returns the name of the file the object was declared in. It's not
628 * a full path, just the file name.
629 *
630 * @see eolian_object_unit_get
631 * @see eolian_object_type_get
632 * @see eolian_object_line_get
633 * @see eolian_object_column_get
634 * @see eolian_object_name_get
635 * @see eolian_object_c_name_get
636 *
637 * @ingroup Eolian
638 */
639 EAPI const char *eolian_object_file_get(const Eolian_Object *obj);
640
641 /*
642 * @brief Get the line the object was declared at.
643 *
644 * This returns the line number in the file the object was declared at.
645 *
646 * @see eolian_object_unit_get
647 * @see eolian_object_type_get
648 * @see eolian_object_file_get
649 * @see eolian_object_column_get
650 * @see eolian_object_name_get
651 * @see eolian_object_c_name_get
652 *
653 * @ingroup Eolian
654 */
655 EAPI int eolian_object_line_get(const Eolian_Object *obj);
656
657 /*
658 * @brief Get the column the object was declared at.
659 *
660 * This returns the column number in the file the object was declared at,
661 * that means which character on the line. It is Unicode-aware, Eolian
662 * assumes all input files are encoded in UTF-8, so this is really the
663 * code point number, not the byte number.
664 *
665 * @see eolian_object_unit_get
666 * @see eolian_object_type_get
667 * @see eolian_object_file_get
668 * @see eolian_object_line_get
669 * @see eolian_object_name_get
670 * @see eolian_object_c_name_get
671 *
672 * @ingroup Eolian
673 */
674 EAPI int eolian_object_column_get(const Eolian_Object *obj);
675
676 /*
677 * @brief Get the name of an object.
678 *
679 * This name is the full name of the object, if named at all.
680 * For toplevel file declarations, this will be the fully namespaced
681 * name, for things like params this will be just the name itself.
682 *
683 * @see eolian_object_unit_get
684 * @see eolian_object_type_get
685 * @see eolian_object_file_get
686 * @see eolian_object_line_get
687 * @see eolian_object_column_get
688 * @see eolian_object_short_name_get
689 * @see eolian_object_namespaces_get
690 * @see eolian_object_c_name_get
691 *
692 * @ingroup Eolian
693 */
694 EAPI const char *eolian_object_name_get(const Eolian_Object *obj);
695
696 /*
697 * @brief Get the C name of an object.
698 *
699 * This is the full name, but for C. It is typically derived from the
700 * regular full name, with namespaces flattened to underscores, but
701 * some things may be explicitly renamed. Only classes, types (both
702 * declarations and instances) and constants have C names, as others
703 * are never referred to by name directly in C.
704 *
705 * @see eolian_object_unit_get
706 * @see eolian_object_type_get
707 * @see eolian_object_file_get
708 * @see eolian_object_line_get
709 * @see eolian_object_column_get
710 * @see eolian_object_short_name_get
711 * @see eolian_object_namespaces_get
712 * @see eolian_object_name_get
713 *
714 * @ingroup Eolian
715 */
716 EAPI const char *eolian_object_c_name_get(const Eolian_Object *obj);
717
718 /*
719 * @brief Get the short name of an object.
720 *
721 * This means a name without namespaces. If the object's name is not
722 * namespaced in the first place, this is equivalent to getting the full name.
723 * So for `Foo.Bar.baz` this is `baz`, for `foo` it's again just `foo`.
724 *
725 * @see eolian_object_name_get
726 * @see eolian_object_namespaces_get
727 *
728 * @ingroup Eolian
729 */
730 EAPI const char *eolian_object_short_name_get(const Eolian_Object *obj);
731
732 /*
733 * @brief Get a list of namespaces for the object.
734 *
735 * Each item of the iterator is the next more inner namespace. So for
736 * example if the full name is `Foo.Bar.baz`, the iterator will first
737 * give you `Foo` and then `Bar`.
738 *
739 * @see eolian_object_name_get
740 * @see eolian_object_short_name_get
741 *
742 * @ingroup Eolian
743 */
744 EAPI Eina_Iterator *eolian_object_namespaces_get(const Eolian_Object *obj);
745
746 /*
747 * @brief Get whether an object is beta.
748 *
749 * This applies to toplevel objects (classes, types) as well as some
750 * others such as functions and events.
751 *
752 * @param[in] obj The object.
753 * @return EINA_TRUE and EINA_FALSE respectively
754 *
755 * @ingroup Eolian
756 */
757 EAPI Eina_Bool eolian_object_is_beta(const Eolian_Object *obj);
758
759 /*
760 * @brief Scan the given directory for .eo and .eot files.
761 *
762 * You need to add every directory you plan to use .eo/.eot files from.
763 * The directory is scanned recursively, so all of its sub-directories
764 * are also added.
765 *
766 * @param[in] state The Eolian state.
767 * @param[in] dir the directory to scan
768 * @return EINA_TRUE on success, EINA_FALSE otherwise.
769 *
770 * @see eolian_state_system_directory_add
771 *
772 * @ingroup Eolian
773 */
774 EAPI Eina_Bool eolian_state_directory_add(Eolian_State *state, const char *dir);
775
776 /*
777 * @brief Scan the system directory for .eo and .eot files.
778 *
779 * This is just like eolian_state_directory_add, except it uses the system
780 * directory. The system directory is determined from the prefix of the
781 * Eolian library. Typically it tends to be $PREFIX/share/eolian.
782 *
783 * @param[in] state The Eolian state.
784 *
785 * @return EINA_TRUE on success, EINA_FALSE otherwise.
786 *
787 * @see eolian_state_directory_add
788 *
789 * @ingroup Eolian
790 */
791 EAPI Eina_Bool eolian_state_system_directory_add(Eolian_State *state);
792
793 /*
794 * @brief Get an iterator to all .eo file names with paths.
795 *
796 * @param[in] state The Eolian state.
797 *
798 * @see eolian_state_eo_files_get
799 * @see eolian_state_eot_file_paths_get
800 * @see eolian_state_eot_files_get
801 *
802 * @ingroup Eolian
803 */
804 EAPI Eina_Iterator *eolian_state_eo_file_paths_get(const Eolian_State *state);
805
806 /*
807 * @brief Get an iterator to all .eot file names with paths.
808 *
809 * @param[in] state The Eolian state.
810 *
811 * @see eolian_state_eo_files_get
812 * @see eolian_state_eo_file_paths_get
813 * @see eolian_state_eot_files_get
814 *
815 * @ingroup Eolian
816 */
817 EAPI Eina_Iterator *eolian_state_eot_file_paths_get(const Eolian_State *state);
818
819 /*
820 * @brief Get an iterator to all .eo file names (without paths).
821 *
822 * @param[in] state The Eolian state.
823 *
824 * @see eolian_state_eo_file_paths_get
825 * @see eolian_state_eot_file_paths_get
826 * @see eolian_state_eot_files_get
827 *
828 * @ingroup Eolian
829 */
830 EAPI Eina_Iterator *eolian_state_eo_files_get(const Eolian_State *state);
831
832 /*
833 * @brief Get an iterator to all .eot file names (without paths).
834 *
835 * @param[in] state The Eolian state.
836 *
837 * @see eolian_state_eo_file_paths_get
838 * @see eolian_stete_eot_file_paths_get
839 * @see eolian_state_eo_files_get
840 *
841 * @ingroup Eolian
842 */
843 EAPI Eina_Iterator *eolian_state_eot_files_get(const Eolian_State *state);
844
845 /*
846 * @brief Parse the given .eo or .eot file and fill the database.
847 *
848 * The input must be a file name from a directory that was previously
849 * scanned with eolian_state_directory_add().
850 *
851 * @param[in] state The Eolian state.
852 * @param[in] filename The name of the file to parse.
853 * @return The unit corresponding to the parsed file or NULL.
854 *
855 * @see eolian_state_directory_add
856 * @see eolian_state_file_path_parse
857 *
858 * @ingroup Eolian
859 */
860 EAPI const Eolian_Unit *eolian_state_file_parse(Eolian_State *state, const char *filename);
861
862 /*
863 * @brief Parse the given .eo or .eot file and fill the database.
864 *
865 * The input is a file path. Its directory is scanned first, and then
866 * the file itself is parsed and a unit handle is returned.
867 *
868 * @param[in] state The Eolian state.
869 * @param[in] filepath Path to the file to parse.
870 * @return The unit corresponding to the parsed file or NULL.
871 *
872 * @see eolian_state_directory_add
873 *
874 * @ingroup Eolian
875 */
876 EAPI const Eolian_Unit *eolian_state_file_path_parse(Eolian_State *state, const char *filepath);
877
878 /*
879 * @brief Parse all known eo files.
880 *
881 * @param[in] state The Eolian state.
882 *
883 * @return EINA_TRUE on success, EINA_FALSE otherwise.
884 *
885 * @see eolian_state_directory_add
886 * @see eolian_state_all_eot_files_parse
887 *
888 * @ingroup Eolian
889 */
890 EAPI Eina_Bool eolian_state_all_eo_files_parse(Eolian_State *state);
891
892 /*
893 * @brief Parse all known eot files.
894 *
895 * @param[in] state The Eolian state.
896 *
897 * @return EINA_TRUE on success, EINA_FALSE otherwise.
898 *
899 * @see eolian_state_directory_add
900 * @see eolian_state_all_eo_files_parse
901 *
902 * @ingroup Eolian
903 */
904 EAPI Eina_Bool eolian_state_all_eot_files_parse(Eolian_State *state);
905
906 /*
907 * @brief Perform additional checks on the state.
908 *
909 * This function performs additional checks that aren't crucial for the
910 * database integrity (that's checked as a part of the regular parse process,
911 * so the database is guaranteed to be valid), but are important for proper
912 * correctness. It is recommended that all available .eot and .eo files are
913 * parsed when running this.
914 *
915 * The set of available checks will expand over time.
916 *
917 * @return EINA_TRUE on success, EINA_FALSE otherwise.
918 *
919 * @ingroup Eolian
920 */
921 EAPI Eina_Bool eolian_state_check(const Eolian_State *state);
922
923 /*
924 * @brief Get an Eolian unit by file name.
925 *
926 * For any .eo or .eot file (must be within a directory previously scanned
927 * by eolian_state_directory_add or eolian_state_system_directory_add), get
928 * its corresponding unit.
929 *
930 * This only works if the file has been previously parsed.
931 *
932 * @param[in] state The Eolian state.
933 * @param[in] file The file name.
934 *
935 * @see eolian_state_units_get
936 *
937 * @ingroup Eolian
938 */
939 EAPI const Eolian_Unit *eolian_state_unit_by_file_get(const Eolian_State *state, const char *file_name);
940
941 /*
942 * @brief Get an iterator to all Eolian units in a state.
943 *
944 * This means units of all files that have been parsed so far.
945 *
946 * @param[in] state The Eolian state.
947 *
948 * @ingroup Eolian
949 */
950 EAPI Eina_Iterator *eolian_state_units_get(const Eolian_State *state);
951
952 /*
953 * @brief Get the state associated with the unit.
954 *
955 * Technically you can cast away the const to make the state mutable
956 * again, it's the same pointer after all. But this is considered a
957 * bad practice, because you're only supposed to use mutable objects
958 * at the very beginning and then just read.
959 *
960 * @param[in] unit The unit.
961 *
962 * @ingroup Eolian
963 */
964 EAPI const Eolian_State *eolian_unit_state_get(const Eolian_Unit *unit);
965
966 /*
967 * @brief Get the children (dependencies) of a unit.
968 *
969 * The iterator is obviously again to `const Eolian_Unit *`.
970 *
971 * @param[in] unit The unit.
972 *
973 * @ingroup Eolian
974 */
975 EAPI Eina_Iterator *eolian_unit_children_get(const Eolian_Unit *unit);
976
977 /*
978 * @brief Get the file name a unit is associated with.
979 *
980 * This will be `NULL` if not associated with a file (like the master unit
981 * within `Eolian_State`).
982 *
983 * @param[in] unit The unit.
984 *
985 * @see eolian_unit_file_path_get
986 *
987 * @ingroup Eolian
988 */
989 EAPI const char *eolian_unit_file_get(const Eolian_Unit *unit);
990
991 /*
992 * @brief Get the full file path a unit is associated with.
993 *
994 * This will be `NULL` if not associated with a file (like the master unit
995 * within `Eolian_State`).
996 *
997 * @param[in] unit The unit.
998 *
999 * @see eolian_unit_file_get
1000 *
1001 * @ingroup Eolian
1002 */
1003 EAPI const char *eolian_unit_file_path_get(const Eolian_Unit *unit);
1004
1005 /*
1006 * @brief Get the version of the unit.
1007 *
1008 * This is 1 by default, unless overridden. Returns 0 when an invalid
1009 * unit is passed.
1010 *
1011 * @param[in] unit The unit.
1012 *
1013 * @ingroup Eolian
1014 */
1015 EAPI unsigned short eolian_unit_version_get(const Eolian_Unit *unit);
1016
1017 /*
1018 * @brief Get an object in a unit by name.
1019 *
1020 * Only objects declared directly within the file can be retrieved, i.e.
1021 * classes, typedecls and constants.
1022 *
1023 * @param[in] unit The unit.
1024 * @param[in] name The fully namespaced object name.
1025 *
1026 * @ingroup Eolian
1027 */
1028 EAPI const Eolian_Object *eolian_unit_object_by_name_get(const Eolian_Unit *unit, const char *name);
1029
1030 /*
1031 * @brief Get all objects in the unit.
1032 *
1033 * The order is not necessarily the declaration order. Only objects declared
1034 * directly within the file can be retrieved, i.e. classes, typedecls and
1035 * constants.
1036 *
1037 * @param[in] unit The unit.
1038 *
1039 * @ingroup Eolian
1040 */
1041 EAPI Eina_Iterator *eolian_unit_objects_get(const Eolian_Unit *unit);
1042
1043 /*
1044 * @brief Get a class within a unit by name.
1045 *
1046 * @param[in] unit The unit.
1047 * @param[in] class_name The full name of the class.
1048 *
1049 * @ingroup Eolian
1050 */
1051 EAPI const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit, const char *class_name);
1052
1053 /*
1054 * @brief Get an iterator to all the classes stored into a unit.
1055 *
1056 * @param[in] unit The Eolian unit.
1057 *
1058 * @ingroup Eolian
1059 */
1060 EAPI Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit);
1061
1062 /*
1063 * @brief Get a constant in a unit by name.
1064 *
1065 * @param[in] unit The unit.
1066 * @param[in] name the name of the constant
1067 *
1068 * @ingroup Eolian
1069 */
1070 EAPI const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name);
1071
1072 /*
1073 * @brief Get an error declaration in a unit by name.
1074 *
1075 * @param[in] unit The unit.
1076 * @param[in] name the name of the error
1077 *
1078 * @ingroup Eolian
1079 */
1080 EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name);
1081
1082 /*
1083 * @brief Get an iterator to all constants in the Eolian database.
1084 *
1085 * @return the iterator or NULL
1086 *
1087 * Thanks to internal caching, this is an O(1) operation.
1088 *
1089 * @ingroup Eolian
1090 */
1091 EAPI Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit);
1092
1093 /*
1094 * @brief Get an iterator to all error declarations in the Eolian database.
1095 *
1096 * @return the iterator or NULL
1097 *
1098 * Thanks to internal caching, this is an O(1) operation.
1099 *
1100 * @ingroup Eolian
1101 */
1102 EAPI Eina_Iterator *eolian_unit_errors_get(const Eolian_Unit *unit);
1103
1104 /*
1105 * @brief Get an alias type declaration within a unit by name.
1106 *
1107 * @param[in] unit The unit.
1108 * @param[in] name The name of the alias.
1109 *
1110 * @ingroup Eolian
1111 */
1112 EAPI const Eolian_Typedecl *eolian_unit_alias_by_name_get(const Eolian_Unit *unit, const char *name);
1113
1114 /*
1115 * @brief Get a struct declaration within a unit by name.
1116 *
1117 * @param[in] unit The unit.
1118 * @param[in] name The name of the alias.
1119 *
1120 * @ingroup Eolian
1121 */
1122 EAPI const Eolian_Typedecl *eolian_unit_struct_by_name_get(const Eolian_Unit *unit, const char *name);
1123
1124 /*
1125 * @brief Get an enum declaration within a unit by name.
1126 *
1127 * @param[in] unit The unit.
1128 * @param[in] name The name of the alias.
1129 *
1130 * @ingroup Eolian
1131 */
1132 EAPI const Eolian_Typedecl *eolian_unit_enum_by_name_get(const Eolian_Unit *unit, const char *name);
1133
1134 /*
1135 * @brief Get an iterator to all aliases in the Eolian database.
1136 *
1137 * @param[in] unit The unit.
1138 *
1139 * Thanks to internal caching, this is an O(1) operation.
1140 *
1141 * @ingroup Eolian
1142 */
1143 EAPI Eina_Iterator *eolian_unit_aliases_get(const Eolian_Unit *unit);
1144
1145 /*
1146 * @brief Get an iterator to all structs in the Eolian database.
1147 *
1148 * @param[in] unit The unit.
1149 *
1150 * Thanks to internal caching, this is an O(1) operation.
1151 *
1152 * @ingroup Eolian
1153 */
1154 EAPI Eina_Iterator *eolian_unit_structs_get(const Eolian_Unit *unit);
1155
1156 /*
1157 * @brief Get an iterator to all enums in the Eolian database.
1158 *
1159 * @param[in] unit The unit.
1160 *
1161 * Thanks to internal caching, this is an O(1) operation.
1162 *
1163 * @ingroup Eolian
1164 */
1165 EAPI Eina_Iterator *eolian_unit_enums_get(const Eolian_Unit *unit);
1166
1167 /*
1168 * @brief A helper function to get an object in a state by name.
1169 *
1170 * @see eolian_unit_object_by_name_get
1171 *
1172 * @ingroup Eolian
1173 */
1174 static inline const Eolian_Object *
eolian_state_object_by_name_get(const Eolian_State * state,const char * name)1175 eolian_state_object_by_name_get(const Eolian_State *state, const char *name)
1176 {
1177 return eolian_unit_object_by_name_get(EOLIAN_UNIT(state), name);
1178 }
1179
1180 /*
1181 * @brief Get a list of objects from a file.
1182 *
1183 * The list follows declaration order in the file. Only objects declared
1184 * directly within the file can be retrieved, i.e. classes, typedecls and
1185 * constants.
1186 *
1187 * @param[in] state The state.
1188 * @param[in] file_name The file name.
1189 *
1190 * @ingroup Eolian
1191 */
1192 EAPI Eina_Iterator *eolian_state_objects_by_file_get(const Eolian_State *state, const char *file_name);
1193
1194 /*
1195 * @brief A helper function to get all objects in a state.
1196 *
1197 * @see eolian_unit_objects_get
1198 *
1199 * @ingroup Eolian
1200 */
1201 static inline Eina_Iterator *
eolian_state_objects_get(const Eolian_State * state)1202 eolian_state_objects_get(const Eolian_State *state)
1203 {
1204 return eolian_unit_objects_get(EOLIAN_UNIT(state));
1205 }
1206
1207 /*
1208 * @brief A helper function to get a class in a state by name.
1209 *
1210 * @see eolian_unit_class_by_name_get
1211 *
1212 * @ingroup Eolian
1213 */
1214 static inline const Eolian_Class *
eolian_state_class_by_name_get(const Eolian_State * state,const char * class_name)1215 eolian_state_class_by_name_get(const Eolian_State *state, const char *class_name)
1216 {
1217 return eolian_unit_class_by_name_get(EOLIAN_UNIT(state), class_name);
1218 }
1219
1220 /*
1221 * @brief Get a class within a state by file name (class_name.eo).
1222 *
1223 * @param[in] state The state.
1224 * @param[in] file_name The full name of the class.
1225 *
1226 * @ingroup Eolian
1227 */
1228 EAPI const Eolian_Class *eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name);
1229
1230 /*
1231 * @brief A helper function to get all classes in a state.
1232 *
1233 * @see eolian_unit_classes_get
1234 *
1235 * @ingroup Eolian
1236 */
1237 static inline Eina_Iterator *
eolian_state_classes_get(const Eolian_State * state)1238 eolian_state_classes_get(const Eolian_State *state)
1239 {
1240 return eolian_unit_classes_get(EOLIAN_UNIT(state));
1241 }
1242
1243 /*
1244 * @brief A helper function to get a constant in a state by name.
1245 *
1246 * @see eolian_unit_constant_by_name_get
1247 *
1248 * @ingroup Eolian
1249 */
1250 static inline const Eolian_Constant *
eolian_state_constant_by_name_get(const Eolian_State * state,const char * name)1251 eolian_state_constant_by_name_get(const Eolian_State *state, const char *name)
1252 {
1253 return eolian_unit_constant_by_name_get(EOLIAN_UNIT(state), name);
1254 }
1255
1256 /*
1257 * @brief A helper function to get an error declaration in a state by name.
1258 *
1259 * @see eolian_unit_error_by_name_get
1260 *
1261 * @ingroup Eolian
1262 */
1263 static inline const Eolian_Error *
eolian_state_error_by_name_get(const Eolian_State * state,const char * name)1264 eolian_state_error_by_name_get(const Eolian_State *state, const char *name)
1265 {
1266 return eolian_unit_error_by_name_get(EOLIAN_UNIT(state), name);
1267 }
1268
1269 /*
1270 * @brief Get an iterator to all constants contained in a file.
1271 *
1272 * @param[in] state The state.
1273 * @param[in] file_name The file name.
1274 * @return the iterator or NULL
1275 *
1276 * Thanks to internal caching, this is an O(1) operation.
1277 *
1278 * @ingroup Eolian
1279 */
1280 EAPI Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name);
1281
1282 /*
1283 * @brief Get an iterator to all error declarations contained in a file.
1284 *
1285 * @param[in] state The state.
1286 * @param[in] file_name The file name.
1287 * @return the iterator or NULL
1288 *
1289 * Thanks to internal caching, this is an O(1) operation.
1290 *
1291 * @ingroup Eolian
1292 */
1293 EAPI Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name);
1294
1295 /*
1296 * @brief A helper function to get all constants in a state.
1297 *
1298 * @see eolian_unit_constants_get
1299 *
1300 * @ingroup Eolian
1301 */
1302 static inline Eina_Iterator *
eolian_state_constants_get(const Eolian_State * state)1303 eolian_state_constants_get(const Eolian_State *state)
1304 {
1305 return eolian_unit_constants_get(EOLIAN_UNIT(state));
1306 }
1307
1308 /*
1309 * @brief A helper function to get all error declarations in a state.
1310 *
1311 * @see eolian_unit_errors_get
1312 *
1313 * @ingroup Eolian
1314 */
1315 static inline Eina_Iterator *
eolian_state_errors_get(const Eolian_State * state)1316 eolian_state_errors_get(const Eolian_State *state)
1317 {
1318 return eolian_unit_errors_get(EOLIAN_UNIT(state));
1319 }
1320
1321 /*
1322 * @brief A helper function to get an alias in a state by name.
1323 *
1324 * @see eolian_unit_alias_by_name_get
1325 *
1326 * @ingroup Eolian
1327 */
1328 static inline const Eolian_Typedecl *
eolian_state_alias_by_name_get(const Eolian_State * state,const char * name)1329 eolian_state_alias_by_name_get(const Eolian_State *state, const char *name)
1330 {
1331 return eolian_unit_alias_by_name_get(EOLIAN_UNIT(state), name);
1332 }
1333
1334 /*
1335 * @brief A helper function to get a struct in a state by name.
1336 *
1337 * @see eolian_unit_struct_by_name_get
1338 *
1339 * @ingroup Eolian
1340 */
1341 static inline const Eolian_Typedecl *
eolian_state_struct_by_name_get(const Eolian_State * state,const char * name)1342 eolian_state_struct_by_name_get(const Eolian_State *state, const char *name)
1343 {
1344 return eolian_unit_struct_by_name_get(EOLIAN_UNIT(state), name);
1345 }
1346
1347 /*
1348 * @brief A helper function to get an enum in a state by name.
1349 *
1350 * @see eolian_unit_enum_by_name_get
1351 *
1352 * @ingroup Eolian
1353 */
1354 static inline const Eolian_Typedecl *
eolian_state_enum_by_name_get(const Eolian_State * state,const char * name)1355 eolian_state_enum_by_name_get(const Eolian_State *state, const char *name)
1356 {
1357 return eolian_unit_enum_by_name_get(EOLIAN_UNIT(state), name);
1358 }
1359
1360 /*
1361 * @brief Get an iterator to all aliases contained in a file.
1362 *
1363 * @param[in] state The state.
1364 * @param[in] file_name The file name.
1365 *
1366 * Thanks to internal caching, this is an O(1) operation.
1367 *
1368 * @ingroup Eolian
1369 */
1370 EAPI Eina_Iterator *eolian_state_aliases_by_file_get(const Eolian_State *state, const char *file_name);
1371
1372 /*
1373 * @brief Get an iterator to all named structs contained in a file.
1374 *
1375 * @param[in] state The state.
1376 * @param[in] file_name The file name.
1377 *
1378 * Thanks to internal caching, this is an O(1) operation.
1379 *
1380 * @ingroup Eolian
1381 */
1382 EAPI Eina_Iterator *eolian_state_structs_by_file_get(const Eolian_State *state, const char *file_name);
1383
1384 /*
1385 * @brief Get an iterator to all enums contained in a file.
1386 *
1387 * @param[in] state The state.
1388 * @param[in] file_name The file name.
1389 *
1390 * Thanks to internal caching, this is an O(1) operation.
1391 *
1392 * @ingroup Eolian
1393 */
1394 EAPI Eina_Iterator *eolian_state_enums_by_file_get(const Eolian_State *state, const char *file_name);
1395
1396 /*
1397 * @brief A helper function to get all aliases in a state.
1398 *
1399 * @see eolian_unit_aliases_get
1400 *
1401 * @ingroup Eolian
1402 */
1403 static inline Eina_Iterator *
eolian_state_aliases_get(const Eolian_State * state)1404 eolian_state_aliases_get(const Eolian_State *state)
1405 {
1406 return eolian_unit_aliases_get(EOLIAN_UNIT(state));
1407 }
1408
1409 /*
1410 * @brief A helper function to get all structs in a state.
1411 *
1412 * @see eolian_unit_structs_get
1413 *
1414 * @ingroup Eolian
1415 */
1416 static inline Eina_Iterator *
eolian_state_structs_get(const Eolian_State * state)1417 eolian_state_structs_get(const Eolian_State *state)
1418 {
1419 return eolian_unit_structs_get(EOLIAN_UNIT(state));
1420 }
1421
1422 /*
1423 * @brief A helper function to get all enums in a state.
1424 *
1425 * @see eolian_unit_enums_get
1426 *
1427 * @ingroup Eolian
1428 */
1429 static inline Eina_Iterator *
eolian_state_enums_get(const Eolian_State * state)1430 eolian_state_enums_get(const Eolian_State *state)
1431 {
1432 return eolian_unit_enums_get(EOLIAN_UNIT(state));
1433 }
1434
1435 /*
1436 * @brief A helper function to get the full name of a class.
1437 *
1438 * @see eolian_object_name_get
1439 *
1440 * @ingroup Eolian
1441 */
1442 static inline const char *
eolian_class_name_get(const Eolian_Class * klass)1443 eolian_class_name_get(const Eolian_Class *klass)
1444 {
1445 return eolian_object_name_get(EOLIAN_OBJECT(klass));
1446 }
1447
1448 /*
1449 * @brief A helper function to get the C name of a class.
1450 *
1451 * @see eolian_object_c_name_get
1452 *
1453 * @ingroup Eolian
1454 */
1455 static inline const char *
eolian_class_c_name_get(const Eolian_Class * klass)1456 eolian_class_c_name_get(const Eolian_Class *klass)
1457 {
1458 return eolian_object_c_name_get(EOLIAN_OBJECT(klass));
1459 }
1460
1461 /*
1462 * @brief A helper function to get the short name of a class.
1463 *
1464 * @see eolian_object_short_name_get
1465 *
1466 * @ingroup Eolian
1467 */
1468 static inline const char *
eolian_class_short_name_get(const Eolian_Class * klass)1469 eolian_class_short_name_get(const Eolian_Class *klass)
1470 {
1471 return eolian_object_short_name_get(EOLIAN_OBJECT(klass));
1472 }
1473
1474 /*
1475 * @brief A helper function to get the namespaces of a class.
1476 *
1477 * @see eolian_object_namespaces_get
1478 *
1479 * @ingroup Eolian
1480 */
1481 static inline Eina_Iterator *
eolian_class_namespaces_get(const Eolian_Class * klass)1482 eolian_class_namespaces_get(const Eolian_Class *klass)
1483 {
1484 return eolian_object_namespaces_get(EOLIAN_OBJECT(klass));
1485 }
1486
1487 /*
1488 * @brief Returns the class type of the given class
1489 *
1490 * @param[in] klass the class
1491 * @return the class type
1492 *
1493 * @ingroup Eolian
1494 */
1495 EAPI Eolian_Class_Type eolian_class_type_get(const Eolian_Class *klass);
1496
1497 /*
1498 * @brief Returns the documentation of a class.
1499 *
1500 * @param[in] klass the class
1501 * @return the documentation of a class
1502 *
1503 * @ingroup Eolian
1504 */
1505 EAPI const Eolian_Documentation *eolian_class_documentation_get(const Eolian_Class *klass);
1506
1507 /*
1508 * @brief Returns the C function prefix of a class
1509 *
1510 * @param[in] klass the class
1511 * @return the eo prefix
1512 *
1513 * @ingroup Eolian
1514 */
1515 EAPI const char *eolian_class_c_prefix_get(const Eolian_Class *klass);
1516
1517 /*
1518 * @brief Returns the C event prefix of a class
1519 *
1520 * @param[in] klass the class
1521 * @return the event prefix
1522 *
1523 * @ingroup Eolian
1524 */
1525 EAPI const char *eolian_class_event_c_prefix_get(const Eolian_Class *klass);
1526
1527 /*
1528 * @brief Returns the data type of a class
1529 *
1530 * @param[in] klass the class
1531 * @return the data type
1532 *
1533 * @ingroup Eolian
1534 */
1535 EAPI const char *eolian_class_data_type_get(const Eolian_Class *klass);
1536
1537 /*
1538 * @brief Get the parent class of a class
1539 *
1540 * This is the class the class inherits from. It only applies to classes,
1541 * as Eo follows a single-inheritance model with interfaces. This will be
1542 * NULL for any non-class (i.e. interface or mixin).
1543 *
1544 * @param[in] klass the class
1545 * @return the parent
1546 *
1547 * @see eolian_class_extensions_get
1548 *
1549 * @ingroup Eolian
1550 */
1551 EAPI const Eolian_Class *eolian_class_parent_get(const Eolian_Class *klass);
1552
1553 /*
1554 * @brief Returns an iterator to the required classes of this mixin
1555 *
1556 * For none mixins this will return an empty iterator, for mixins this returns a iterator that
1557 * carries all the classes that are required by this passed mixin.
1558 *
1559 * @param[in] klass the class
1560 * @return the iterator
1561 *
1562 * @ingroup Eolian
1563 */
1564 EAPI Eina_Iterator *eolian_class_requires_get(const Eolian_Class *klass);
1565
1566 /*
1567 * @brief Returns an iterator to the class extensions
1568 *
1569 * For regular classes, extensions are interfaces/mixins for the class, i.e.
1570 * everything past the parent class. For interfaces/mixins, this is everything
1571 * in the inherits list.
1572 *
1573 * @param[in] klass the class
1574 * @return the iterator
1575 *
1576 * @see eolian_class_parent_get
1577 *
1578 * @ingroup Eolian
1579 */
1580 EAPI Eina_Iterator *eolian_class_extensions_get(const Eolian_Class *klass);
1581
1582 /*
1583 * @brief Returns an iterator to functions of a class.
1584 *
1585 * @param[in] klass the class
1586 * @param[in] func_type type of the functions to insert into the list.
1587 * @return the iterator
1588 *
1589 * Acceptable inputs are EOLIAN_PROPERTY or EOLIAN_METHOD.
1590 *
1591 * @ingroup Eolian
1592 */
1593 EAPI Eina_Iterator *eolian_class_functions_get(const Eolian_Class *klass, Eolian_Function_Type func_type);
1594
1595 /*
1596 * @brief Returns the type of a function
1597 *
1598 * @param[in] function_id Id of the function
1599 * @return the function type
1600 *
1601 * @ingroup Eolian
1602 */
1603 EAPI Eolian_Function_Type eolian_function_type_get(const Eolian_Function *function_id);
1604
1605 /*
1606 * @brief Returns the scope of a function
1607 *
1608 * @param[in] function_id Id of the function
1609 * @param[in] ftype The type of function to get the scope for
1610 * @return the function scope
1611 *
1612 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1613 *
1614 * @ingroup Eolian
1615 */
1616 EAPI Eolian_Object_Scope eolian_function_scope_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
1617
1618 /*
1619 * @brief A helper function to get the name of a function.
1620 *
1621 * @see eolian_object_name_get
1622 *
1623 * @ingroup Eolian
1624 */
1625 static inline const char *
eolian_function_name_get(const Eolian_Function * fid)1626 eolian_function_name_get(const Eolian_Function *fid)
1627 {
1628 return eolian_object_name_get(EOLIAN_OBJECT(fid));
1629 }
1630
1631 /*
1632 * @brief Returns the full C name of a function.
1633 *
1634 * @param[in] function_id Id of the function
1635 * @param[in] ftype The type of function to get the name for
1636 * @return the function name
1637 *
1638 * It's here because the C API names are deduplicated (prefix of function and
1639 * suffix of prefix merge if applicable) and this helps generators not write
1640 * the same code over and over.
1641 *
1642 * If the given type is PROP_GET or PROPERTY, a "_get" suffix will be applied,
1643 * and "_set" for PROP_SET.
1644 *
1645 * Also, you're responsible for deleting the stringshare.
1646 *
1647 * @ingroup Eolian
1648 */
1649 EAPI Eina_Stringshare *eolian_function_full_c_name_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
1650
1651 /*
1652 * @brief Get a function in a class by its name and type
1653 *
1654 * @param[in] klass the class
1655 * @param[in] func_name name of the function
1656 * @param[in] f_type type of the function
1657 * @return the function id if found, NULL otherwise.
1658 *
1659 * Providing EOLIAN_UNRESOLVED finds any func, EOLIAN_PROPERTY any property,
1660 * EOLIAN_METHOD any method, EOLIAN_PROP_GET properties with either only a getter
1661 * or full property, EOLIAN_PROP_SET either only a setter or full property.
1662 *
1663 * @ingroup Eolian
1664 */
1665 EAPI const Eolian_Function *eolian_class_function_by_name_get(const Eolian_Class *klass, const char *func_name, Eolian_Function_Type f_type);
1666
1667 /*
1668 * @brief Returns the implement for a function.
1669 *
1670 * @param[in] function_id Id of the function
1671 * @return the implement or NULL.
1672 *
1673 * @ingroup Eolian
1674 */
1675 EAPI const Eolian_Implement *eolian_function_implement_get(const Eolian_Function *function_id);
1676
1677 /*
1678 * @brief Get whether a function is a static method/property.
1679 *
1680 * @param[in] function_id Id of the function
1681 * @return EINA_TRUE and EINA_FALSE respectively
1682 *
1683 * @ingroup Eolian
1684 */
1685 EAPI Eina_Bool eolian_function_is_static(const Eolian_Function *function_id);
1686
1687 /*
1688 * @brief Get whether a function is beta.
1689 *
1690 * @see eolian_object_is_beta
1691 *
1692 * @ingroup Eolian
1693 */
1694 static inline Eina_Bool
eolian_function_is_beta(const Eolian_Function * function_id)1695 eolian_function_is_beta(const Eolian_Function *function_id)
1696 {
1697 return eolian_object_is_beta(EOLIAN_OBJECT(function_id));
1698 }
1699
1700 /*
1701 * @brief Indicates if a function is a constructing function of a given class.
1702 *
1703 * @param[in] klass the class
1704 * @param[in] function_id Id of the function
1705 * @return EINA_TRUE and EINA_FALSE respectively
1706 *
1707 * @ingroup Eolian
1708 */
1709 EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass);
1710
1711 /*
1712 * @brief Returns an iterator to the parameter handles for a method/ctor/dtor.
1713 *
1714 * @param[in] function_id Id of the function
1715 * @return the iterator
1716 *
1717 * @ingroup Eolian
1718 */
1719 EAPI Eina_Iterator *eolian_function_parameters_get(const Eolian_Function *function_id);
1720
1721 /*
1722 * @brief Returns an iterator to the keys params of a given function.
1723 *
1724 * @param[in] function_id Id of the function
1725 * @param[in] ftype The function type, for property get/set distinction.
1726 * @return the iterator
1727 *
1728 * Acceptable input types are PROP_GET and PROP_SET.
1729 *
1730 * @ingroup Eolian
1731 */
1732 EAPI Eina_Iterator *eolian_property_keys_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1733
1734 /*
1735 * @brief Returns an iterator to the values params of a given function.
1736 *
1737 * @param[in] function_id Id of the function
1738 * @param[in] ftype The function type, for property get/set distinction.
1739 * @return the iterator
1740 *
1741 * Acceptable input types are PROP_GET and PROP_SET.
1742 *
1743 * @ingroup Eolian
1744 */
1745 EAPI Eina_Iterator *eolian_property_values_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1746
1747 /*
1748 * @brief Get direction of a parameter
1749 *
1750 * @param[in] param_desc parameter handle
1751 * @return the direction of the parameter
1752 *
1753 * @ingroup Eolian
1754 */
1755 EAPI Eolian_Parameter_Direction eolian_parameter_direction_get(const Eolian_Function_Parameter *param);
1756
1757 /*
1758 * @brief Get type of a parameter
1759 *
1760 * @param[in] param_desc parameter handle
1761 * @return the type of the parameter
1762 *
1763 * @ingroup Eolian
1764 */
1765 EAPI const Eolian_Type *eolian_parameter_type_get(const Eolian_Function_Parameter *param);
1766
1767 /*
1768 * @brief Get the default value of a parameter
1769 *
1770 * @param[in] param_desc parameter handle
1771 * @return the value or NULL
1772 *
1773 * @ingroup Eolian
1774 */
1775 EAPI const Eolian_Expression *eolian_parameter_default_value_get(const Eolian_Function_Parameter *param);
1776
1777 /*
1778 * @brief A helper function to get the name of a function parameter.
1779 *
1780 * @see eolian_object_name_get
1781 *
1782 * @ingroup Eolian
1783 */
1784 static inline const char *
eolian_parameter_name_get(const Eolian_Function_Parameter * param)1785 eolian_parameter_name_get(const Eolian_Function_Parameter *param)
1786 {
1787 return eolian_object_name_get(EOLIAN_OBJECT(param));
1788 }
1789
1790 /*
1791 * @brief Get documentation of a parameter
1792 *
1793 * @param[in] param_desc parameter handle
1794 * @return the documentation of the parameter or NULL
1795 *
1796 * @ingroup Eolian
1797 */
1798 EAPI const Eolian_Documentation *eolian_parameter_documentation_get(const Eolian_Function_Parameter *param);
1799
1800 /*
1801 * @brief Indicates if a parameter is optional.
1802 *
1803 * @param[in] param_desc parameter handle
1804 * @return EINA_TRUE if optional, EINA_FALSE otherwise
1805 *
1806 * @ingroup Eolian
1807 */
1808 EAPI Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc);
1809
1810 /*
1811 * @brief Get whether a parameter is by reference.
1812 *
1813 * @param[in] param_desc parameter handle
1814 * @return EINA_TRUE and EINA_FALSE respectively
1815 *
1816 * @ingroup Eolian
1817 */
1818 EAPI Eina_Bool eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param_desc);
1819
1820 /*
1821 * @brief Get whether a parameter is moved into the callee.
1822 *
1823 * @param[in] param_desc parameter handle
1824 * @return EINA_TRUE and EINA_FALSE respectively
1825 *
1826 * @ingroup Eolian
1827 */
1828 EAPI Eina_Bool eolian_parameter_is_move(const Eolian_Function_Parameter *param_desc);
1829
1830 /*
1831 * @brief Get the full C type name of the given parameter.
1832 *
1833 * @param[in] param_desc parameter handle
1834 * @param[in] as_return if true, it will be treated as a return type
1835 * @return The C type name assuming @c param_desc is not NULL.
1836 *
1837 * You're responsible for the stringshare. The @c as_return argument is meant
1838 * for properties, where the first out-param gets made into a return, which
1839 * has different typing characteristics.
1840 *
1841 * @see eolian_type_c_type_get
1842 *
1843 * @ingroup Eolian
1844 */
1845 EAPI Eina_Stringshare *eolian_parameter_c_type_get(const Eolian_Function_Parameter *param_desc, Eina_Bool as_return);
1846
1847 /*
1848 * @brief Get the return type of a function.
1849 *
1850 * @param[in] function_id id of the function
1851 * @param[in] ftype type of the function
1852 * @return the return type of the function
1853 *
1854 * The type of the function is needed because a given function can represent a
1855 * property, that can be set and get functions.
1856 *
1857 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1858 *
1859 * @ingroup Eolian
1860 */
1861 EAPI const Eolian_Type *eolian_function_return_type_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
1862
1863 /*
1864 * @brief Get the return default value of a function.
1865 *
1866 * @param[in] function_id id of the function
1867 * @param[in] ftype type of the function
1868 * @return the return default value of the function
1869 *
1870 * The return default value is needed to return an appropriate
1871 * value if an error occurs (eo_do failure...).
1872 * The default value is not mandatory, so NULL can be returned.
1873 *
1874 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1875 *
1876 * @ingroup Eolian
1877 */
1878 EAPI const Eolian_Expression *
1879 eolian_function_return_default_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1880
1881 /*
1882 * @brief Get the return docs of a function.
1883 *
1884 * @param[in] function_id id of the function
1885 * @param[in] ftype type of the function
1886 * @return the return docs of the function
1887 *
1888 * The type of the function is needed because a given function can represent a
1889 * property, that can be set and get functions.
1890 *
1891 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1892 *
1893 * @ingroup Eolian
1894 */
1895 EAPI const Eolian_Documentation *eolian_function_return_documentation_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1896
1897 /*
1898 * @brief Indicates if a function return should allow being unused.
1899 *
1900 * @param[in] function_id id of the function
1901 * @param[in] ftype type of the function
1902 * @return EINA_TRUE if it can be unused, EINA_FALSE otherwise.
1903 *
1904 * The type of the function is needed because a given function can represent a
1905 * property, that can be set and get functions.
1906 *
1907 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1908 *
1909 * @ingroup Eolian
1910 */
1911 EAPI Eina_Bool eolian_function_return_allow_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1912
1913 /*
1914 * @brief Get whether a parameter is by reference.
1915 *
1916 * @param[in] function_id id of the function
1917 * @param[in] ftype type of the function
1918 * @return EINA_TRUE and EINA_FALSE respectively
1919 *
1920 * The type of the function is needed because a given function can represent a
1921 * property, that can be set and get functions.
1922 *
1923 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1924 *
1925 * @ingroup Eolian
1926 */
1927 EAPI Eina_Bool eolian_function_return_is_by_ref(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1928
1929 /*
1930 * @brief Get whether a parameter is moved into the callee.
1931 *
1932 * @param[in] function_id id of the function
1933 * @param[in] ftype type of the function
1934 * @return EINA_TRUE and EINA_FALSE respectively
1935 *
1936 * The type of the function is needed because a given function can represent a
1937 * property, that can be set and get functions.
1938 *
1939 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
1940 *
1941 * @ingroup Eolian
1942 */
1943 EAPI Eina_Bool eolian_function_return_is_move(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1944
1945 /*
1946 * @brief Get the full C type name of the return value.
1947 *
1948 * @param[in] function_id id of the function
1949 * @param[in] ftype type of the function
1950 * @return The C type name.
1951 *
1952 * You're responsible for the stringshare.
1953 *
1954 * @see eolian_type_c_type_get
1955 *
1956 * @ingroup Eolian
1957 */
1958 EAPI Eina_Stringshare *eolian_function_return_c_type_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
1959
1960 /*
1961 * @brief Indicates if a function object is const.
1962 *
1963 * @param[in] function_id id of the function
1964 * @return EINA_TRUE if the object is const, EINA_FALSE otherwise
1965 *
1966 * @ingroup Eolian
1967 */
1968 EAPI Eina_Bool eolian_function_object_is_const(const Eolian_Function *function_id);
1969
1970 /*
1971 * @brief Return the Eolian class associated to the function.
1972 *
1973 * @param[in] function_id id of the function
1974 * @return the class, NULL otherwise
1975 *
1976 * @ingroup Eolian
1977 */
1978 EAPI const Eolian_Class *eolian_function_class_get(const Eolian_Function *function_id);
1979
1980 /*
1981 * @brief A helper function to get the full name of an implement.
1982 *
1983 * @see eolian_object_name_get
1984 *
1985 * @ingroup Eolian
1986 */
1987 static inline const char *
eolian_implement_name_get(const Eolian_Implement * impl)1988 eolian_implement_name_get(const Eolian_Implement *impl)
1989 {
1990 return eolian_object_name_get(EOLIAN_OBJECT(impl));
1991 }
1992
1993 /*
1994 * @brief Get the class of an overriding function (implement).
1995 *
1996 * This is always the class specified in the implement name, i.e. if a class
1997 * B overrides a method from a class A, the returned class will be A. There
1998 * is another API to get the overriding class.
1999 *
2000 * @param[in] impl the handle of the implement
2001 * @return the class handle or NULL.
2002 *
2003 * @see eolian_implement_implementing_class_get
2004 *
2005 * @ingroup Eolian
2006 */
2007 EAPI const Eolian_Class *eolian_implement_class_get(const Eolian_Implement *impl);
2008
2009 /*
2010 * @brief Get the implementing class of an overriding function (implement).
2011 *
2012 * This is always the class that is implementing the function, override or
2013 * not. That is, if class B overrides a method from class A, this will return
2014 * the B class. There is another API to get the original class.
2015 *
2016 * @param[in] impl the handle of the implement
2017 * @return the class handle or NULL.
2018 *
2019 * @see eolian_implement_class_get
2020 *
2021 * @ingroup Eolian
2022 */
2023 EAPI const Eolian_Class *eolian_implement_implementing_class_get(const Eolian_Implement *impl);
2024
2025 /*
2026 * @brief Get the function of an implement.
2027 *
2028 * @param[in] impl the handle of the implement
2029 * @param[out] func_type the function type.
2030 * @return the function handle or NULL.
2031 *
2032 * @ingroup Eolian
2033 */
2034 EAPI const Eolian_Function *eolian_implement_function_get(const Eolian_Implement *impl, Eolian_Function_Type *func_type);
2035
2036 /*
2037 * @brief Returns a documentation for an implement.
2038 *
2039 * @param[in] impl the handle of the implement
2040 * @param[in] f_type The function type, for property get/set distinction.
2041 * @return the documentation or NULL.
2042 *
2043 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
2044 *
2045 * @ingroup Eolian
2046 */
2047 EAPI const Eolian_Documentation *eolian_implement_documentation_get(const Eolian_Implement *impl, Eolian_Function_Type f_type);
2048
2049 /*
2050 * @brief Get whether an implement is tagged with @auto.
2051 *
2052 * @param[in] impl the handle of the implement
2053 * @param[in] f_type The function type, for property get/set distinction.
2054 * @return EINA_TRUE when it is, EINA_FALSE when it's not.
2055 *
2056 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
2057 *
2058 * @ingroup Eolian
2059 */
2060 EAPI Eina_Bool eolian_implement_is_auto(const Eolian_Implement *impl, Eolian_Function_Type f_type);
2061
2062 /*
2063 * @brief Get whether an implement is tagged with @empty.
2064 *
2065 * @param[in] impl the handle of the implement
2066 * @param[in] f_type The function type, for property get/set distinction.
2067 * @return EINA_TRUE when it is, EINA_FALSE when it's not.
2068 *
2069 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
2070 *
2071 * @ingroup Eolian
2072 */
2073 EAPI Eina_Bool eolian_implement_is_empty(const Eolian_Implement *impl, Eolian_Function_Type f_type);
2074
2075 /*
2076 * @brief Get whether an implement is pure virtual.
2077 *
2078 * @param[in] impl the handle of the implement
2079 * @param[in] f_type The function type, for property get/set distinction.
2080 * @return EINA_TRUE when it is, EINA_FALSE when it's not.
2081 *
2082 * Acceptable input types are METHOD, PROP_GET and PROP_SET.
2083 *
2084 * @ingroup Eolian
2085 */
2086 EAPI Eina_Bool eolian_implement_is_pure_virtual(const Eolian_Implement *impl, Eolian_Function_Type f_type);
2087
2088 /*
2089 * @brief Get whether an implement references a property getter.
2090 *
2091 * @param[in] impl the handle of the implement
2092 * @return EINA_TRUE when it does, EINA_FALSE when it's not.
2093 *
2094 * @ingroup Eolian
2095 */
2096 EAPI Eina_Bool eolian_implement_is_prop_get(const Eolian_Implement *impl);
2097
2098 /*
2099 * @brief Get whether an implement references a property setter.
2100 *
2101 * @param[in] impl the handle of the implement
2102 * @return EINA_TRUE when it does, EINA_FALSE when it's not.
2103 *
2104 * @ingroup Eolian
2105 */
2106 EAPI Eina_Bool eolian_implement_is_prop_set(const Eolian_Implement *impl);
2107
2108 /*
2109 * @brief Get an iterator to implements of a class.
2110 *
2111 * @param[in] klass the class.
2112 * @return the iterator
2113 *
2114 * Implements include fields specified in the "implements" section of your Eo
2115 * file (i.e. overriding and pure virtual/auto/empty functions) and all other
2116 * methods/properties of your class (local only) that are not specified
2117 * within that section.
2118 *
2119 * @ingroup Eolian
2120 */
2121 EAPI Eina_Iterator *eolian_class_implements_get(const Eolian_Class *klass);
2122
2123 /*
2124 * @brief A helper function to get the full name of a constructor.
2125 *
2126 * @see eolian_object_name_get
2127 *
2128 * @ingroup Eolian
2129 */
2130 static inline const char *
eolian_constructor_name_get(const Eolian_Constructor * ctor)2131 eolian_constructor_name_get(const Eolian_Constructor *ctor)
2132 {
2133 return eolian_object_name_get(EOLIAN_OBJECT(ctor));
2134 }
2135
2136 /*
2137 * @brief Get the class of a constructing function.
2138 *
2139 * @param[in] ctor the handle of the constructor
2140 * @return the class handle or NULL.
2141 *
2142 * @ingroup Eolian
2143 */
2144 EAPI const Eolian_Class *eolian_constructor_class_get(const Eolian_Constructor *ctor);
2145
2146 /*
2147 * @brief Get the function of a constructing function.
2148 *
2149 * @param[in] ctor the handle of the constructor
2150 * @return the function handle or NULL.
2151 *
2152 * @ingroup Eolian
2153 */
2154 EAPI const Eolian_Function *eolian_constructor_function_get(const Eolian_Constructor *ctor);
2155
2156 /*
2157 * @brief Checks if a constructor is tagged optional.
2158 *
2159 * @param[in] ctor the handle of the constructor
2160 * @return EINA_TRUE if optional, EINA_FALSE if not (or if input is NULL).
2161 *
2162 * @ingroup Eolian
2163 */
2164 EAPI Eina_Bool eolian_constructor_is_optional(const Eolian_Constructor *ctor);
2165
2166 /*
2167 * @brief Get an iterator to the constructing functions defined in a class.
2168 *
2169 * @param[in] klass the class.
2170 * @return the iterator
2171 *
2172 * @ingroup Eolian
2173 */
2174 EAPI Eina_Iterator *eolian_class_constructors_get(const Eolian_Class *klass);
2175
2176 /*
2177 * @brief Get an iterator to the events defined in a class.
2178 *
2179 * @param[in] klass the class.
2180 * @return an iterator over const Eolian_Event* objects
2181 *
2182 * @ingroup Eolian
2183 */
2184 EAPI Eina_Iterator *eolian_class_events_get(const Eolian_Class *klass);
2185
2186 /*
2187 * @brief A helper function to get the name of an event.
2188 *
2189 * @see eolian_object_name_get
2190 *
2191 * @ingroup Eolian
2192 */
2193 static inline const char *
eolian_event_name_get(const Eolian_Event * event)2194 eolian_event_name_get(const Eolian_Event *event)
2195 {
2196 return eolian_object_name_get(EOLIAN_OBJECT(event));
2197 }
2198
2199 /*
2200 * @brief Get the type of an event.
2201 *
2202 * @param[in] event the event handle
2203 * @return the type or NULL
2204 *
2205 * @ingroup Eolian
2206 */
2207 EAPI const Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
2208
2209 /*
2210 * @brief Get the class of an event.
2211 *
2212 * @param[in] event the event handle
2213 * @return the class or NULL
2214 *
2215 * @ingroup Eolian
2216 */
2217 EAPI const Eolian_Class *eolian_event_class_get(const Eolian_Event *event);
2218
2219 /*
2220 * @brief Get the documentation of an event.
2221 *
2222 * @param[in] event the event handle
2223 * @return the documentation or NULL
2224 *
2225 * @ingroup Eolian
2226 */
2227 EAPI const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event);
2228
2229 /*
2230 * @brief Returns the scope of an event
2231 *
2232 * @param[in] event the event handle
2233 * @return the event scope
2234 *
2235 * @ingroup Eolian
2236 */
2237 EAPI Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
2238
2239 /*
2240 * @brief Get whether an event is beta.
2241 *
2242 * @see eolian_object_is_beta
2243 *
2244 * @ingroup Eolian
2245 */
2246 static inline Eina_Bool
eolian_event_is_beta(const Eolian_Event * event)2247 eolian_event_is_beta(const Eolian_Event *event)
2248 {
2249 return eolian_object_is_beta(EOLIAN_OBJECT(event));
2250 }
2251
2252 /*
2253 * @brief Get whether an event is hot (unfreezable).
2254 *
2255 * @param[in] event the event handle
2256 * @return EINA_TRUE and EINA_FALSE respectively
2257 *
2258 * @ingroup Eolian
2259 */
2260 EAPI Eina_Bool eolian_event_is_hot(const Eolian_Event *event);
2261
2262 /*
2263 * @brief Get whether an event is a restartable event.
2264 *
2265 * @param[in] event the event handle
2266 * @return EINA_TRUE and EINA_FALSE respectively
2267 *
2268 * In case of nested call, restartable event will start processing from where
2269 * they where in the parent callback call skipping all the previously executed
2270 * callback. Especially useful for nested main loop use case.
2271 *
2272 * @ingroup Eolian
2273 */
2274 EAPI Eina_Bool eolian_event_is_restart(const Eolian_Event *event);
2275
2276 /*
2277 * @brief Get an iterator to the parts defined in a class.
2278 *
2279 * @param[in] klass the class.
2280 * @return an iterator over const Eolian_Part* objects
2281 *
2282 * @ingroup Eolian
2283 */
2284 EAPI Eina_Iterator *eolian_class_parts_get(const Eolian_Class *klass);
2285
2286 /*
2287 * @brief Returns the C macro name used to refer to an event
2288 *
2289 * @param[in] event the event handle
2290 * @return the event C macro
2291 *
2292 * You're responsible for deleting the stringshare.
2293 *
2294 * @ingroup Eolian
2295 */
2296 EAPI Eina_Stringshare *eolian_event_c_macro_get(const Eolian_Event *event);
2297
2298 /*
2299 * @brief A helper function to get the name of a part.
2300 *
2301 * @see eolian_object_name_get
2302 *
2303 * @ingroup Eolian
2304 */
2305 static inline const char *
eolian_part_name_get(const Eolian_Part * part)2306 eolian_part_name_get(const Eolian_Part *part)
2307 {
2308 return eolian_object_name_get(EOLIAN_OBJECT(part));
2309 }
2310
2311 /*
2312 * @brief Get the type of a part.
2313 *
2314 * @param[in] part the part handle
2315 * @return the type or NULL
2316 *
2317 * @ingroup Eolian
2318 */
2319 EAPI const Eolian_Class *eolian_part_class_get(const Eolian_Part *part);
2320
2321 /*
2322 * @brief Get the documentation of an part.
2323 *
2324 * @param[in] part the part handle
2325 * @return the documentation or NULL
2326 *
2327 * @ingroup Eolian
2328 */
2329 EAPI const Eolian_Documentation *eolian_part_documentation_get(const Eolian_Part *part);
2330
2331 /*
2332 * @brief Get whether a part is beta.
2333 *
2334 * @see eolian_object_is_beta
2335 *
2336 * @ingroup Eolian
2337 */
2338 static inline Eina_Bool
eolian_part_is_beta(const Eolian_Part * part)2339 eolian_part_is_beta(const Eolian_Part *part)
2340 {
2341 return eolian_object_is_beta(EOLIAN_OBJECT(part));
2342 }
2343
2344 /*
2345 * @brief Get an event in a class by its name
2346 *
2347 * @param[in] klass the class
2348 * @param[in] event_name name of the event
2349 * @return the Eolian_Event if found, NULL otherwise.
2350 *
2351 * @ingroup Eolian
2352 */
2353 EAPI const Eolian_Event *eolian_class_event_by_name_get(const Eolian_Class *klass, const char *event_name);
2354
2355 /*
2356 * @brief Indicates if the class constructor has to invoke
2357 * a non-generated class constructor function.
2358 *
2359 * @param[in] klass the class.
2360 * @return EINA_TRUE if the invocation is needed, EINA_FALSE otherwise.
2361 *
2362 * @ingroup Eolian
2363 */
2364 EAPI Eina_Bool eolian_class_ctor_enable_get(const Eolian_Class *klass);
2365
2366 /*
2367 * @brief Indicates if the class destructor has to invoke
2368 * a non-generated class destructor function.
2369 *
2370 * @param[in] klass the class.
2371 * @return EINA_TRUE if the invocation is needed, EINA_FALSE otherwise.
2372 *
2373 * @ingroup Eolian
2374 */
2375 EAPI Eina_Bool eolian_class_dtor_enable_get(const Eolian_Class *klass);
2376
2377 /*
2378 * @brief Returns the name of the C function used to get the Efl_Class pointer.
2379 *
2380 * @param[in] klass the class.
2381 * @return a stringshare containing the func name or NULL on error.
2382 *
2383 * You have to delete the stringshare manually.
2384 *
2385 * @see eolian_class_c_name_get
2386 *
2387 * @ingroup Eolian
2388 */
2389 EAPI Eina_Stringshare *eolian_class_c_get_function_name_get(const Eolian_Class *klass);
2390
2391 /*
2392 * @brief Get the C macro of the class.
2393 *
2394 * @param[in] klass the class
2395 * @return the C symbol
2396 *
2397 * This is the name by which the class is accessed in C environment, in format
2398 * CLASS_NAME_SUFFIX where SUFFIX is CLASS, MIXIN or INTERFACE. You're responsible
2399 * for the stringshare afterwards.
2400 *
2401 * @see eolian_class_c_get_function_name_get
2402 *
2403 * @ingroup Eolian
2404 */
2405 EAPI Eina_Stringshare *eolian_class_c_macro_get(const Eolian_Class *klass);
2406
2407 /*
2408 * @brief Get the C data type of the class.
2409 *
2410 * @param[in] klass the class
2411 * @return the C data type
2412 *
2413 * This will sanitize the data type of the class for C usage; if it's "null",
2414 * this returns "void"; if it's actually explicitly set, it returns the sanitized
2415 * version of the string, otherwise it returns Class_Name_Data. Keep in mind that
2416 * this does not add an asterisk (it doesn't return a pointer type name). You're
2417 * responsible for the stringshare afterwards.
2418 *
2419 * @see eolian_class_c_get_function_name_get
2420 *
2421 * @ingroup Eolian
2422 */
2423 EAPI Eina_Stringshare *eolian_class_c_data_type_get(const Eolian_Class *klass);
2424
2425 /*
2426 * @brief Get whether a class is beta.
2427 *
2428 * @see eolian_object_is_beta
2429 *
2430 * @ingroup Eolian
2431 */
2432 static inline Eina_Bool
eolian_class_is_beta(const Eolian_Class * klass)2433 eolian_class_is_beta(const Eolian_Class *klass)
2434 {
2435 return eolian_object_is_beta(EOLIAN_OBJECT(klass));
2436 }
2437
2438 /*
2439 * @brief Get the type of a type declaration.
2440 *
2441 * @param[in] tp the type declaration.
2442 * @return an Eolian_Typedecl_Type.
2443 *
2444 * @ingroup Eolian
2445 */
2446 EAPI Eolian_Typedecl_Type eolian_typedecl_type_get(const Eolian_Typedecl *tp);
2447
2448 /*
2449 * @brief Get an iterator to all fields of a struct type.
2450 *
2451 * @param[in] tp the type declaration.
2452 * @return the iterator when @c tp is EOLIAN_TYPEDECL_STRUCT, NULL otherwise.
2453 *
2454 * @ingroup Eolian
2455 */
2456 EAPI Eina_Iterator *eolian_typedecl_struct_fields_get(const Eolian_Typedecl *tp);
2457
2458 /*
2459 * @brief Get a field of a struct type.
2460 *
2461 * @param[in] tp the type declaration.
2462 * @param[in] field the field name.
2463 * @return the field when @c tp is EOLIAN_TYPEDECL_STRUCT, @c field is not NULL
2464 * and the field exists, NULL otherwise.
2465 *
2466 * @ingroup Eolian
2467 */
2468 EAPI const Eolian_Struct_Type_Field *eolian_typedecl_struct_field_get(const Eolian_Typedecl *tp, const char *field);
2469
2470 /*
2471 * @brief A helper function to get the name of a struct field.
2472 *
2473 * @see eolian_object_name_get
2474 *
2475 * @ingroup Eolian
2476 */
2477 static inline const char *
eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field * field)2478 eolian_typedecl_struct_field_name_get(const Eolian_Struct_Type_Field *field)
2479 {
2480 return eolian_object_name_get(EOLIAN_OBJECT(field));
2481 }
2482
2483 /*
2484 * @brief Get the documentation of a field of a struct type.
2485 *
2486 * @param[in] fl the field.
2487 * @return the documentation.
2488 *
2489 * @ingroup Eolian
2490 */
2491 EAPI const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get(const Eolian_Struct_Type_Field *fl);
2492
2493 /*
2494 * @brief Get the type of a field of a struct type.
2495 *
2496 * @param[in] fl the field.
2497 * @return the type.
2498 *
2499 * @ingroup Eolian
2500 */
2501 EAPI const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl);
2502
2503 /*
2504 * @brief Get whether a struct field is by reference.
2505 *
2506 * @param[in] fl the field.
2507 * @return EINA_TRUE and EINA_FALSE respectively
2508 *
2509 * @ingroup Eolian
2510 */
2511 EAPI Eina_Bool eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl);
2512
2513 /*
2514 * @brief Get whether a struct field is moved with the struct.
2515 *
2516 * @param[in] fl the field.
2517 * @return EINA_TRUE and EINA_FALSE respectively
2518 *
2519 * @ingroup Eolian
2520 */
2521 EAPI Eina_Bool eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl);
2522
2523 /*
2524 * @brief Get the full C type name of the struct field.
2525 *
2526 * @param[in] fl the field.
2527 * @return The C type name.
2528 *
2529 * You're responsible for the stringshare.
2530 *
2531 * @see eolian_type_c_type_get
2532 *
2533 * @ingroup Eolian
2534 */
2535 EAPI Eina_Stringshare *eolian_typedecl_struct_field_c_type_get(const Eolian_Struct_Type_Field *fl);
2536
2537 /*
2538 * @brief Get an iterator to all fields of an enum type.
2539 *
2540 * @param[in] tp the type declaration.
2541 * @return the iterator when @c tp is EOLIAN_TYPEDECL_ENUM, NULL otherwise.
2542 *
2543 * @ingroup Eolian
2544 */
2545 EAPI Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp);
2546
2547 /*
2548 * @brief Get a field of an enum type.
2549 *
2550 * @param[in] tp the type declaration.
2551 * @param[in] field the field name.
2552 * @return the field when @c tp is EOLIAN_TYPEDECL_ENUM, @c field is not NULL,
2553 * field exists and has a value set, NULL otherwise.
2554 *
2555 * Keep in mind that this can return NULL for an existing field, particularly
2556 * when the field has no value set (i.e. increments by 1 over previous value).
2557 *
2558 * @ingroup Eolian
2559 */
2560 EAPI const Eolian_Enum_Type_Field *eolian_typedecl_enum_field_get(const Eolian_Typedecl *tp, const char *field);
2561
2562 /*
2563 * @brief A helper function to get the name of an enum field.
2564 *
2565 * @see eolian_object_name_get
2566 *
2567 * @ingroup Eolian
2568 */
2569 static inline const char *
eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field * field)2570 eolian_typedecl_enum_field_name_get(const Eolian_Enum_Type_Field *field)
2571 {
2572 return eolian_object_name_get(EOLIAN_OBJECT(field));
2573 }
2574
2575 /*
2576 * @brief Get the C constant name used to refer to a particular enum field.
2577 *
2578 * The user of the API is responsible for the resulting stringshare.
2579 *
2580 * @param[in] fl the field.
2581 * @return the name.
2582 *
2583 * @ingroup Eolian
2584 */
2585 EAPI Eina_Stringshare *eolian_typedecl_enum_field_c_constant_get(const Eolian_Enum_Type_Field *fl);
2586
2587 /*
2588 * @brief Get the documentation of a field of an enum type.
2589 *
2590 * @param[in] fl the field.
2591 * @return the documentation.
2592 *
2593 * @ingroup Eolian
2594 */
2595 EAPI const Eolian_Documentation *eolian_typedecl_enum_field_documentation_get(const Eolian_Enum_Type_Field *fl);
2596
2597 /*
2598 * @brief Get the value of a field of an enum type.
2599 *
2600 * When the @c force parameter is EINA_FALSE, this will only return values for
2601 * fields which are explicitly specified in the eo file, otherwise it will
2602 * return a valid expression for any field.
2603 *
2604 * @param[in] fl the field.
2605 * @param[in] force force the value retrieval.
2606 * @return the expression.
2607 *
2608 * @ingroup Eolian
2609 */
2610 EAPI const Eolian_Expression *eolian_typedecl_enum_field_value_get(const Eolian_Enum_Type_Field *fl, Eina_Bool force);
2611
2612 /*
2613 * @brief Get the documentation of a struct/alias type.
2614 *
2615 * @param[in] tp the type declaration.
2616 * @return the documentation when @c tp is EOLIAN_TYPE_STRUCT or
2617 * EOLIAN_TYPE_STRUCT_OPAQUE, NULL otherwise.
2618 *
2619 * @ingroup Eolian
2620 */
2621 EAPI const Eolian_Documentation *eolian_typedecl_documentation_get(const Eolian_Typedecl *tp);
2622
2623 /*
2624 * @brief Get the base type of an alias declaration.
2625 *
2626 * @param[in] tp the type declaration.
2627 * @return the base type when @c tp is an alias, NULL otherwise.
2628 *
2629 * @ingroup Eolian
2630 */
2631 EAPI const Eolian_Type *eolian_typedecl_base_type_get(const Eolian_Typedecl *tp);
2632
2633 /*
2634 * @brief Get the lowest base type of an alias stack.
2635 *
2636 * If the given typedecl is an alias, it returns the result of
2637 * eolian_type_aliased_base_get on its base type. Otherwise this returns NULL.
2638 *
2639 * @param[in] tp the type declaration.
2640 * @return the lowest alias base or the given type.
2641 *
2642 * @ingroup Eolian
2643 */
2644 EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
2645
2646 /*
2647 * @brief Check if a struct or alias type declaration is extern.
2648 *
2649 * @param[in] tp the type declaration.
2650 * @return EINA_TRUE if it's extern, EINA_FALSE otherwise.
2651 *
2652 * @ingroup Eolian
2653 */
2654 EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp);
2655
2656 /*
2657 * @brief Get whether a typedecl is beta.
2658 *
2659 * @see eolian_object_is_beta
2660 *
2661 * @ingroup Eolian
2662 */
2663 static inline Eina_Bool
eolian_typedecl_is_beta(const Eolian_Typedecl * tp)2664 eolian_typedecl_is_beta(const Eolian_Typedecl *tp)
2665 {
2666 return eolian_object_is_beta(EOLIAN_OBJECT(tp));
2667 }
2668
2669 /*
2670 * @brief Get the full C type name of the given type.
2671 *
2672 * @param[in] tp the type declaration.
2673 * @return The C type name assuming @c tp is not NULL.
2674 *
2675 * You're responsible for deleting the stringshare.
2676 *
2677 * @see eolian_type_c_type_get
2678 *
2679 * @ingroup Eolian
2680 */
2681 EAPI Eina_Stringshare *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
2682
2683 /*
2684 * @brief A helper function to get the full name of a typedecl.
2685 *
2686 * @see eolian_object_name_get
2687 *
2688 * @ingroup Eolian
2689 */
2690 static inline const char *
eolian_typedecl_name_get(const Eolian_Typedecl * tp)2691 eolian_typedecl_name_get(const Eolian_Typedecl *tp)
2692 {
2693 return eolian_object_name_get(EOLIAN_OBJECT(tp));
2694 }
2695
2696 /*
2697 * @brief A helper function to get the C name of a typedecl.
2698 *
2699 * @see eolian_object_c_name_get
2700 *
2701 * @ingroup Eolian
2702 */
2703 static inline const char *
eolian_typedecl_c_name_get(const Eolian_Typedecl * tp)2704 eolian_typedecl_c_name_get(const Eolian_Typedecl *tp)
2705 {
2706 return eolian_object_c_name_get(EOLIAN_OBJECT(tp));
2707 }
2708
2709 /*
2710 * @brief A helper function to get the short name of a typedecl.
2711 *
2712 * @see eolian_object_short_name_get
2713 *
2714 * @ingroup Eolian
2715 */
2716 static inline const char *
eolian_typedecl_short_name_get(const Eolian_Typedecl * tp)2717 eolian_typedecl_short_name_get(const Eolian_Typedecl *tp)
2718 {
2719 return eolian_object_short_name_get(EOLIAN_OBJECT(tp));
2720 }
2721
2722 /*
2723 * @brief A helper function to get the namespaces of a typedecl.
2724 *
2725 * @see eolian_object_namespaces_get
2726 *
2727 * @ingroup Eolian
2728 */
2729 static inline Eina_Iterator *
eolian_typedecl_namespaces_get(const Eolian_Typedecl * tp)2730 eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp)
2731 {
2732 return eolian_object_namespaces_get(EOLIAN_OBJECT(tp));
2733 }
2734
2735 /*
2736 * @brief Get the name of the function used to free this type declaration.
2737 *
2738 * @param[in] tp the type declaration.
2739 * @return the free func name.
2740 *
2741 * @ingroup Eolian
2742 */
2743 EAPI const char *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp);
2744
2745 /*
2746 * @brief Get the function object for this function pointer type.
2747 *
2748 * @param[in] tp the type.
2749 * @return the function or NULL;
2750 *
2751 * @ingroup Eolian
2752 */
2753 EAPI const Eolian_Function *eolian_typedecl_function_pointer_get(const Eolian_Typedecl *tp);
2754
2755 /*
2756 * @brief Get the type of a type.
2757 *
2758 * @param[in] tp the type.
2759 * @return an Eolian_Type_Type.
2760 *
2761 * @ingroup Eolian
2762 */
2763 EAPI Eolian_Type_Type eolian_type_type_get(const Eolian_Type *tp);
2764
2765 /*
2766 * @brief Get the builtin type of a type.
2767 *
2768 * @param[in] tp the type.
2769 * @return an Eolian_Type_Builtin_Type.
2770 *
2771 * If the input type is NULL or it's not a builtin, EOLIAN_TYPE_BUILTIN_INVALID
2772 * is returned.
2773 *
2774 * @ingroup Eolian
2775 */
2776 EAPI Eolian_Type_Builtin_Type eolian_type_builtin_type_get(const Eolian_Type *tp);
2777
2778 /*
2779 * @brief Get the base type of a type.
2780 *
2781 * Only applies to "complex" ordinary types, i.e. this is the first inner
2782 * type in <>.
2783 *
2784 * @param[in] tp the type.
2785 * @return the base type or NULL.
2786 *
2787 * @ingroup Eolian
2788 */
2789 EAPI const Eolian_Type *eolian_type_base_type_get(const Eolian_Type *tp);
2790
2791 /*
2792 * @brief Get the next inner type of a complex type.
2793 *
2794 * The inner types of a complex type form a chain. Therefore, you first retrieve
2795 * the first one via eolian_type_base_type_get and then get the next one via
2796 * this API function called on the first inner type if necessary. Another use
2797 * for this is with errors, specifying error(Foo, Bar, ...) makes a chain.
2798 *
2799 * @param[in] tp the type.
2800 * @return the next type or NULL.
2801 *
2802 * @ingroup Eolian
2803 */
2804 EAPI const Eolian_Type *eolian_type_next_type_get(const Eolian_Type *tp);
2805
2806 /*
2807 * @brief Get the declaration a regular type points to.
2808 *
2809 * This tries to look up alias, struct and enum in that order.
2810 *
2811 * @param[in] tp the type.
2812 * @return the pointed to type decalration or NULL.
2813 *
2814 * @ingroup Eolian
2815 */
2816 EAPI const Eolian_Typedecl *eolian_type_typedecl_get(const Eolian_Type *tp);
2817
2818 /*
2819 * @brief Get the lowest base type of an alias stack.
2820 *
2821 * If this is a regular type, it first tries to retrieve its base declaration
2822 * using eolian_type_typedecl_get and if the retrieved base is an alias, returns
2823 * a call of eolian_typedecl_aliased_base_get function on it. Otherwise it
2824 * returns the given type. This is useful in order to retrieve what an aliased
2825 * type actually is while still having convenience. Keep in mind that this stops
2826 * if the found type is actually a pointer (has a ptr() on it).
2827 *
2828 * @param[in] tp the type.
2829 * @return the lowest alias base or the given type.
2830 *
2831 * @ingroup Eolian
2832 */
2833 EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Type *tp);
2834
2835 /*
2836 * @brief Get the class associated with an EOLIAN_TYPE_CLASS type.
2837 *
2838 * @param[in] tp the type.
2839 * @return the class or NULL.
2840 *
2841 * @ingroup Eolian
2842 */
2843 EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
2844
2845 /*
2846 * @brief Get the error declaration associated with an EOLIAN_TYPE_ERROR type.
2847 *
2848 * @param[in] tp the type.
2849 * @return the error or NULL.
2850 *
2851 * @ingroup Eolian
2852 */
2853 EAPI const Eolian_Error *eolian_type_error_get(const Eolian_Type *tp);
2854
2855 /*
2856 * @brief Get whether the given type is moved with its parent type.
2857 *
2858 * This is only used for inner types of owning containers, i.e. arrays,
2859 * lists, hashes and futures. View containers (accessors and iterators)
2860 * are not allowed to own their contents (the Eolian syntax will not let
2861 * you use the <tt>@move</tt> tag there).
2862 *
2863 * @param[in] tp the type.
2864 * @return EINA_TRUE when the type is marked move, EINA_FALSE otherwise.
2865 *
2866 * @ingroup Eolian
2867 */
2868 EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp);
2869
2870 /*
2871 * @brief Get whether the given type is const.
2872 *
2873 * @param[in] tp the type.
2874 * @return EINA_TRUE when the type is const, EINA_FALSE otherwise.
2875 *
2876 * @ingroup Eolian
2877 */
2878 EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
2879
2880 /*
2881 * @brief Get the full C type name of the given type.
2882 *
2883 * @param[in] tp the type.
2884 * @return The C type name assuming @c tp is not NULL.
2885 *
2886 * You're responsible for the stringshare.
2887 *
2888 * @see eolian_typedecl_c_type_get
2889 *
2890 * @ingroup Eolian
2891 */
2892 EAPI Eina_Stringshare *eolian_type_c_type_get(const Eolian_Type *tp);
2893
2894 /*
2895 * @brief A helper function to get the full name of a type.
2896 *
2897 * @see eolian_object_name_get
2898 *
2899 * @ingroup Eolian
2900 */
2901 static inline const char *
eolian_type_name_get(const Eolian_Type * tp)2902 eolian_type_name_get(const Eolian_Type *tp)
2903 {
2904 return eolian_object_name_get(EOLIAN_OBJECT(tp));
2905 }
2906
2907 /*
2908 * @brief A helper function to get the C name of a type.
2909 *
2910 * @see eolian_object_c_name_get
2911 *
2912 * @ingroup Eolian
2913 */
2914 static inline const char *
eolian_type_c_name_get(const Eolian_Type * tp)2915 eolian_type_c_name_get(const Eolian_Type *tp)
2916 {
2917 return eolian_object_c_name_get(EOLIAN_OBJECT(tp));
2918 }
2919
2920 /*
2921 * @brief A helper function to get the short name of a type.
2922 *
2923 * @see eolian_object_short_name_get
2924 *
2925 * @ingroup Eolian
2926 */
2927 static inline const char *
eolian_type_short_name_get(const Eolian_Type * tp)2928 eolian_type_short_name_get(const Eolian_Type *tp)
2929 {
2930 return eolian_object_short_name_get(EOLIAN_OBJECT(tp));
2931 }
2932
2933 /*
2934 * @brief A helper function to get the namespaces of a type.
2935 *
2936 * @see eolian_object_namespaces_get
2937 *
2938 * @ingroup Eolian
2939 */
2940 static inline Eina_Iterator *
eolian_type_namespaces_get(const Eolian_Type * tp)2941 eolian_type_namespaces_get(const Eolian_Type *tp)
2942 {
2943 return eolian_object_namespaces_get(EOLIAN_OBJECT(tp));
2944 }
2945
2946 /*
2947 * @brief Evaluate an Eolian expression.
2948 *
2949 * @param[in] expr the expression.
2950 * @param[in] mask the mask of allowed values (can combine with bitwise OR).
2951 * @return the value, its type is set to EOLIAN_EXPR_UNKNOWN on error.
2952 *
2953 * Represents value types from Eolian_Expression_Type. Booleans
2954 * are represented as unsigned char, strings as a stringshare.
2955 *
2956 * @ingroup Eolian
2957 */
2958 EAPI Eolian_Value eolian_expression_eval(const Eolian_Expression *expr, Eolian_Expression_Mask m);
2959
2960 /*
2961 * @brief Evaluate an Eolian expression into an out-param.
2962 *
2963 * @param[in] expr the expression.
2964 * @param[in] mask the mask of allowed values (can combine with bitwise OR).
2965 * @param[out] the value to fill
2966 * @return EINA_TRUE on success, EINA_FALSE on failure
2967 *
2968 * This is like eolian_expression_eval, except it writes into an out-param
2969 * and returns whether it succeeded or failed. On failure, no write is
2970 * guaranteed.
2971 *
2972 * @since 1.25
2973 *
2974 * @ingroup Eolian
2975 */
2976 EAPI Eina_Bool eolian_expression_eval_fill(const Eolian_Expression *expr, Eolian_Expression_Mask m, Eolian_Value *val);
2977
2978 /*
2979 * @brief Convert the result of expression evaluation to a literal as in how
2980 * it would appear in C (e.g. strings are quoted and escaped).
2981 *
2982 * @param[in] v the value.
2983 * @return a stringshare containing the literal (quoted and escaped as needed)
2984 * or NULL.
2985 *
2986 * For e.g. strings this only uses a subset of regular C escape sequences
2987 * so that interoperability is wider than just C (no octal escapes). For
2988 * languages that differ too much, you can write an equivalent function
2989 * yourself.
2990 * Also, you're responsible for deleting the stringshare.
2991 *
2992 * @ingroup Eolian
2993 */
2994 EAPI Eina_Stringshare *eolian_expression_value_to_literal(const Eolian_Value *v);
2995
2996 /*
2997 * @brief Serialize an expression.
2998 *
2999 * @param[in] expr the expression.
3000 * @return the serialized expression or NULL.
3001 *
3002 * This serializes the expression into the original form as written in the .eo
3003 * file (but with parens on binary operators explicitly specifying precedence).
3004 * Keep in mind that it cannot be used alone pasted into C code as it doesn't
3005 * resolve namespaces and enum field names.
3006 * Also, you're responsible for deleting the stringshare.
3007 *
3008 * @ingroup Eolian
3009 */
3010 EAPI Eina_Stringshare *eolian_expression_serialize(const Eolian_Expression *expr);
3011
3012 /*
3013 * @brief Get the type of an expression.
3014 *
3015 * @param[in] expr the expression.
3016 * @return the expression type.
3017 *
3018 * @ingroup Eolian
3019 */
3020 EAPI Eolian_Expression_Type eolian_expression_type_get(const Eolian_Expression *expr);
3021
3022 /*
3023 * @brief Get the binary operator of an expression.
3024 *
3025 * @param[in] expr the expression.
3026 * @return the binary operator, EOLIAN_BINOP_INVALID on failure.
3027 *
3028 * This only works on binary expressions, otherwise it returns
3029 * EOLIAN_BINOP_INVALID.
3030 *
3031 * @ingroup Eolian
3032 */
3033 EAPI Eolian_Binary_Operator eolian_expression_binary_operator_get(const Eolian_Expression *expr);
3034
3035 /*
3036 * @brief Get the lhs (left hand side) of a binary expression.
3037 *
3038 * @param[in] expr the expression.
3039 * @return the expression or NULL.
3040 *
3041 * This only works on binary expressions, otherwise it returns NULL.
3042 *
3043 * @ingroup Eolian
3044 */
3045 EAPI const Eolian_Expression *eolian_expression_binary_lhs_get(const Eolian_Expression *expr);
3046
3047 /*
3048 * @brief Get the rhs (right hand side) of a binary expression.
3049 *
3050 * @param[in] expr the expression.
3051 * @return the expression or NULL.
3052 *
3053 * This only works on binary expressions, otherwise it returns NULL.
3054 *
3055 * @ingroup Eolian
3056 */
3057 EAPI const Eolian_Expression *eolian_expression_binary_rhs_get(const Eolian_Expression *expr);
3058
3059 /*
3060 * @brief Get the unary operator of an expression.
3061 *
3062 * @param[in] expr the expression.
3063 * @return the unary operator, EOLIAN_UNOP_INVALID on failure.
3064 *
3065 * This only works on unary expressions, otherwise it returns
3066 * EOLIAN_UNOP_INVALID.
3067 *
3068 * @ingroup Eolian
3069 */
3070 EAPI Eolian_Unary_Operator eolian_expression_unary_operator_get(const Eolian_Expression *expr);
3071
3072 /*
3073 * @brief Get the expression of an unary expression.
3074 *
3075 * @param[in] expr the expression.
3076 * @return the expression or NULL.
3077 *
3078 * This only works on unary expressions, otherwise it returns NULL.
3079 *
3080 * @ingroup Eolian
3081 */
3082 EAPI const Eolian_Expression *eolian_expression_unary_expression_get(const Eolian_Expression *expr);
3083
3084 /*
3085 * @brief Get the value of an expression.
3086 *
3087 * @param[in] expr the expression.
3088 * @return the value.
3089 *
3090 * Keep in mind that this doesn't evaluate anything. That's why it only works
3091 * on expressions that actually hold values (not unknown, not binary, not
3092 * unary). For some types of expressions (enum, name), this stores the actual
3093 * name (in the value.s field). Resources for this are held by the database.
3094 * Don't attempt to free the string or anything like that.
3095 *
3096 * @ingroup Eolian
3097 */
3098 EAPI Eolian_Value eolian_expression_value_get(const Eolian_Expression *expr);
3099
3100 /*
3101 * @brief Get the value of an expression into an out-param.
3102 *
3103 * @param[in] expr the expression.
3104 * @param[out] val the value to fill.
3105 * @return EINA_TRUE on success, EINA_FALSE on failure
3106 *
3107 * This is like eolian_expression_value_get, but it fills an out-param. On
3108 * failure, nothing is guaranteed to be filled.
3109 *
3110 * @since 1.25
3111 *
3112 * @ingroup Eolian
3113 */
3114 EAPI Eina_Bool eolian_expression_value_get_fill(const Eolian_Expression *expr, Eolian_Value *val);
3115
3116 /*
3117 * @brief Get the documentation of a constant.
3118 *
3119 * @param[in] var the constant.
3120 * @return the documentation or NULL.
3121 *
3122 * @ingroup Eolian
3123 */
3124 EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var);
3125
3126 /*
3127 * @brief Get the base type of a constant.
3128 *
3129 * @param[in] var the constant.
3130 * @return the base type or NULL.
3131 *
3132 * @ingroup Eolian
3133 */
3134 EAPI const Eolian_Type *eolian_constant_type_get(const Eolian_Constant *var);
3135
3136 /*
3137 * @brief Get the value of a constant.
3138 *
3139 * @param[in] var the constant.
3140 * @return the value or NULL.
3141 *
3142 * @ingroup Eolian
3143 */
3144 EAPI const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var);
3145
3146 /*
3147 * @brief A helper function to get the full name of a constant.
3148 *
3149 * @see eolian_object_name_get
3150 *
3151 * @ingroup Eolian
3152 */
3153 static inline const char *
eolian_constant_name_get(const Eolian_Constant * tp)3154 eolian_constant_name_get(const Eolian_Constant *tp)
3155 {
3156 return eolian_object_name_get(EOLIAN_OBJECT(tp));
3157 }
3158
3159 /*
3160 * @brief A helper function to get the C name of a constant.
3161 *
3162 * @see eolian_object_c_name_get
3163 *
3164 * @ingroup Eolian
3165 */
3166 static inline const char *
eolian_constant_c_name_get(const Eolian_Constant * tp)3167 eolian_constant_c_name_get(const Eolian_Constant *tp)
3168 {
3169 return eolian_object_c_name_get(EOLIAN_OBJECT(tp));
3170 }
3171
3172 /*
3173 * @brief A helper function to get the short name of a constant.
3174 *
3175 * @see eolian_object_short_name_get
3176 *
3177 * @ingroup Eolian
3178 */
3179 static inline const char *
eolian_constant_short_name_get(const Eolian_Constant * tp)3180 eolian_constant_short_name_get(const Eolian_Constant *tp)
3181 {
3182 return eolian_object_short_name_get(EOLIAN_OBJECT(tp));
3183 }
3184
3185 /*
3186 * @brief A helper function to get the namespaces of a constant.
3187 *
3188 * @see eolian_object_namespaces_get
3189 *
3190 * @ingroup Eolian
3191 */
3192 static inline Eina_Iterator *
eolian_constant_namespaces_get(const Eolian_Constant * tp)3193 eolian_constant_namespaces_get(const Eolian_Constant *tp)
3194 {
3195 return eolian_object_namespaces_get(EOLIAN_OBJECT(tp));
3196 }
3197
3198 /*
3199 * @brief Check if a constant is extern.
3200 *
3201 * @param[in] var the constant.
3202 * @return EINA_TRUE if it's extern, EINA_FALSE otherwise.
3203 *
3204 * @ingroup Eolian
3205 */
3206 EAPI Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var);
3207
3208 /*
3209 * @brief Get whether a constant is beta.
3210 *
3211 * @see eolian_object_is_beta
3212 *
3213 * @ingroup Eolian
3214 */
3215 static inline Eina_Bool
eolian_constant_is_beta(const Eolian_Constant * var)3216 eolian_constant_is_beta(const Eolian_Constant *var)
3217 {
3218 return eolian_object_is_beta(EOLIAN_OBJECT(var));
3219 }
3220
3221 /*
3222 * @brief Get the message of an error declaration.
3223 *
3224 * @param[in] err the error.
3225 * @return the message or NULL.
3226 *
3227 * @ingroup Eolian
3228 */
3229 EAPI const char *eolian_error_message_get(const Eolian_Error *err);
3230
3231 /*
3232 * @brief Get the documentation of an error declaration.
3233 *
3234 * @param[in] err the error declaration.
3235 * @return the documentation or NULL.
3236 *
3237 * @ingroup Eolian
3238 */
3239 EAPI const Eolian_Documentation *eolian_error_documentation_get(const Eolian_Error *err);
3240
3241 /*
3242 * @brief A helper function to get the full name of an error declaration.
3243 *
3244 * @see eolian_object_name_get
3245 *
3246 * @ingroup Eolian
3247 */
3248 static inline const char *
eolian_error_name_get(const Eolian_Error * err)3249 eolian_error_name_get(const Eolian_Error *err)
3250 {
3251 return eolian_object_name_get(EOLIAN_OBJECT(err));
3252 }
3253
3254 /*
3255 * @brief A helper function to get the C name of an error declaration.
3256 *
3257 * @see eolian_object_c_name_get
3258 *
3259 * @ingroup Eolian
3260 */
3261 static inline const char *
eolian_error_c_name_get(const Eolian_Error * err)3262 eolian_error_c_name_get(const Eolian_Error *err)
3263 {
3264 return eolian_object_c_name_get(EOLIAN_OBJECT(err));
3265 }
3266
3267 /*
3268 * @brief A helper function to get the short name of an error declaration.
3269 *
3270 * @see eolian_object_short_name_get
3271 *
3272 * @ingroup Eolian
3273 */
3274 static inline const char *
eolian_error_short_name_get(const Eolian_Error * err)3275 eolian_error_short_name_get(const Eolian_Error *err)
3276 {
3277 return eolian_object_short_name_get(EOLIAN_OBJECT(err));
3278 }
3279
3280 /*
3281 * @brief A helper function to get the namespaces of an error declaration.
3282 *
3283 * @see eolian_object_namespaces_get
3284 *
3285 * @ingroup Eolian
3286 */
3287 static inline Eina_Iterator *
eolian_error_namespaces_get(const Eolian_Error * err)3288 eolian_error_namespaces_get(const Eolian_Error *err)
3289 {
3290 return eolian_object_namespaces_get(EOLIAN_OBJECT(err));
3291 }
3292
3293 /*
3294 * @brief Get whether an error declaration is beta.
3295 *
3296 * @see eolian_object_is_beta
3297 *
3298 * @ingroup Eolian
3299 */
3300 static inline Eina_Bool
eolian_error_is_beta(const Eolian_Error * err)3301 eolian_error_is_beta(const Eolian_Error *err)
3302 {
3303 return eolian_object_is_beta(EOLIAN_OBJECT(err));
3304 }
3305
3306 /*
3307 * @brief Check if an error declaration is extern.
3308 *
3309 * @param[in] err the errpr decůaratopm.
3310 * @return EINA_TRUE if it's extern, EINA_FALSE otherwise.
3311 *
3312 * @ingroup Eolian
3313 */
3314 EAPI Eina_Bool eolian_error_is_extern(const Eolian_Error *err);
3315
3316 /*
3317 * @brief Get the summary of the documentation.
3318 *
3319 * This should never return NULL unless the input is invalid.
3320 *
3321 * @param[in] doc the documentation
3322 * @return the summary or NULL
3323 *
3324 * @ingroup Eolian
3325 */
3326 EAPI const char *eolian_documentation_summary_get(const Eolian_Documentation *doc);
3327
3328 /*
3329 * @brief Get the description of the documentation.
3330 *
3331 * This can return NULL if the description wasn't specified or
3332 * if the input is wrong.
3333 *
3334 * @param[in] doc the documentation
3335 * @return the description or NULL
3336 *
3337 * @ingroup Eolian
3338 */
3339 EAPI const char *eolian_documentation_description_get(const Eolian_Documentation *doc);
3340
3341 /*
3342 * @brief Get the "since" tag of the documentation.
3343 *
3344 * This can return NULL if the tag wasn't specified or
3345 * if the input is wrong.
3346 *
3347 * @param[in] doc the documentation
3348 * @return the description or NULL
3349 *
3350 * @ingroup Eolian
3351 */
3352 EAPI const char *eolian_documentation_since_get(const Eolian_Documentation *doc);
3353
3354 /*
3355 * @brief Split a documentation string into individual paragraphs.
3356 *
3357 * The items of the resulting list are strings that are fred with free().
3358 *
3359 * @param[in] doc the documentation string
3360 * @return a list of allocated strings containing paragraphs
3361 *
3362 * @ingroup Eolian
3363 */
3364 EAPI Eina_List *eolian_documentation_string_split(const char *doc);
3365
3366 /*
3367 * @brief Tokenize a documentation paragraph.
3368 *
3369 * This gradually splits the string into pieces (text, references, paragraph
3370 * separators etc.) so that it can be more easily turned into a representation
3371 * you want. On failure, token is initialized with EOLIAN_DOC_TOKEN_UNKNOWN.
3372 *
3373 * The function never allocates any memory and doesn't hold any state, instead
3374 * the returned continuation has to be passed as first param on next iteration
3375 * and you have to make sure the input data stays valid until you're completely
3376 * done.
3377 *
3378 * The input string is assumed to be a single paragraph with all unnecessary
3379 * whitespace already trimmed.
3380 *
3381 * If the given token is NULL, it will still tokenize, but without saving anything.
3382 *
3383 * @param[in] doc the documentation string
3384 * @param[out] ret the token
3385 * @return a continuation of the input string
3386 *
3387 * @ingroup Eolian
3388 */
3389 EAPI const char *eolian_documentation_tokenize(const char *doc, Eolian_Doc_Token *ret);
3390
3391 /*
3392 * @brief Initialize a documentation token into an empty state.
3393 *
3394 * @param[in] tok the token
3395 * @return the token type
3396 */
3397 EAPI void eolian_doc_token_init(Eolian_Doc_Token *tok);
3398
3399 /*
3400 * @brief Get the type of a documentation token.
3401 *
3402 * @param[in] tok the token
3403 * @return the token type
3404 */
3405 EAPI Eolian_Doc_Token_Type eolian_doc_token_type_get(const Eolian_Doc_Token *tok);
3406
3407 /*
3408 * @brief Get the text of a documentation token.
3409 *
3410 * Works on every token type, but for unknown tokens it returns NULL.
3411 * You need to free the text once you're done using normal free().
3412 * This makes sure all escapes in the original doc comments are properly
3413 * removed so you can use the string as-is.
3414 *
3415 * @param[in] tok the token
3416 * @return the token text
3417 */
3418 EAPI char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok);
3419
3420 /*
3421 * @brief Get the thing that a reference token references.
3422 *
3423 * Returns EOLIAN_OBJECT_UNKNOWN on failure (when not ref token or
3424 * invalid ref, but invalid refs don't happen when database is valid).
3425 *
3426 * When the reference is a class, alias, struct, enum or var, the first data arg
3427 * is filled. When it's a func, the first data is class and second data is
3428 * the respective Eolian_Implement, when it's an event the first data is class
3429 * and the second data is the event, when it's a struct field or enum field
3430 * the first data is is the struct/enum and the second data is the field.
3431 *
3432 * @param[in] tok the token
3433 * @param[in] state the state to look in
3434 * @param[out] data the primary data
3435 * @param[out] data2 the secondary data
3436 * @return the kind of reference this is
3437 */
3438 EAPI Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2);
3439
3440 #ifdef EFL_BETA_API_SUPPORT
3441
3442 /*
3443 * @brief Get the legacy prefix of enum field names. When not specified,
3444 * enum name is used. (BETA)
3445 *
3446 * @param[in] tp the type declaration.
3447 * @return the legacy prefix or NULL.
3448 *
3449 * @ingroup Eolian
3450 */
3451 EAPI const char *eolian_typedecl_enum_legacy_prefix_get(const Eolian_Typedecl *tp);
3452
3453 /*
3454 * @brief Get whether the given type is a reference.
3455 *
3456 * @param[in] tp the type.
3457 * @return EINA_TRUE when the type is marked ref, EINA_FALSE otherwise.
3458 *
3459 * @ingroup Eolian
3460 */
3461 EAPI Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
3462
3463 #endif /* EFL_BETA_API_SUPPORT */
3464
3465 /**
3466 * @}
3467 */
3468
3469 #ifdef __cplusplus
3470 } // extern "C" {
3471 #endif
3472
3473 #undef EAPI
3474 #define EAPI
3475
3476 #endif
3477