summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx/eolian_wrappers.hh
diff options
context:
space:
mode:
authorSavio Sena <savio.sena@acm.org>2014-07-01 10:55:45 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-07-01 10:55:45 +0100
commitce63b16f400ae041d66a79f7d6d8c09838a7af12 (patch)
tree001befeaa20be58fb61ace4dee1d19cf09adb03e /src/bin/eolian_cxx/eolian_wrappers.hh
parent86aa034379113b92cb8cdbc7904c42ea87466c6f (diff)
eolian-cxx: Make proper handling of namespaces.
Summary: The generation of class prefixes was not taking into account the full classname -- the namespace was not being prepended to it. Fixed that and also re-organized the code a bit, removed some Wshadow warnings also. This commit fixes 'make examples' and 'make check'. Reviewers: tasn, cedric, q66 CC: felipealmeida, smohanty, cedric Differential Revision: https://phab.enlightenment.org/D1100
Diffstat (limited to 'src/bin/eolian_cxx/eolian_wrappers.hh')
-rw-r--r--src/bin/eolian_cxx/eolian_wrappers.hh55
1 files changed, 32 insertions, 23 deletions
diff --git a/src/bin/eolian_cxx/eolian_wrappers.hh b/src/bin/eolian_cxx/eolian_wrappers.hh
index 2472e4a42d..e357c25ab4 100644
--- a/src/bin/eolian_cxx/eolian_wrappers.hh
+++ b/src/bin/eolian_cxx/eolian_wrappers.hh
@@ -109,7 +109,7 @@ class_prefix(Eolian_Class const& klass)
109{ 109{
110 std::string prefix = safe_lower(::eolian_class_eo_prefix_get(klass)); 110 std::string prefix = safe_lower(::eolian_class_eo_prefix_get(klass));
111 if (prefix.empty()) 111 if (prefix.empty())
112 prefix = safe_lower(class_name(klass)); 112 prefix = safe_lower(find_replace(class_full_name(klass), ".", "_"));
113 assert(!prefix.empty()); 113 assert(!prefix.empty());
114 return prefix; 114 return prefix;
115} 115}
@@ -148,7 +148,7 @@ class_namespace_full(Eolian_Class const& klass)
148 } 148 }
149 if (s.size() >= 2) 149 if (s.size() >= 2)
150 s = s.substr(0, s.size()-2); 150 s = s.substr(0, s.size()-2);
151 return s; 151 return safe_lower(s);
152} 152}
153 153
154inline efl::eina::range_ptr_list<const Eolian_Class> 154inline efl::eina::range_ptr_list<const Eolian_Class>
@@ -158,46 +158,55 @@ class_list_all()
158} 158}
159 159
160inline std::string 160inline std::string
161function_name(Eolian_Function const& function) 161function_name(Eolian_Function const& func)
162{
163 return safe_str(::eolian_function_name_get(func));
164}
165
166inline std::string
167function_impl(Eolian_Function const& func, std::string const& prefix)
162{ 168{
163 return safe_str(::eolian_function_name_get(function)); 169 const char *s = ::eolian_function_full_c_name_get(func, prefix.c_str());
170 std::string ret(s);
171 ::eina_stringshare_del(s);
172 return ret;
164} 173}
165 174
166inline Eolian_Function_Type 175inline Eolian_Function_Type
167function_type(Eolian_Function const& function) 176function_type(Eolian_Function const& func)
168{ 177{
169 return ::eolian_function_type_get(function); 178 return ::eolian_function_type_get(func);
170} 179}
171 180
172inline efl::eolian::eolian_type_instance 181inline efl::eolian::eolian_type_instance
173function_return_type(Eolian_Function const& function, Eolian_Function_Type func_type = method_t::value) 182function_return_type(Eolian_Function const& func, Eolian_Function_Type func_type = method_t::value)
174{ 183{
175 return type_lookup 184 return type_lookup
176 (::eolian_function_return_type_get(function, func_type)); 185 (::eolian_function_return_type_get(func, func_type));
177} 186}
178 187
179inline efl::eolian::eolian_type_instance 188inline efl::eolian::eolian_type_instance
180function_return_type(Eolian_Function const& function, setter_t func_type) 189function_return_type(Eolian_Function const& func, setter_t func_type)
181{ 190{
182 return function_return_type(function, func_type.value); 191 return function_return_type(func, func_type.value);
183} 192}
184 193
185inline efl::eolian::eolian_type_instance 194inline efl::eolian::eolian_type_instance
186function_return_type(Eolian_Function const& function, getter_t func_type) 195function_return_type(Eolian_Function const& func, getter_t func_type)
187{ 196{
188 return function_return_type(function, func_type.value); 197 return function_return_type(func, func_type.value);
189} 198}
190 199
191inline efl::eolian::eolian_type_instance 200inline efl::eolian::eolian_type_instance
192function_return_type(Eolian_Function const& function, method_t func_type) 201function_return_type(Eolian_Function const& func, method_t func_type)
193{ 202{
194 return function_return_type(function, func_type.value); 203 return function_return_type(func, func_type.value);
195} 204}
196 205
197inline efl::eolian::eolian_type_instance 206inline efl::eolian::eolian_type_instance
198function_return_type(Eolian_Function const& function, ctor_t func_type) 207function_return_type(Eolian_Function const& func, ctor_t func_type)
199{ 208{
200 return function_return_type(function, func_type.value); 209 return function_return_type(func, func_type.value);
201} 210}
202 211
203inline bool 212inline bool
@@ -207,9 +216,9 @@ property_is_getter(Eolian_Function_Type func_type)
207} 216}
208 217
209inline bool 218inline bool
210property_is_getter(Eolian_Function const& function) 219property_is_getter(Eolian_Function const& func)
211{ 220{
212 return property_is_getter(function_type(function)); 221 return property_is_getter(function_type(func));
213} 222}
214 223
215inline bool 224inline bool
@@ -219,9 +228,9 @@ property_is_setter(Eolian_Function_Type func_type)
219} 228}
220 229
221inline bool 230inline bool
222property_is_setter(Eolian_Function const& function) 231property_is_setter(Eolian_Function const& func)
223{ 232{
224 return property_is_setter(function_type(function)); 233 return property_is_setter(function_type(func));
225} 234}
226 235
227inline std::string 236inline std::string
@@ -264,11 +273,11 @@ parameter_is_const(Eolian_Function_Parameter const& parameter,
264 273
265inline bool 274inline bool
266parameter_is_const(Eolian_Function_Parameter const& parameter, 275parameter_is_const(Eolian_Function_Parameter const& parameter,
267 Eolian_Function const& function) 276 Eolian_Function const& func)
268{ 277{
269 assert(function_type(function) != EOLIAN_PROPERTY); 278 assert(function_type(func) != EOLIAN_PROPERTY);
270 return ::eolian_parameter_const_attribute_get 279 return ::eolian_parameter_const_attribute_get
271 (parameter, property_is_getter(function)); 280 (parameter, property_is_getter(func));
272} 281}
273 282
274inline efl::eolian::eolian_type_instance 283inline efl::eolian::eolian_type_instance