summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-07-09 20:59:31 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-07-09 20:59:31 +0100
commit580aea04cd928a2ab285c72b0b71dd8033218acb (patch)
tree8156261ed64a189411f2f8cdf90734edb6e4ec14 /src/bin/eolian_cxx
parent012b586c8b280272e0dca725028c2ec0b1d8be72 (diff)
eolian: refactoring step six
Move Eolian_Function as well, plus fix const correctness of several API funcs.
Diffstat (limited to 'src/bin/eolian_cxx')
-rw-r--r--src/bin/eolian_cxx/convert.cc56
-rw-r--r--src/bin/eolian_cxx/convert_comments.cc12
-rw-r--r--src/bin/eolian_cxx/eolian_wrappers.hh8
3 files changed, 38 insertions, 38 deletions
diff --git a/src/bin/eolian_cxx/convert.cc b/src/bin/eolian_cxx/convert.cc
index 6a6e7b1f22..4a6ea4bb39 100644
--- a/src/bin/eolian_cxx/convert.cc
+++ b/src/bin/eolian_cxx/convert.cc
@@ -49,7 +49,7 @@ static efl::eolian::parameters_container_type
49convert_eolian_parameters(Eolian_Function const& func, getter_t func_type) 49convert_eolian_parameters(Eolian_Function const& func, getter_t func_type)
50{ 50{
51 return convert_eolian_parameters 51 return convert_eolian_parameters
52 (::eolian_parameters_list_get(func), func_type.value); 52 (::eolian_parameters_list_get(&func), func_type.value);
53} 53}
54 54
55static efl::eolian::parameters_container_type 55static efl::eolian::parameters_container_type
@@ -69,7 +69,7 @@ convert_eolian_parameters(Eolian_Function const& func)
69{ 69{
70 assert(function_type(func) != EOLIAN_PROPERTY); 70 assert(function_type(func) != EOLIAN_PROPERTY);
71 return convert_eolian_parameters 71 return convert_eolian_parameters
72 (::eolian_parameters_list_get(func), function_type(func)); 72 (::eolian_parameters_list_get(&func), function_type(func));
73} 73}
74 74
75static efl::eolian::functions_container_type 75static efl::eolian::functions_container_type
@@ -84,19 +84,19 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
84 std::string prefix(class_prefix(klass)); 84 std::string prefix(class_prefix(klass));
85 EINA_LIST_FOREACH (properties, it, curr) 85 EINA_LIST_FOREACH (properties, it, curr)
86 { 86 {
87 Eolian_Function prop_ = static_cast<Eolian_Function>(curr); 87 Eolian_Function *prop_ = static_cast<Eolian_Function*>(curr);
88 if (property_is_getter(prop_)) 88 if (property_is_getter(*prop_))
89 { 89 {
90 efl::eolian::parameters_container_type params 90 efl::eolian::parameters_container_type params
91 = convert_eolian_parameters(prop_, eolian_cxx::getter); 91 = convert_eolian_parameters(*prop_, eolian_cxx::getter);
92 92
93 efl::eolian::eo_function get_; 93 efl::eolian::eo_function get_;
94 get_.type = efl::eolian::eo_function::regular_; 94 get_.type = efl::eolian::eo_function::regular_;
95 get_.name = function_name(prop_) + "_get"; 95 get_.name = function_name(*prop_) + "_get";
96 get_.impl = function_impl(prop_, prefix) + "_get"; 96 get_.impl = function_impl(*prop_, prefix) + "_get";
97 97
98 efl::eolian::eolian_type_instance ret = 98 efl::eolian::eolian_type_instance ret =
99 function_return_type(prop_, eolian_cxx::getter); 99 function_return_type(*prop_, eolian_cxx::getter);
100 100
101 // if the getter has a single parameter and a void return 101 // if the getter has a single parameter and a void return
102 // it is transformed into a getter with no parameters 102 // it is transformed into a getter with no parameters
@@ -131,10 +131,10 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
131 get_.params.end()); 131 get_.params.end());
132 get_.params = keys; 132 get_.params = keys;
133 } 133 }
134 get_.comment = convert_comments_function(prop_, eolian_cxx::getter); 134 get_.comment = convert_comments_function(*prop_, eolian_cxx::getter);
135 container.push_back(get_); 135 container.push_back(get_);
136 } 136 }
137 if (property_is_setter(prop_)) 137 if (property_is_setter(*prop_))
138 { 138 {
139 const Eina_List *keys_ = eolian_property_keys_list_get(prop_); 139 const Eina_List *keys_ = eolian_property_keys_list_get(prop_);
140 const Eina_List *args_ = eolian_parameters_list_get(prop_); 140 const Eina_List *args_ = eolian_parameters_list_get(prop_);
@@ -144,11 +144,11 @@ convert_eolian_property_to_functions(Eolian_Class const& klass)
144 eina_list_free(params_); 144 eina_list_free(params_);
145 efl::eolian::eo_function set_; 145 efl::eolian::eo_function set_;
146 set_.type = efl::eolian::eo_function::regular_; 146 set_.type = efl::eolian::eo_function::regular_;
147 set_.name = function_name(prop_) + "_set"; 147 set_.name = function_name(*prop_) + "_set";
148 set_.impl = function_impl(prop_, prefix) + "_set"; 148 set_.impl = function_impl(*prop_, prefix) + "_set";
149 set_.params = params; 149 set_.params = params;
150 set_.ret = function_return_type(prop_, eolian_cxx::setter); 150 set_.ret = function_return_type(*prop_, eolian_cxx::setter);
151 set_.comment = convert_comments_function(prop_, eolian_cxx::setter); 151 set_.comment = convert_comments_function(*prop_, eolian_cxx::setter);
152 container.push_back(set_); 152 container.push_back(set_);
153 } 153 }
154 } 154 }
@@ -200,7 +200,7 @@ convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass)
200 { 200 {
201 Eolian_Implement *impl_desc = static_cast<Eolian_Implement*>(impl_desc_); 201 Eolian_Implement *impl_desc = static_cast<Eolian_Implement*>(impl_desc_);
202 Eolian_Class *impl_class; 202 Eolian_Class *impl_class;
203 Eolian_Function impl_func; 203 Eolian_Function *impl_func;
204 Eolian_Function_Type impl_type; 204 Eolian_Function_Type impl_type;
205 eolian_implement_information_get 205 eolian_implement_information_get
206 (impl_desc, &impl_class, &impl_func, &impl_type); 206 (impl_desc, &impl_class, &impl_func, &impl_type);
@@ -209,9 +209,9 @@ convert_eolian_implements(efl::eolian::eo_class& cls, Eolian_Class const& klass)
209 efl::eolian::eo_constructor constructor; 209 efl::eolian::eo_constructor constructor;
210 std::string parent = safe_lower(eolian_class_full_name_get(impl_class)); 210 std::string parent = safe_lower(eolian_class_full_name_get(impl_class));
211 if (parent == "eo_base" || parent == "eo.base") parent = "eo"; 211 if (parent == "eo_base" || parent == "eo.base") parent = "eo";
212 constructor.name = parent + "_" + function_name(impl_func); 212 constructor.name = parent + "_" + function_name(*impl_func);
213 constructor.params = convert_eolian_parameters(impl_func); 213 constructor.params = convert_eolian_parameters(*impl_func);
214 constructor.comment = convert_comments_function(impl_func, eolian_cxx::ctor); 214 constructor.comment = convert_comments_function(*impl_func, eolian_cxx::ctor);
215 cls.constructors.push_back(constructor); 215 cls.constructors.push_back(constructor);
216 } 216 }
217 } 217 }
@@ -227,11 +227,11 @@ convert_eolian_constructors(efl::eolian::eo_class& cls, Eolian_Class const& klas
227 ::eolian_class_functions_list_get(&klass, EOLIAN_CTOR); 227 ::eolian_class_functions_list_get(&klass, EOLIAN_CTOR);
228 EINA_LIST_FOREACH (constructors, it, curr) 228 EINA_LIST_FOREACH (constructors, it, curr)
229 { 229 {
230 Eolian_Function eo_constructor = static_cast<Eolian_Function>(curr); 230 Eolian_Function *eo_constructor = static_cast<Eolian_Function*>(curr);
231 efl::eolian::eo_constructor constructor; 231 efl::eolian::eo_constructor constructor;
232 constructor.name = function_impl(eo_constructor, prefix); 232 constructor.name = function_impl(*eo_constructor, prefix);
233 constructor.params = convert_eolian_parameters(eo_constructor); 233 constructor.params = convert_eolian_parameters(*eo_constructor);
234 constructor.comment = convert_comments_function(eo_constructor, eolian_cxx::ctor); 234 constructor.comment = convert_comments_function(*eo_constructor, eolian_cxx::ctor);
235 cls.constructors.push_back(constructor); 235 cls.constructors.push_back(constructor);
236 } 236 }
237} 237}
@@ -247,14 +247,14 @@ convert_eolian_functions(efl::eolian::eo_class& cls, Eolian_Class const& klass)
247 EINA_LIST_FOREACH (eolian_functions, it, curr) 247 EINA_LIST_FOREACH (eolian_functions, it, curr)
248 { 248 {
249 efl::eolian::eo_function func_; 249 efl::eolian::eo_function func_;
250 Eolian_Function eol_func = static_cast<Eolian_Function>(curr); 250 Eolian_Function *eol_func = static_cast<Eolian_Function*>(curr);
251 // XXX Eolian only provides regular methods so far 251 // XXX Eolian only provides regular methods so far
252 func_.type = efl::eolian::eo_function::regular_; 252 func_.type = efl::eolian::eo_function::regular_;
253 func_.name = function_name(eol_func); 253 func_.name = function_name(*eol_func);
254 func_.impl = function_impl(eol_func, class_prefix(klass)); 254 func_.impl = function_impl(*eol_func, class_prefix(klass));
255 func_.ret = function_return_type(eol_func); 255 func_.ret = function_return_type(*eol_func);
256 func_.params = convert_eolian_parameters(eol_func); 256 func_.params = convert_eolian_parameters(*eol_func);
257 func_.comment = convert_comments_function(eol_func, eolian_cxx::method); 257 func_.comment = convert_comments_function(*eol_func, eolian_cxx::method);
258 cls.functions.push_back(func_); 258 cls.functions.push_back(func_);
259 } 259 }
260} 260}
diff --git a/src/bin/eolian_cxx/convert_comments.cc b/src/bin/eolian_cxx/convert_comments.cc
index dd20aa8c3b..c8bff0e981 100644
--- a/src/bin/eolian_cxx/convert_comments.cc
+++ b/src/bin/eolian_cxx/convert_comments.cc
@@ -41,16 +41,16 @@ _comment_parameters_list(const Eina_List *params)
41} 41}
42 42
43static std::string 43static std::string
44_comment_brief_and_params(Eolian_Function function, 44_comment_brief_and_params(Eolian_Function const& function,
45 const char *key = EOLIAN_COMMENT) 45 const char *key = EOLIAN_COMMENT)
46{ 46{
47 std::string doc = ""; 47 std::string doc = "";
48 std::string func = safe_str(::eolian_function_description_get(function, key)); 48 std::string func = safe_str(::eolian_function_description_get(&function, key));
49 if (func != "") 49 if (func != "")
50 { 50 {
51 doc += "@brief " + func + "\n\n"; 51 doc += "@brief " + func + "\n\n";
52 } 52 }
53 std::string params = _comment_parameters_list(::eolian_parameters_list_get(function)); 53 std::string params = _comment_parameters_list(::eolian_parameters_list_get(&function));
54 if (params != "") 54 if (params != "")
55 { 55 {
56 doc += params + "\n"; 56 doc += params + "\n";
@@ -59,16 +59,16 @@ _comment_brief_and_params(Eolian_Function function,
59} 59}
60 60
61static std::string 61static std::string
62_comment_return(Eolian_Function function, 62_comment_return(Eolian_Function const& function,
63 Eolian_Function_Type rettype) 63 Eolian_Function_Type rettype)
64{ 64{
65 Eolian_Type *rettypet = ::eolian_function_return_type_get(function, rettype); 65 Eolian_Type *rettypet = ::eolian_function_return_type_get(&function, rettype);
66 const char *rettypes = NULL; 66 const char *rettypes = NULL;
67 if (rettypet) rettypes = ::eolian_type_c_type_get(rettypet); 67 if (rettypet) rettypes = ::eolian_type_c_type_get(rettypet);
68 std::string doc = ""; 68 std::string doc = "";
69 std::string ret = safe_str(rettypes); 69 std::string ret = safe_str(rettypes);
70 if (rettypes) eina_stringshare_del(rettypes); 70 if (rettypes) eina_stringshare_del(rettypes);
71 std::string comment = safe_str(::eolian_function_return_comment_get(function, rettype)); 71 std::string comment = safe_str(::eolian_function_return_comment_get(&function, rettype));
72 if (ret != "void" && ret != "" && comment != "") 72 if (ret != "void" && ret != "" && comment != "")
73 { 73 {
74 doc = "@return " + comment; 74 doc = "@return " + comment;
diff --git a/src/bin/eolian_cxx/eolian_wrappers.hh b/src/bin/eolian_cxx/eolian_wrappers.hh
index 3893fefa0e..f7a8163d92 100644
--- a/src/bin/eolian_cxx/eolian_wrappers.hh
+++ b/src/bin/eolian_cxx/eolian_wrappers.hh
@@ -159,13 +159,13 @@ class_list_all()
159inline std::string 159inline std::string
160function_name(Eolian_Function const& func) 160function_name(Eolian_Function const& func)
161{ 161{
162 return safe_str(::eolian_function_name_get(func)); 162 return safe_str(::eolian_function_name_get(&func));
163} 163}
164 164
165inline std::string 165inline std::string
166function_impl(Eolian_Function const& func, std::string const& prefix) 166function_impl(Eolian_Function const& func, std::string const& prefix)
167{ 167{
168 const char *s = ::eolian_function_full_c_name_get(func, prefix.c_str()); 168 const char *s = ::eolian_function_full_c_name_get(&func, prefix.c_str());
169 std::string ret(s); 169 std::string ret(s);
170 ::eina_stringshare_del(s); 170 ::eina_stringshare_del(s);
171 return ret; 171 return ret;
@@ -174,14 +174,14 @@ function_impl(Eolian_Function const& func, std::string const& prefix)
174inline Eolian_Function_Type 174inline Eolian_Function_Type
175function_type(Eolian_Function const& func) 175function_type(Eolian_Function const& func)
176{ 176{
177 return ::eolian_function_type_get(func); 177 return ::eolian_function_type_get(&func);
178} 178}
179 179
180inline efl::eolian::eolian_type_instance 180inline efl::eolian::eolian_type_instance
181function_return_type(Eolian_Function const& func, Eolian_Function_Type func_type = method_t::value) 181function_return_type(Eolian_Function const& func, Eolian_Function_Type func_type = method_t::value)
182{ 182{
183 return type_lookup 183 return type_lookup
184 (::eolian_function_return_type_get(func, func_type)); 184 (::eolian_function_return_type_get(&func, func_type));
185} 185}
186 186
187inline efl::eolian::eolian_type_instance 187inline efl::eolian::eolian_type_instance