diff --git a/src/bin/eolian_mono/eolian/mono/enum_definition.hh b/src/bin/eolian_mono/eolian/mono/enum_definition.hh index 922463936e..4dae3cc7aa 100644 --- a/src/bin/eolian_mono/eolian/mono/enum_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/enum_definition.hh @@ -25,6 +25,7 @@ struct enum_definition_generator if(!as_generator ( + "[Efl.Eo.BindingEntity]\n" "public enum " << string << "\n{\n" ) .generate(sink, name_helpers::typedecl_managed_name(enum_), context)) diff --git a/src/bin/eolian_mono/eolian/mono/events.hh b/src/bin/eolian_mono/eolian/mono/events.hh index c1a45033f9..d5d57c4498 100644 --- a/src/bin/eolian_mono/eolian/mono/events.hh +++ b/src/bin/eolian_mono/eolian/mono/events.hh @@ -250,6 +250,7 @@ struct event_argument_wrapper_generator return as_generator("///Event argument wrapper for event .\n" + << "[Efl.Eo.BindingEntity]\n" << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n" << scope_tab << "///Actual event payload.\n" << scope_tab << "public " << type << " arg { get; set; }\n" diff --git a/src/bin/eolian_mono/eolian/mono/function_pointer.hh b/src/bin/eolian_mono/eolian/mono/function_pointer.hh index f724d8029e..721368f115 100644 --- a/src/bin/eolian_mono/eolian/mono/function_pointer.hh +++ b/src/bin/eolian_mono/eolian/mono/function_pointer.hh @@ -44,6 +44,7 @@ struct function_pointer { // C# visible delegate if (!as_generator(documentation + << "[Efl.Eo.BindingEntity]\n" << "public delegate " << type << " " << string << "(" << (parameter % ", ") << ");\n") .generate(sink, std::make_tuple(f, f.return_type, f_name, f.parameters), funcptr_ctx)) diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh index 99dac21123..a98866e34a 100644 --- a/src/bin/eolian_mono/eolian/mono/klass.hh +++ b/src/bin/eolian_mono/eolian/mono/klass.hh @@ -106,6 +106,9 @@ struct klass .generate(sink, attributes::unused, iface_cxt)) return false; + if(!as_generator("[Efl.Eo.BindingEntity]\n").generate(sink, attributes::unused, iface_cxt)) + return false; + if(!as_generator ( "public " /*<< class_type*/ "interface" /*<<*/ " " << string << " : " @@ -279,6 +282,7 @@ struct klass ( documentation << "[" << name_helpers::klass_full_native_inherit_name(cls) << "]\n" + << "[Efl.Eo.BindingEntity]\n" << "public " << class_type << " " << name_helpers::klass_concrete_name(cls) << " : " << (klass_full_concrete_or_interface_name % ",") // classes << (root ? "Efl.Eo.EoWrapper" : "") // ... or root @@ -502,7 +506,7 @@ struct klass // For constructors with arguments, the parent is also required, as optional parameters can't come before non-optional paramenters. << scope_tab << "public " << inherit_name << "(Efl.Object parent" << ((constructors.size() > 0) ? "" : "= null") << "\n" << scope_tab << scope_tab << scope_tab << *(", " << constructor_param ) << ") : " - << "base(" << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\n" + << "base(" << name_helpers::klass_get_name(cls) << "(), parent)\n" << scope_tab << "{\n" << (*(scope_tab << scope_tab << constructor_invocation << "\n")) << scope_tab << scope_tab << "FinishInstantiation();\n" @@ -542,9 +546,8 @@ struct klass scope_tab << "/// Initializes a new instance of the class.\n" << scope_tab << "/// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.\n" << scope_tab << "/// The pointer to the base native Eo class.\n" - << scope_tab << "/// The managed type of the public constructor that originated this call.\n" << scope_tab << "/// The Efl.Object parent of this instance.\n" - << scope_tab << "protected " << inherit_name << "(IntPtr baseKlass, System.Type managedType, Efl.Object parent) : base(baseKlass, managedType, parent)\n" + << scope_tab << "protected " << inherit_name << "(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)\n" << scope_tab << "{\n" << scope_tab << "}\n\n" ).generate(sink, attributes::unused, context); diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh index 851b9c4025..c949783945 100644 --- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh @@ -396,6 +396,7 @@ struct struct_definition_generator if(!as_generator ( indent << "[StructLayout(LayoutKind.Sequential)]\n" + << indent << "[Efl.Eo.BindingEntity]\n" << indent << "public struct " << string << "\n" << indent << "{\n" ) diff --git a/src/bindings/mono/eo_mono/EoWrapper.cs b/src/bindings/mono/eo_mono/EoWrapper.cs index 03edea018c..c2ee5e2a31 100644 --- a/src/bindings/mono/eo_mono/EoWrapper.cs +++ b/src/bindings/mono/eo_mono/EoWrapper.cs @@ -67,15 +67,14 @@ public abstract class EoWrapper : IWrapper, IDisposable /// Internal usage: Constructor to actually call the native library constructors. C# subclasses /// must use the public constructor only. /// The pointer to the base native Eo class. - /// The managed type of the public constructor that originated this call. /// The Efl.Object parent of this instance. /// Name of the file from where the constructor is called. /// Number of the line from where the constructor is called. - protected EoWrapper(IntPtr baseKlass, System.Type managedType, Efl.Object parent, + protected EoWrapper(IntPtr baseKlass, Efl.Object parent, [CallerFilePath] string file = null, [CallerLineNumber] int line = 0) { - generated = ((object)this).GetType() == managedType; + generated = Efl.Eo.BindingEntity.IsBindingEntity(((object)this).GetType()); IntPtr actual_klass = baseKlass; if (!generated) { diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index 833ae78302..09c82a7e81 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -775,6 +775,22 @@ public class PrivateNativeClass : NativeClass } } +[System.AttributeUsage(System.AttributeTargets.Class | + System.AttributeTargets.Interface | + System.AttributeTargets.Enum | + System.AttributeTargets.Delegate | + System.AttributeTargets.Struct, + AllowMultiple = false, + Inherited = false) +] +public class BindingEntity: System.Attribute +{ + public static bool IsBindingEntity(System.Type t) + { + return Attribute.GetCustomAttribute(t, typeof(BindingEntity), false) != null; + } +} + public interface IWrapper { /// Pointer to internal Eo instance.