diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2018-03-12 16:03:37 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2018-03-12 16:03:37 +0100 |
commit | edcd81ee493d2db1dac8459c1a772b73ad722ff8 (patch) | |
tree | 97ce30736f214b93a3f0b2acabba65edbd660ad8 /src | |
parent | 3840aa453c6d24acaab5f25879ff20c7d50da3d3 (diff) |
eolian: update class name APIs
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/eolian/docs.c | 2 | ||||
-rw-r--r-- | src/bin/eolian/headers.c | 4 | ||||
-rw-r--r-- | src/bin/eolian/main.c | 2 | ||||
-rw-r--r-- | src/bin/eolian/sources.c | 2 | ||||
-rw-r--r-- | src/bin/eolian/types.c | 2 | ||||
-rw-r--r-- | src/bin/eolian_cxx/eolian_cxx.cc | 2 | ||||
-rw-r--r-- | src/bin/eolian_js/eolian/class.hh | 6 | ||||
-rw-r--r-- | src/bin/eolian_js/main.cc | 4 | ||||
-rw-r--r-- | src/lib/eolian/Eolian.h | 26 | ||||
-rw-r--r-- | src/lib/eolian/database_class_api.c | 18 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/klass_def.hpp | 4 | ||||
-rw-r--r-- | src/tests/eolian/eolian_parsing.c | 10 |
12 files changed, 42 insertions, 40 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c index a9ede0d82b..0a7c6cd99e 100644 --- a/src/bin/eolian/docs.c +++ b/src/bin/eolian/docs.c | |||
@@ -420,7 +420,7 @@ eo_gen_docs_func_gen(const Eolian_Unit *src, const Eolian_Function *fid, | |||
420 | 420 | ||
421 | int curl = 0; | 421 | int curl = 0; |
422 | 422 | ||
423 | const char *group = eolian_class_full_name_get(eolian_function_class_get(fid)); | 423 | const char *group = eolian_class_name_get(eolian_function_class_get(fid)); |
424 | 424 | ||
425 | const Eolian_Implement *fimp = eolian_function_implement_get(fid); | 425 | const Eolian_Implement *fimp = eolian_function_implement_get(fid); |
426 | 426 | ||
diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c index 319dffd50c..db6ea537a7 100644 --- a/src/bin/eolian/headers.c +++ b/src/bin/eolian/headers.c | |||
@@ -198,7 +198,7 @@ eo_gen_header_gen(const Eolian_Unit *src, const Eolian_Class *cl, | |||
198 | if (doc) | 198 | if (doc) |
199 | { | 199 | { |
200 | Eina_Strbuf *cdoc = eo_gen_docs_full_gen(src, doc, | 200 | Eina_Strbuf *cdoc = eo_gen_docs_full_gen(src, doc, |
201 | eolian_class_full_name_get(cl), 0, EINA_FALSE); | 201 | eolian_class_name_get(cl), 0, EINA_FALSE); |
202 | if (cdoc) | 202 | if (cdoc) |
203 | { | 203 | { |
204 | eina_strbuf_append(buf, eina_strbuf_string_get(cdoc)); | 204 | eina_strbuf_append(buf, eina_strbuf_string_get(cdoc)); |
@@ -283,7 +283,7 @@ events: | |||
283 | "Efl_Event_Description _%s;\n\n", evn); | 283 | "Efl_Event_Description _%s;\n\n", evn); |
284 | 284 | ||
285 | Eina_Strbuf *evdbuf = eo_gen_docs_event_gen(src, ev, | 285 | Eina_Strbuf *evdbuf = eo_gen_docs_event_gen(src, ev, |
286 | eolian_class_full_name_get(cl)); | 286 | eolian_class_name_get(cl)); |
287 | eina_strbuf_append(buf, eina_strbuf_string_get(evdbuf)); | 287 | eina_strbuf_append(buf, eina_strbuf_string_get(evdbuf)); |
288 | eina_strbuf_append_char(buf, '\n'); | 288 | eina_strbuf_append_char(buf, '\n'); |
289 | eina_strbuf_free(evdbuf); | 289 | eina_strbuf_free(evdbuf); |
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 67fff4f146..09fd0a4b02 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c | |||
@@ -282,7 +282,7 @@ void eo_gen_class_names_get(const Eolian_Class *cl, char **cname, | |||
282 | char **cnameu, char **cnamel) | 282 | char **cnameu, char **cnamel) |
283 | { | 283 | { |
284 | char *cn = NULL, *cnu = NULL, *cnl = NULL; | 284 | char *cn = NULL, *cnu = NULL, *cnl = NULL; |
285 | cn = eo_gen_c_full_name_get(eolian_class_full_name_get(cl)); | 285 | cn = eo_gen_c_full_name_get(eolian_class_name_get(cl)); |
286 | if (!cn) | 286 | if (!cn) |
287 | abort(); | 287 | abort(); |
288 | if (cname) | 288 | if (cname) |
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c index d590ae5812..028bca753c 100644 --- a/src/bin/eolian/sources.c +++ b/src/bin/eolian/sources.c | |||
@@ -937,7 +937,7 @@ eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf) | |||
937 | eina_strbuf_append(buf, cnamel); | 937 | eina_strbuf_append(buf, cnamel); |
938 | eina_strbuf_append(buf, "_class_desc = {\n" | 938 | eina_strbuf_append(buf, "_class_desc = {\n" |
939 | " EO_VERSION,\n"); | 939 | " EO_VERSION,\n"); |
940 | eina_strbuf_append_printf(buf, " \"%s\",\n", eolian_class_full_name_get(cl)); | 940 | eina_strbuf_append_printf(buf, " \"%s\",\n", eolian_class_name_get(cl)); |
941 | 941 | ||
942 | switch (eolian_class_type_get(cl)) | 942 | switch (eolian_class_type_get(cl)) |
943 | { | 943 | { |
diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c index 924c5515fc..de7d56bf36 100644 --- a/src/bin/eolian/types.c +++ b/src/bin/eolian/types.c | |||
@@ -311,7 +311,7 @@ Eina_Strbuf *eo_gen_class_typedef_gen(const Eolian_State *eos, const char *eof) | |||
311 | const Eolian_Class *cl = eolian_state_class_by_file_get(eos, eof); | 311 | const Eolian_Class *cl = eolian_state_class_by_file_get(eos, eof); |
312 | if (!cl) | 312 | if (!cl) |
313 | return NULL; | 313 | return NULL; |
314 | char *clfn = eo_gen_c_full_name_get(eolian_class_full_name_get(cl)); | 314 | char *clfn = eo_gen_c_full_name_get(eolian_class_name_get(cl)); |
315 | if (!clfn) | 315 | if (!clfn) |
316 | return NULL; | 316 | return NULL; |
317 | Eina_Strbuf *ret = eina_strbuf_new(); | 317 | Eina_Strbuf *ret = eina_strbuf_new(); |
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc index 13bb0da874..6b4b5cc0fb 100644 --- a/src/bin/eolian_cxx/eolian_cxx.cc +++ b/src/bin/eolian_cxx/eolian_cxx.cc | |||
@@ -288,7 +288,7 @@ run(options_type const& opts) | |||
288 | !generate(klass, opts, cpp_types_header)) | 288 | !generate(klass, opts, cpp_types_header)) |
289 | { | 289 | { |
290 | EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) | 290 | EINA_CXX_DOM_LOG_ERR(eolian_cxx::domain) |
291 | << "Error generating: " << ::eolian_class_name_get(klass) | 291 | << "Error generating: " << ::eolian_class_short_name_get(klass) |
292 | << std::endl; | 292 | << std::endl; |
293 | assert(false && "error generating class"); | 293 | assert(false && "error generating class"); |
294 | } | 294 | } |
diff --git a/src/bin/eolian_js/eolian/class.hh b/src/bin/eolian_js/eolian/class.hh index 633d6c4e72..1a0597cd0f 100644 --- a/src/bin/eolian_js/eolian/class.hh +++ b/src/bin/eolian_js/eolian/class.hh | |||
@@ -10,12 +10,12 @@ | |||
10 | 10 | ||
11 | inline std::string name(Eolian_Class const* klass) | 11 | inline std::string name(Eolian_Class const* klass) |
12 | { | 12 | { |
13 | return ::eolian_class_name_get(klass); | 13 | return ::eolian_class_short_name_get(klass); |
14 | } | 14 | } |
15 | 15 | ||
16 | inline std::string full_name(Eolian_Class const* klass) | 16 | inline std::string full_name(Eolian_Class const* klass) |
17 | { | 17 | { |
18 | return ::eolian_class_full_name_get(klass); | 18 | return ::eolian_class_name_get(klass); |
19 | } | 19 | } |
20 | 20 | ||
21 | inline std::string full_name_transformed(Eolian_Class const* klass) | 21 | inline std::string full_name_transformed(Eolian_Class const* klass) |
@@ -47,7 +47,7 @@ inline std::string type_class_name(Eolian_Type const* tp) | |||
47 | Eolian_Class const* klass = ::eolian_type_class_get(tp); | 47 | Eolian_Class const* klass = ::eolian_type_class_get(tp); |
48 | if (klass) | 48 | if (klass) |
49 | { | 49 | { |
50 | Eina_Stringshare* klass_name = ::eolian_class_full_name_get(klass); | 50 | Eina_Stringshare* klass_name = ::eolian_class_name_get(klass); |
51 | if (!klass_name) | 51 | if (!klass_name) |
52 | throw std::runtime_error("Could not get Eo class name"); | 52 | throw std::runtime_error("Could not get Eo class name"); |
53 | 53 | ||
diff --git a/src/bin/eolian_js/main.cc b/src/bin/eolian_js/main.cc index 7a474c1e87..9ac5195483 100644 --- a/src/bin/eolian_js/main.cc +++ b/src/bin/eolian_js/main.cc | |||
@@ -325,7 +325,7 @@ bool | |||
325 | _function_belongs_to(const Eolian_Function *function, std::string klass) | 325 | _function_belongs_to(const Eolian_Function *function, std::string klass) |
326 | { | 326 | { |
327 | const Eolian_Class *cl = eolian_function_class_get(function); | 327 | const Eolian_Class *cl = eolian_function_class_get(function); |
328 | const std::string name = cl ? eolian_class_full_name_get(cl) : ""; | 328 | const std::string name = cl ? eolian_class_name_get(cl) : ""; |
329 | return name.find(klass) == 0; | 329 | return name.find(klass) == 0; |
330 | } | 330 | } |
331 | 331 | ||
@@ -1015,7 +1015,7 @@ int main(int argc, char** argv) | |||
1015 | else | 1015 | else |
1016 | { | 1016 | { |
1017 | EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Duplicate member function found in class: " << | 1017 | EINA_CXX_DOM_LOG_ERR(eolian::js::domain) << "Duplicate member function found in class: " << |
1018 | eolian_class_full_name_get(klass) << ": '" << member_name << "'"; | 1018 | eolian_class_name_get(klass) << ": '" << member_name << "'"; |
1019 | } | 1019 | } |
1020 | } | 1020 | } |
1021 | catch(eolian::js::incomplete_complex_type_error const& e) | 1021 | catch(eolian::js::incomplete_complex_type_error const& e) |
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 0faa901cf6..6932909b6c 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h | |||
@@ -191,6 +191,14 @@ typedef struct _Eolian_Documentation Eolian_Documentation; | |||
191 | */ | 191 | */ |
192 | typedef struct _Eolian_Unit Eolian_Unit; | 192 | typedef struct _Eolian_Unit Eolian_Unit; |
193 | 193 | ||
194 | #ifdef __cplusplus | ||
195 | #define EOLIAN_CAST(type, expr) reinterpret_cast<const type *>(expr) | ||
196 | #else | ||
197 | #define EOLIAN_CAST(type, expr) ((const type *)expr) | ||
198 | #endif | ||
199 | |||
200 | #define EOLIAN_OBJECT(expr) EOLIAN_CAST(Eolian_Object, expr) | ||
201 | |||
194 | typedef enum | 202 | typedef enum |
195 | { | 203 | { |
196 | EOLIAN_OBJECT_UNKNOWN = 0, | 204 | EOLIAN_OBJECT_UNKNOWN = 0, |
@@ -1182,7 +1190,11 @@ EAPI Eina_Iterator *eolian_unit_enums_get(const Eolian_Unit *unit); | |||
1182 | * | 1190 | * |
1183 | * @ingroup Eolian | 1191 | * @ingroup Eolian |
1184 | */ | 1192 | */ |
1185 | EAPI Eina_Stringshare *eolian_class_full_name_get(const Eolian_Class *klass); | 1193 | static inline const char * |
1194 | eolian_class_name_get(const Eolian_Class *klass) | ||
1195 | { | ||
1196 | return eolian_object_name_get(EOLIAN_OBJECT(klass)); | ||
1197 | } | ||
1186 | 1198 | ||
1187 | /* | 1199 | /* |
1188 | * @brief Returns the name of the given class. | 1200 | * @brief Returns the name of the given class. |
@@ -1192,7 +1204,11 @@ EAPI Eina_Stringshare *eolian_class_full_name_get(const Eolian_Class *klass); | |||
1192 | * | 1204 | * |
1193 | * @ingroup Eolian | 1205 | * @ingroup Eolian |
1194 | */ | 1206 | */ |
1195 | EAPI Eina_Stringshare *eolian_class_name_get(const Eolian_Class *klass); | 1207 | static inline const char * |
1208 | eolian_class_short_name_get(const Eolian_Class *klass) | ||
1209 | { | ||
1210 | return eolian_object_short_name_get(EOLIAN_OBJECT(klass)); | ||
1211 | } | ||
1196 | 1212 | ||
1197 | /* | 1213 | /* |
1198 | * @brief Returns an iterator to the namespaces of the given class. | 1214 | * @brief Returns an iterator to the namespaces of the given class. |
@@ -1202,7 +1218,11 @@ EAPI Eina_Stringshare *eolian_class_name_get(const Eolian_Class *klass); | |||
1202 | * | 1218 | * |
1203 | * @ingroup Eolian | 1219 | * @ingroup Eolian |
1204 | */ | 1220 | */ |
1205 | EAPI Eina_Iterator *eolian_class_namespaces_get(const Eolian_Class *klass); | 1221 | static inline Eina_Iterator * |
1222 | eolian_class_namespaces_get(const Eolian_Class *klass) | ||
1223 | { | ||
1224 | return eolian_object_namespaces_get(EOLIAN_OBJECT(klass)); | ||
1225 | } | ||
1206 | 1226 | ||
1207 | /* | 1227 | /* |
1208 | * @brief Returns the class type of the given class | 1228 | * @brief Returns the class type of the given class |
diff --git a/src/lib/eolian/database_class_api.c b/src/lib/eolian/database_class_api.c index dd01dc4e72..f21c3bcdaf 100644 --- a/src/lib/eolian/database_class_api.c +++ b/src/lib/eolian/database_class_api.c | |||
@@ -6,24 +6,6 @@ | |||
6 | #include "eolian_database.h" | 6 | #include "eolian_database.h" |
7 | #include "eolian_priv.h" | 7 | #include "eolian_priv.h" |
8 | 8 | ||
9 | EAPI Eina_Stringshare * | ||
10 | eolian_class_full_name_get(const Eolian_Class *cl) | ||
11 | { | ||
12 | return cl ? cl->base.name : NULL; | ||
13 | } | ||
14 | |||
15 | EAPI Eina_Stringshare * | ||
16 | eolian_class_name_get(const Eolian_Class *cl) | ||
17 | { | ||
18 | return eolian_object_short_name_get((const Eolian_Object *)cl); | ||
19 | } | ||
20 | |||
21 | EAPI Eina_Iterator * | ||
22 | eolian_class_namespaces_get(const Eolian_Class *cl) | ||
23 | { | ||
24 | return eolian_object_namespaces_get((const Eolian_Object *)cl); | ||
25 | } | ||
26 | |||
27 | EAPI Eolian_Class_Type | 9 | EAPI Eolian_Class_Type |
28 | eolian_class_type_get(const Eolian_Class *cl) | 10 | eolian_class_type_get(const Eolian_Class *cl) |
29 | { | 11 | { |
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index 35c3709f00..11af82cd29 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp | |||
@@ -115,7 +115,7 @@ struct klass_name | |||
115 | : namespaces(namespaces), eolian_name(eolian_name), base_qualifier(base_qualifier) | 115 | : namespaces(namespaces), eolian_name(eolian_name), base_qualifier(base_qualifier) |
116 | , type(type) {} | 116 | , type(type) {} |
117 | klass_name(Eolian_Class const* klass, qualifier_def base_qualifier) | 117 | klass_name(Eolian_Class const* klass, qualifier_def base_qualifier) |
118 | : eolian_name( ::eolian_class_name_get(klass)) | 118 | : eolian_name( ::eolian_class_short_name_get(klass)) |
119 | , base_qualifier(base_qualifier) | 119 | , base_qualifier(base_qualifier) |
120 | { | 120 | { |
121 | for(efl::eina::iterator<const char> namespace_iterator ( ::eolian_class_namespaces_get(klass)) | 121 | for(efl::eina::iterator<const char> namespace_iterator ( ::eolian_class_namespaces_get(klass)) |
@@ -940,7 +940,7 @@ struct klass_def | |||
940 | { | 940 | { |
941 | this->namespaces.push_back(&*namespace_iterator); | 941 | this->namespaces.push_back(&*namespace_iterator); |
942 | } | 942 | } |
943 | cxx_name = eolian_name = eolian_class_name_get(klass); | 943 | cxx_name = eolian_name = eolian_class_short_name_get(klass); |
944 | filename = eolian_object_file_get((const Eolian_Object *)klass); | 944 | filename = eolian_object_file_get((const Eolian_Object *)klass); |
945 | for(efl::eina::iterator<Eolian_Function const> eolian_functions ( ::eolian_class_functions_get(klass, EOLIAN_PROPERTY)) | 945 | for(efl::eina::iterator<Eolian_Function const> eolian_functions ( ::eolian_class_functions_get(klass, EOLIAN_PROPERTY)) |
946 | , functions_last; eolian_functions != functions_last; ++eolian_functions) | 946 | , functions_last; eolian_functions != functions_last; ++eolian_functions) |
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index f333a84b34..4664361267 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c | |||
@@ -35,14 +35,14 @@ START_TEST(eolian_namespaces) | |||
35 | fail_if(!(class_no = eolian_unit_class_by_name_get(unit, "no_nmsp"))); | 35 | fail_if(!(class_no = eolian_unit_class_by_name_get(unit, "no_nmsp"))); |
36 | 36 | ||
37 | /* Check names and namespaces*/ | 37 | /* Check names and namespaces*/ |
38 | fail_if(strcmp(eolian_class_name_get(class11), "class1")); | 38 | fail_if(strcmp(eolian_class_short_name_get(class11), "class1")); |
39 | fail_if(!(iter = eolian_class_namespaces_get(class11))); | 39 | fail_if(!(iter = eolian_class_namespaces_get(class11))); |
40 | fail_if(!(eina_iterator_next(iter, (void**)&val1))); | 40 | fail_if(!(eina_iterator_next(iter, (void**)&val1))); |
41 | fail_if(eina_iterator_next(iter, &dummy)); | 41 | fail_if(eina_iterator_next(iter, &dummy)); |
42 | fail_if(strcmp(val1, "nmsp1")); | 42 | fail_if(strcmp(val1, "nmsp1")); |
43 | eina_iterator_free(iter); | 43 | eina_iterator_free(iter); |
44 | 44 | ||
45 | fail_if(strcmp(eolian_class_name_get(class112), "class2")); | 45 | fail_if(strcmp(eolian_class_short_name_get(class112), "class2")); |
46 | fail_if(!(iter = eolian_class_namespaces_get(class112))); | 46 | fail_if(!(iter = eolian_class_namespaces_get(class112))); |
47 | fail_if(!(eina_iterator_next(iter, (void**)&val1))); | 47 | fail_if(!(eina_iterator_next(iter, (void**)&val1))); |
48 | fail_if(!(eina_iterator_next(iter, (void**)&val2))); | 48 | fail_if(!(eina_iterator_next(iter, (void**)&val2))); |
@@ -51,14 +51,14 @@ START_TEST(eolian_namespaces) | |||
51 | fail_if(strcmp(val2, "nmsp11")); | 51 | fail_if(strcmp(val2, "nmsp11")); |
52 | eina_iterator_free(iter); | 52 | eina_iterator_free(iter); |
53 | 53 | ||
54 | fail_if(strcmp(eolian_class_name_get(class21), "class1")); | 54 | fail_if(strcmp(eolian_class_short_name_get(class21), "class1")); |
55 | fail_if(!(iter = eolian_class_namespaces_get(class21))); | 55 | fail_if(!(iter = eolian_class_namespaces_get(class21))); |
56 | fail_if(!(eina_iterator_next(iter, (void**)&val1))); | 56 | fail_if(!(eina_iterator_next(iter, (void**)&val1))); |
57 | fail_if(eina_iterator_next(iter, &dummy)); | 57 | fail_if(eina_iterator_next(iter, &dummy)); |
58 | fail_if(strcmp(val1, "nmsp2")); | 58 | fail_if(strcmp(val1, "nmsp2")); |
59 | eina_iterator_free(iter); | 59 | eina_iterator_free(iter); |
60 | 60 | ||
61 | fail_if(strcmp(eolian_class_name_get(class_no), "no_nmsp")); | 61 | fail_if(strcmp(eolian_class_short_name_get(class_no), "no_nmsp")); |
62 | fail_if(eolian_class_namespaces_get(class_no)); | 62 | fail_if(eolian_class_namespaces_get(class_no)); |
63 | 63 | ||
64 | /* Inherits */ | 64 | /* Inherits */ |
@@ -1634,7 +1634,7 @@ START_TEST(eolian_parts) | |||
1634 | ck_assert_str_eq(pattern, eolian_documentation_summary_get(doc)); | 1634 | ck_assert_str_eq(pattern, eolian_documentation_summary_get(doc)); |
1635 | 1635 | ||
1636 | fail_if(!(klass = eolian_part_class_get(part))); | 1636 | fail_if(!(klass = eolian_part_class_get(part))); |
1637 | ck_assert_str_eq(part_classes[i], eolian_class_name_get(klass)); | 1637 | ck_assert_str_eq(part_classes[i], eolian_class_short_name_get(klass)); |
1638 | i++; | 1638 | i++; |
1639 | } | 1639 | } |
1640 | eina_iterator_free(iter); | 1640 | eina_iterator_free(iter); |