summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/struct_definition.hh
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-04-27 18:08:25 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2018-05-03 18:04:41 -0300
commitc9dd86579f1e4b585e5dadbc9f69df0abd263917 (patch)
treeba8b38e3600b15dec828e170dbe070dfd2bcb654 /src/bin/eolian_mono/eolian/mono/struct_definition.hh
parentf39baf1e82d7571225ac6429f7486e60abcf604f (diff)
efl_mono: More uniformization of the handling of names
Summary: Uses a common helper to open and close namespaces, to get the managed and unmanaged name of things, the interface, concrete and inherit class names, etc. eolian_cxx: Add namespace information to func_def, as it'll avoid eolian-cxx clients dealing with the eolian C api directly when trying to access a function pointer namespace. Depends on D6048 Reviewers: felipealmeida, vitor.sousa Reviewed By: vitor.sousa Subscribers: cedric Tags: #efl Differential Revision: https://phab.enlightenment.org/D6049
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/struct_definition.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index ab5db8f180..79e6ec6f1b 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -31,7 +31,7 @@ struct struct_definition_generator
31 template <typename OutputIterator, typename Context> 31 template <typename OutputIterator, typename Context>
32 bool generate(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const 32 bool generate(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const
33 { 33 {
34 34 EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "struct_definition_generator: " << struct_.cxx_name << std::endl;
35 if(!as_generator(documentation).generate(sink, struct_, context)) 35 if(!as_generator(documentation).generate(sink, struct_, context))
36 return false; 36 return false;
37 if(!as_generator 37 if(!as_generator
@@ -267,13 +267,15 @@ struct to_external_field_convert_generator
267 267
268 if (klass) 268 if (klass)
269 { 269 {
270 auto interface_name = name_helpers::klass_full_interface_name(*klass);
271 auto concrete_name = name_helpers::klass_full_concrete_name(*klass);
270 if (!as_generator( 272 if (!as_generator(
271 "\n" 273 "\n"
272 << scope_tab << scope_tab << "_external_struct." << string 274 << scope_tab << scope_tab << "_external_struct." << string
273 << " = (" << type << ") System.Activator.CreateInstance(typeof(" 275 << " = (" << interface_name << ") System.Activator.CreateInstance(typeof("
274 << type << "Concrete), new System.Object[] {_internal_struct." << string << "});\n" 276 << concrete_name << "), new System.Object[] {_internal_struct." << string << "});\n"
275 << scope_tab << scope_tab << "efl.eo.Globals.efl_ref(_internal_struct." << string << ");\n\n") 277 << scope_tab << scope_tab << "efl.eo.Globals.efl_ref(_internal_struct." << string << ");\n\n")
276 .generate(sink, std::make_tuple(field_name, field.type, field.type, field_name, field_name), context)) 278 .generate(sink, std::make_tuple(field_name, field_name, field_name), context))
277 return false; 279 return false;
278 } 280 }
279 else if (field.type.c_type == "Eina_Binbuf *" || field.type.c_type == "const Eina_Binbuf *") 281 else if (field.type.c_type == "Eina_Binbuf *" || field.type.c_type == "const Eina_Binbuf *")
@@ -443,10 +445,8 @@ struct struct_entities_generator
443 if (blacklist::is_struct_blacklisted(struct_)) 445 if (blacklist::is_struct_blacklisted(struct_))
444 return true; 446 return true;
445 447
446 std::vector<std::string> cpp_namespaces = name_helpers::escape_namespace(attributes::cpp_namespaces(struct_.namespaces));
447 448
448 auto open_namespace = *("namespace " << string << " { ") << "\n"; 449 if (!name_helpers::open_namespaces(sink, struct_.namespaces, context))
449 if (!as_generator(open_namespace).generate(sink, cpp_namespaces, add_lower_case_context(context)))
450 return false; 450 return false;
451 451
452 if (!struct_definition.generate(sink, struct_, context)) 452 if (!struct_definition.generate(sink, struct_, context))
@@ -458,10 +458,8 @@ struct struct_entities_generator
458 if (!struct_binding_conversion_functions.generate(sink, struct_, context)) 458 if (!struct_binding_conversion_functions.generate(sink, struct_, context))
459 return false; 459 return false;
460 460
461 auto close_namespace = *(lit("} ")) << "\n"; 461 return name_helpers::close_namespaces(sink, struct_.namespaces, context);
462 if(!as_generator(close_namespace).generate(sink, cpp_namespaces, context)) return false;
463 462
464 return true;
465 } 463 }
466} const struct_entities {}; 464} const struct_entities {};
467 465