summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-06-24 17:20:33 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-06-30 17:20:07 +0100
commit8a82e0fdf4bf531a1d778c5cbf1860e2b00e0cd1 (patch)
tree9065feae6b30e3c0c4b04ddae8a16cb0b8d2d0ee /src/bin/eolian_cxx
parentc0576cee73382fc833d7eecf13b365321cbf365d (diff)
eolian_cxx: use the new eolian dedup API
Diffstat (limited to 'src/bin/eolian_cxx')
-rw-r--r--src/bin/eolian_cxx/convert.cc38
1 files changed, 9 insertions, 29 deletions
diff --git a/src/bin/eolian_cxx/convert.cc b/src/bin/eolian_cxx/convert.cc
index c33953a658..dfb7272d6d 100644
--- a/src/bin/eolian_cxx/convert.cc
+++ b/src/bin/eolian_cxx/convert.cc
@@ -15,31 +15,11 @@
15#include "comments.hh" 15#include "comments.hh"
16 16
17static std::string 17static std::string
18_dedup_func_name(const std::string &classn, const std::string &funcn) 18_dedup_func_name(Eolian_Function func, const std::string &classn)
19{ 19{
20 size_t last_p = classn.rfind('_'); 20 const char *s = eolian_function_full_c_name_get(func, classn.c_str());
21 size_t func_p = funcn.find('_'); 21 std::string ret(s);
22 std::string ret; 22 eina_stringshare_del(s);
23 size_t len;
24
25 if (last_p == std::string::npos) last_p = 0;
26 else last_p++;
27 if (func_p == std::string::npos) len = funcn.size();
28 else len = func_p;
29
30 if ((classn.size() - last_p) != len
31 || classn.compare(last_p, len, funcn, 0, len))
32 {
33 ret += classn;
34 ret += '_';
35 ret += funcn;
36 return ret;
37 }
38
39 if (last_p)
40 ret += classn.substr(0, last_p);
41
42 ret += funcn;
43 return ret; 23 return ret;
44} 24}
45 25
@@ -110,7 +90,7 @@ _get_properties(const Eolian_Class klass)
110 efl::eolian::eo_function getter; 90 efl::eolian::eo_function getter;
111 getter.type = efl::eolian::eo_function::regular_; 91 getter.type = efl::eolian::eo_function::regular_;
112 getter.name = name + "_get"; 92 getter.name = name + "_get";
113 getter.impl = _dedup_func_name((prefix != "" ? prefix : cxx_classname), getter.name); 93 getter.impl = _dedup_func_name(property, (prefix != "" ? prefix : cxx_classname)) + "_get";
114 std::string ret = safe_str 94 std::string ret = safe_str
115 (eolian_function_return_type_get(property, EOLIAN_PROP_GET)); 95 (eolian_function_return_type_get(property, EOLIAN_PROP_GET));
116 if (ret == "") ret = "void"; 96 if (ret == "") ret = "void";
@@ -155,7 +135,7 @@ _get_properties(const Eolian_Class klass)
155 efl::eolian::eo_function setter; 135 efl::eolian::eo_function setter;
156 setter.type = efl::eolian::eo_function::regular_; 136 setter.type = efl::eolian::eo_function::regular_;
157 setter.name = name + "_set"; 137 setter.name = name + "_set";
158 setter.impl = _dedup_func_name((prefix != "" ? prefix : cxx_classname), setter.name); 138 setter.impl = _dedup_func_name(property, (prefix != "" ? prefix : cxx_classname)) + "_set";
159 setter.params = params; 139 setter.params = params;
160 setter.ret = safe_str(eolian_function_return_type_get 140 setter.ret = safe_str(eolian_function_return_type_get
161 (property, EOLIAN_PROP_SET)); 141 (property, EOLIAN_PROP_SET));
@@ -243,8 +223,8 @@ convert_eolian_constructors(efl::eolian::eo_class& cls, const Eolian_Class klass
243 { 223 {
244 Eolian_Function eolian_constructor = static_cast<Eolian_Function>(curr); 224 Eolian_Function eolian_constructor = static_cast<Eolian_Function>(curr);
245 efl::eolian::eo_constructor constructor; 225 efl::eolian::eo_constructor constructor;
246 constructor.name = _dedup_func_name((prefix != "" ? prefix : cls.name), 226 constructor.name = _dedup_func_name(eolian_constructor,
247 safe_str(eolian_function_name_get(eolian_constructor))); 227 (prefix != "" ? prefix : cls.name));
248 constructor.params = _get_params 228 constructor.params = _get_params
249 (eolian_parameters_list_get(eolian_constructor)); 229 (eolian_parameters_list_get(eolian_constructor));
250 constructor.comment = detail::eolian_constructor_comment 230 constructor.comment = detail::eolian_constructor_comment
@@ -269,7 +249,7 @@ convert_eolian_functions(efl::eolian::eo_class& cls, const Eolian_Class klass)
269 // XXX Eolian only provides regular methods so far 249 // XXX Eolian only provides regular methods so far
270 function.type = efl::eolian::eo_function::regular_; 250 function.type = efl::eolian::eo_function::regular_;
271 function.name = safe_str(eolian_function_name_get(eolian_function)); 251 function.name = safe_str(eolian_function_name_get(eolian_function));
272 function.impl = _dedup_func_name((prefix != "" ? prefix : cls.name), function.name); 252 function.impl = _dedup_func_name(eolian_function, (prefix != "" ? prefix : cls.name));
273 function.ret = safe_str(eolian_function_return_type_get 253 function.ret = safe_str(eolian_function_return_type_get
274 (eolian_function, EOLIAN_METHOD)); 254 (eolian_function, EOLIAN_METHOD));
275 if(function.ret == "") function.ret = "void"; 255 if(function.ret == "") function.ret = "void";