summaryrefslogtreecommitdiff
path: root/src/lib/eolian/Eolian_Aux.h
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2018-11-04 18:56:54 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2018-11-29 13:56:52 +0100
commitbe7d76ece63844f1967ee12d042c920a8540ab4a (patch)
tree847f01a585bf940592d3556926cd25b66286e627 /src/lib/eolian/Eolian_Aux.h
parente93dbf21a26ea05118db1896025f7ad19e603813 (diff)
eolian_aux: add initial eolian_aux APIs
eolian_aux is a set of auxiliary APIs for eolian that build on top of the existing eolian APIs but do not belong in the main library.
Diffstat (limited to 'src/lib/eolian/Eolian_Aux.h')
-rw-r--r--src/lib/eolian/Eolian_Aux.h180
1 files changed, 180 insertions, 0 deletions
diff --git a/src/lib/eolian/Eolian_Aux.h b/src/lib/eolian/Eolian_Aux.h
new file mode 100644
index 0000000..4313d49
--- /dev/null
+++ b/src/lib/eolian/Eolian_Aux.h
@@ -0,0 +1,180 @@
1#ifndef EOLIAN_AUX_H
2#define EOLIAN_AUX_H
3
4#include <Eolian.h>
5
6#ifdef EAPI
7# undef EAPI
8#endif
9
10#ifdef _WIN32
11# ifdef EFL_BUILD
12# ifdef DLL_EXPORT
13# define EAPI __declspec(dllexport)
14# else
15# define EAPI
16# endif
17# else
18# define EAPI __declspec(dllimport)
19# endif
20#else
21# ifdef __GNUC__
22# if __GNUC__ >= 4
23# define EAPI __attribute__ ((visibility("default")))
24# else
25# define EAPI
26# endif
27# else
28# define EAPI
29# endif
30#endif
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/**
37 * @page eolian_aux_main Eolian Auxiliary Library (BETA)
38 *
39 * @date 2018 (created)
40 *
41 * @section toc Table of Contents
42 *
43 * @li @ref eolian_aux_main_intro
44 *
45 * @section eolian_main_intro Introduction
46 *
47 * This is the Eolian auxiliary library, providing API to support generators
48 * and other utilities which do not fit into the primary Eolian library. All
49 * these APIs are built on top of the core Eolian APIs.
50 *
51 * Recommended reading:
52 *
53 * @li @ref Eolian
54 *
55 * @addtogroup Eolian
56 * @{
57 */
58
59#ifdef EFL_BETA_API_SUPPORT
60
61/**
62 * @brief Build reverse children hierarchy of an Eolian state.
63 *
64 * The point of this is basically to figure out reverse inheritance. The
65 * keys of the returned hash will be class pointers and the values will
66 * be lists. If classes A and B both inherit from C, they will be in C's
67 * list after lookup.
68 *
69 * You are responsible for freeing this hash using standard eina_hash_free().
70 *
71 * @param[in] state the Eolian state.
72 * @return a hash containing the hierarchy.
73 *
74 * @ingroup Eolian
75 */
76EAPI Eina_Hash *eolian_aux_state_class_children_find(const Eolian_State *state);
77
78/**
79 * @brief Get all APIs that are usable on the class.
80 *
81 * The @p funcs parameter will contain the functions, while @p events will
82 * contain events. The initial items in the lists will be the funcs and
83 * events defined by the class itself, followed by those defined in the
84 * classes it inherits from.
85 *
86 * Funcs will contain implement pointers, events will contain event pointers.
87 *
88 * The @p ownfuncs param defines how many of the list's items are the classes'
89 * own API. Same happens with @p ownevs for events.
90 *
91 * You are responsible for freeing the returned lists but not their contents.
92 * If you want to skip either of the lists, pass NULL.
93 *
94 * @param[in] klass the class.
95 * @param[out] funcs the functions list reference, NULL if not used.
96 * @param[out] events the event list reference, NULL if not used.
97 * @param[out] ownfuncs the number of own functions, NULL if not used.
98 * @param[out] ownevs the number of own events, NULL if not used.
99 * @return the total number of items written into either list.
100 *
101 * @ingroup Eolian
102 */
103EAPI size_t eolian_aux_class_callables_get(const Eolian_Class *klass, Eina_List **funcs, Eina_List **events, size_t *ownfuncs, size_t *ownevs);
104
105/**
106 * @brief Get all implementations of a function in a state.
107 *
108 * Given a function and a childen hierarchy from
109 * eolian_aux_state_class_children_find(), this will func
110 * all implementations of that function in the system. This
111 * is useful for various utilities. You need to free the list
112 * but not the contents.
113 *
114 * @param[in] func the function.
115 * @param[in] class_children the children hierarchy.
116 * @return a list of implementations.
117 *
118 * @ingroup Eolian
119 */
120EAPI Eina_List *eolian_aux_function_all_implements_get(const Eolian_Function *func, Eina_Hash *class_children);
121
122/**
123 * @brief Get previous implementation in the inheritance hierarchy.
124 *
125 * This performs a depth-first search in the hierarchy, starting with the
126 * specific given implementation. Once it is found, this parent implementation
127 * is returned.
128 *
129 * @param[in] impl the implementation.
130 * @return the parent implementation.
131 *
132 * @ingroup Eolian
133 */
134EAPI const Eolian_Implement *eolian_aux_implement_parent_get(const Eolian_Implement *impl);
135
136/**
137 * @brief Get documentation for an implementaiton.
138 *
139 * This first checks if the implementation has documentation for the given
140 * type. If so, it is returned; if not, parent implementations as specified
141 * in eolian_aux_implement_parent_get() are searched and the first one to
142 * have the documentation is used.
143 *
144 * @param[in] impl the implementation.
145 * @param[in] ftype the function type (method, property, getter, setter).
146 * @return the documentation or NULL.
147 *
148 * @ingroup Eolian
149 */
150EAPI const Eolian_Documentation *eolian_aux_implement_documentation_get(const Eolian_Implement *impl, Eolian_Function_Type ftype);
151
152/**
153 * @brief Get documentation fallback for an implementation.
154 *
155 * This is used when the implement does not have a "common" documentation
156 * block. If the given implement is a getter and not a setter, this returns
157 * the getter's documentation. If it's a setter but not a getter, it returns
158 * the setter documentation. Otherwise, it returns NULL.
159 *
160 * @param[in] impl the implementation.
161 * @return the documentation or NULL.
162 *
163 * @ingroup Eolian
164 */
165EAPI const Eolian_Documentation *eolian_aux_implement_documentation_fallback_get(const Eolian_Implement *impl);
166
167#endif
168
169/**
170 * @}
171 */
172
173#ifdef __cplusplus
174} // extern "C" {
175#endif
176
177#undef EAPI
178#define EAPI
179
180#endif