diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-03-21 14:38:45 -0300 |
---|---|---|
committer | Vitor Sousa <vitorsousa@expertisesolutions.com.br> | 2019-03-21 14:48:33 -0300 |
commit | 0881d1524b6d3996a29b68820690f97821116585 (patch) | |
tree | c3fa39f72ad50b7f6ac0a0eb8652ba539af1c5a3 /src/bindings | |
parent | f36d8b9bb1792730bc96c2cf07126361ccfe4ebe (diff) | |
download | efl-0881d1524b6d3996a29b68820690f97821116585.tar.gz |
efl-csharp: Add back I prefix for interfaces.
Summary:
Conforming to C# coding conventions.
For properties, now we only generate a wrapper if its name does not
clash with the name of the class that would be implementing it.
Fixes T7751
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7751
Differential Revision: https://phab.enlightenment.org/D8397
Diffstat (limited to 'src/bindings')
-rw-r--r-- | src/bindings/mono/eo_mono/iwrapper.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index 13f82cf090..3120dbbbf7 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -12,6 +12,21 @@ using EoG = Efl.Eo.Globals; namespace Efl { namespace Eo { public class Globals { + + /// <summary>Represents the type of the native Efl_Class.</summary> + public enum EflClassType { + /// <summary>Regular EFL classes.</summary> + Regular = 0, + /// <summary>Non-instantiable efl classes (i.e. Abstracts).</summary> + RegularNoInstant, + /// <summary>Interface types.</summary> + Interface, + /// <summary>Mixins types.</summary> + Mixin, + /// <summary>Invalid class type.</summary> + Invalid + } + [return: MarshalAs(UnmanagedType.U1)] public delegate bool efl_object_init_delegate(); public static FunctionWrapper<efl_object_init_delegate> efl_object_init_ptr = @@ -155,6 +170,7 @@ public class Globals { [DllImport(efl.Libs.Eo)] public static extern IntPtr efl_super(IntPtr obj, IntPtr klass); public delegate IntPtr efl_class_get_delegate(IntPtr obj); [DllImport(efl.Libs.Eo)] public static extern IntPtr efl_class_get(IntPtr obj); + [DllImport(efl.Libs.Eo)] public static extern EflClassType efl_class_type_get(IntPtr klass); public delegate IntPtr dlerror_delegate(); [DllImport(efl.Libs.Evil)] public static extern IntPtr dlerror(); @@ -542,6 +558,15 @@ public static class ClassRegister string name = Eina.StringConversion.NativeUtf8ToManagedString(namePtr) .Replace("_", ""); // Convert Efl C name to C# name + var klass_type = Efl.Eo.Globals.efl_class_type_get(klass); + + // When converting to managed, interfaces and mixins gets the 'I' prefix. + if (klass_type == Efl.Eo.Globals.EflClassType.Interface || klass_type == Efl.Eo.Globals.EflClassType.Mixin) + { + var pos = name.LastIndexOf("."); + name = name.Insert(pos + 1, "I"); // -1 if not found, inserts at 0 normally + } + var curr_asm = typeof(IWrapper).Assembly; t = curr_asm.GetType(name); if (t == null) |