summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/klass.hh
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-08-23 14:27:28 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-08-23 14:28:00 -0300
commit2f0a20b6887ee868f5a72ff38b9789b08e61630f (patch)
tree47293a39f84ce0f9973ac2367ccb6b544f576b29 /src/bin/eolian_mono/eolian/mono/klass.hh
parentb4a64444735c1bef6703edc0783fc8256b08329e (diff)
eolian-mono: Add support for partial classes
Summary: Add the -p command to eolian to create a class as a partial class. Create a list in meson build of Eolian files that should be built with partial classes. This allows creating more specific method overloads for C#, manually, by generating the class as partial and adding in manual binding the partial class with the new methods and properties. T8034 Reviewers: segfaultxavi, lauromoura, woohyun, Jaehyun_Cho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9690
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/klass.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/klass.hh29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh
index 819497a..f1b89ab 100644
--- a/src/bin/eolian_mono/eolian/mono/klass.hh
+++ b/src/bin/eolian_mono/eolian/mono/klass.hh
@@ -50,6 +50,11 @@ is_inherit_context(Context const& context)
50 return context_find_tag<class_context>(context).current_wrapper_kind == class_context::inherit; 50 return context_find_tag<class_context>(context).current_wrapper_kind == class_context::inherit;
51} 51}
52 52
53enum partial_class
54{
55 class_partial = 1
56};
57
53struct klass 58struct klass
54{ 59{
55 template <typename OutputIterator, typename Context> 60 template <typename OutputIterator, typename Context>
@@ -109,9 +114,11 @@ struct klass
109 if(!as_generator("[Efl.Eo.BindingEntity]\n").generate(sink, attributes::unused, iface_cxt)) 114 if(!as_generator("[Efl.Eo.BindingEntity]\n").generate(sink, attributes::unused, iface_cxt))
110 return false; 115 return false;
111 116
117 using efl::eolian::grammar::lit;
112 if(!as_generator 118 if(!as_generator
113 ( 119 (
114 "public " /*<< class_type*/ "interface" /*<<*/ " " << string << " : " 120 lit("public ") << (is_partial ? "partial ":"")
121 /*<< class_type*/ << "interface" /*<<*/ " " << string << " : "
115 ) 122 )
116 .generate(sink, name_helpers::klass_interface_name(cls), iface_cxt)) 123 .generate(sink, name_helpers::klass_interface_name(cls), iface_cxt))
117 return false; 124 return false;
@@ -191,7 +198,7 @@ struct klass
191 if(!as_generator 198 if(!as_generator
192 ( 199 (
193 documentation 200 documentation
194 << "sealed public class " << concrete_name << " :\n" 201 << "sealed public " << (is_partial ? "partial ":"") << " class " << concrete_name << " :\n"
195 << scope_tab << (root ? "Efl.Eo.EoWrapper" : "") << (klass_full_concrete_or_interface_name % "") << "\n" 202 << scope_tab << (root ? "Efl.Eo.EoWrapper" : "") << (klass_full_concrete_or_interface_name % "") << "\n"
196 << scope_tab << ", " << interface_name << "\n" 203 << scope_tab << ", " << interface_name << "\n"
197 << scope_tab << *(", " << name_helpers::klass_full_concrete_or_interface_name) << "\n" 204 << scope_tab << *(", " << name_helpers::klass_full_concrete_or_interface_name) << "\n"
@@ -284,7 +291,14 @@ struct klass
284 documentation 291 documentation
285 << "[" << name_helpers::klass_full_native_inherit_name(cls) << "]\n" 292 << "[" << name_helpers::klass_full_native_inherit_name(cls) << "]\n"
286 << "[Efl.Eo.BindingEntity]\n" 293 << "[Efl.Eo.BindingEntity]\n"
287 << "public " << class_type << " " << name_helpers::klass_concrete_name(cls) << " : " 294 << "public "
295 << (is_partial
296 ? class_type == "class"
297 ? "partial class"
298 : "abstract partial class"
299 : class_type
300 )
301 << " " << name_helpers::klass_concrete_name(cls) << " : "
288 << (klass_full_concrete_or_interface_name % ",") // classes 302 << (klass_full_concrete_or_interface_name % ",") // classes
289 << (root ? "Efl.Eo.EoWrapper" : "") // ... or root 303 << (root ? "Efl.Eo.EoWrapper" : "") // ... or root
290 << (inherit_interfaces.empty() ? "" : ", ") 304 << (inherit_interfaces.empty() ? "" : ", ")
@@ -600,9 +614,16 @@ struct klass
600 } 614 }
601 return true; 615 return true;
602 } 616 }
617
618 bool is_partial;
619
620 klass const operator()(partial_class) const
621 {
622 return klass{true};
623 }
603}; 624};
604 625
605struct klass const klass = {}; 626struct klass const klass = {false};
606 627
607} 628}
608 629