From 0e6e9838089ec09321f948f6c46826bd444664e9 Mon Sep 17 00:00:00 2001 From: Bruno da Silva Belo Date: Mon, 4 Nov 2019 14:40:18 -0300 Subject: [PATCH] csharp: Changing visibility of nested class/struct Reviewers: felipealmeida, lauromoura, YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8393 Differential Revision: https://phab.enlightenment.org/D10588 --- src/bin/eolian_mono/eolian/mono/klass.hh | 6 ++-- .../eolian/mono/struct_definition.hh | 2 +- src/bindings/mono/eina_mono/eina_log.cs | 4 +-- .../mono/eldbus_mono/eldbus_common.cs | 34 +++++++++---------- src/bindings/mono/eo_mono/EoWrapper.cs | 4 +-- src/bindings/mono/eo_mono/iwrapper.cs | 28 ++++++++------- src/tests/efl_mono/Model.cs | 4 +-- 7 files changed, 42 insertions(+), 40 deletions(-) diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh index 1697ace234..f2c2c5ab7d 100644 --- a/src/bin/eolian_mono/eolian/mono/klass.hh +++ b/src/bin/eolian_mono/eolian/mono/klass.hh @@ -232,7 +232,7 @@ struct klass << scope_tab << "/// Initializes a new instance of the class.\n" << scope_tab << "/// Internal usage: This is used when interacting with C code and should not be used directly.\n" << scope_tab << "/// The native pointer to be wrapped.\n" - << scope_tab << "private " << concrete_name << "(Efl.Eo.Globals.WrappingHandle wh) : base(wh)\n" + << scope_tab << "private " << concrete_name << "(Efl.Eo.WrappingHandle wh) : base(wh)\n" << scope_tab << "{\n" << scope_tab << "}\n\n" ) @@ -580,7 +580,7 @@ struct klass << scope_tab << "/// Initializes a new instance of the class.\n" << scope_tab << "/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.\n" << scope_tab << "/// The native pointer to be wrapped.\n" - << scope_tab << "protected " << inherit_name << "(Efl.Eo.Globals.WrappingHandle wh) : base(wh)\n" + << scope_tab << "internal " << inherit_name << "(Efl.Eo.WrappingHandle wh) : base(wh)\n" << scope_tab << "{\n" << scope_tab << "}\n\n" ).generate(sink, std::make_tuple(constructors, constructors, constructors), context)) @@ -595,7 +595,7 @@ struct klass scope_tab << "[Efl.Eo.PrivateNativeClass]\n" << scope_tab << "private class " << inherit_name << "Realized : " << inherit_name << "\n" << scope_tab << "{\n" - << scope_tab << scope_tab << "private " << inherit_name << "Realized(Efl.Eo.Globals.WrappingHandle wh) : base(wh)\n" + << scope_tab << scope_tab << "private " << inherit_name << "Realized(Efl.Eo.WrappingHandle wh) : base(wh)\n" << scope_tab << scope_tab << "{\n" << scope_tab << scope_tab << "}\n" << scope_tab << "}\n" diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh index 45c1747650..c733432465 100644 --- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh +++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh @@ -291,7 +291,7 @@ struct struct_internal_definition_generator indent << "#pragma warning disable CS1591\n\n" << indent << "/// Internal wrapper for struct " << string << ".\n" << indent << "[StructLayout(LayoutKind.Sequential)]\n" - << indent << "public struct " << string << "\n" + << indent << "internal struct " << string << "\n" << indent << "{\n" ) .generate(sink, std::make_tuple<>(binding_struct_name(struct_), struct_internal_decl_name()), context)) diff --git a/src/bindings/mono/eina_mono/eina_log.cs b/src/bindings/mono/eina_mono/eina_log.cs index 60e805412c..2174c65c20 100644 --- a/src/bindings/mono/eina_mono/eina_log.cs +++ b/src/bindings/mono/eina_mono/eina_log.cs @@ -79,7 +79,7 @@ public static class Log /// The colors to be used by the logging system. /// Since EFL 1.23. /// - public static class Color + internal static class Color { /// Light red /// Since EFL 1.23. @@ -139,7 +139,7 @@ public static class Log static Log() { const String name = "mono"; - const String color = "\033[32;1m"; + const String color = Color.GREEN; // Maybe move this check outside when other eina stuff get support? domain = eina_log_domain_register(name, color); diff --git a/src/bindings/mono/eldbus_mono/eldbus_common.cs b/src/bindings/mono/eldbus_mono/eldbus_common.cs index eeff8654ca..562f61a4e3 100644 --- a/src/bindings/mono/eldbus_mono/eldbus_common.cs +++ b/src/bindings/mono/eldbus_mono/eldbus_common.cs @@ -178,7 +178,7 @@ public static class Argument /// The type of a byte. /// Since EFL 1.23. /// - public static class ByteType + internal static class ByteType { /// /// The code of the byte. @@ -196,7 +196,7 @@ public static class Argument /// The type of a boolean /// Since EFL 1.23. /// - public static class BooleanType + internal static class BooleanType { /// /// The code of the boolean. @@ -214,7 +214,7 @@ public static class Argument /// The type of a Int16. /// Since EFL 1.23. /// - public static class Int16Type + internal static class Int16Type { /// /// The code of the Int16. @@ -232,7 +232,7 @@ public static class Argument /// The type of an unsigned Int16. /// Since EFL 1.23. /// - public static class UInt16Type + internal static class UInt16Type { /// /// The code of the unsigned Int16. @@ -250,7 +250,7 @@ public static class Argument /// The type of a Int32. /// Since EFL 1.23. /// - public static class Int32Type + internal static class Int32Type { /// /// The code of the Int32. @@ -268,7 +268,7 @@ public static class Argument /// The type of an unsigned Int32. /// Since EFL 1.23. /// - public static class UInt32Type + internal static class UInt32Type { /// /// The code of the unsigned Int32. @@ -286,7 +286,7 @@ public static class Argument /// The type of a Int64. /// Since EFL 1.23. /// - public static class Int64Type + internal static class Int64Type { /// /// The code of the Int64. @@ -304,7 +304,7 @@ public static class Argument /// The type of an unsigned Int64. /// Since EFL 1.23. /// - public static class UInt64Type + internal static class UInt64Type { /// /// The code of the unsigned Int64. @@ -322,7 +322,7 @@ public static class Argument /// The type of the double. /// Since EFL 1.23. /// - public static class DoubleType + internal static class DoubleType { /// /// The code of the double. @@ -340,7 +340,7 @@ public static class Argument /// The type of a string. /// Since EFL 1.23. /// - public static class StringType + internal static class StringType { /// /// The code of the string. @@ -358,7 +358,7 @@ public static class Argument /// The type of an object path. /// Since EFL 1.23. /// - public static class ObjectPathType + internal static class ObjectPathType { /// /// The code of the object path. @@ -376,7 +376,7 @@ public static class Argument /// The type of a signature. /// Since EFL 1.23. /// - public static class SignatureType + internal static class SignatureType { /// /// The code of the signature. @@ -394,7 +394,7 @@ public static class Argument /// The type of a array. /// Since EFL 1.23. /// - public static class ArrayType + internal static class ArrayType { /// /// The code of the array. @@ -412,7 +412,7 @@ public static class Argument /// The type of a struct. /// Since EFL 1.23. /// - public static class StructType + internal static class StructType { /// /// The code of the struct. @@ -430,7 +430,7 @@ public static class Argument /// The type of a variant. /// Since EFL 1.23. /// - public static class VariantType + internal static class VariantType { /// /// The code of the variant. @@ -448,7 +448,7 @@ public static class Argument /// The type of a dictionary. /// Since EFL 1.23. /// - public static class DictEntryType + internal static class DictEntryType { /// /// The code of the dictionary. @@ -466,7 +466,7 @@ public static class Argument /// The type of an unix file descriptor. /// Since EFL 1.23. /// - public static class UnixFdType + internal static class UnixFdType { /// /// The code of unix fd. diff --git a/src/bindings/mono/eo_mono/EoWrapper.cs b/src/bindings/mono/eo_mono/EoWrapper.cs index d49a5b5b42..621a8bca68 100644 --- a/src/bindings/mono/eo_mono/EoWrapper.cs +++ b/src/bindings/mono/eo_mono/EoWrapper.cs @@ -81,7 +81,7 @@ public abstract class EoWrapper : IWrapper, IDisposable /// Since EFL 1.23. /// /// The native pointer to be wrapped. - protected EoWrapper(Efl.Eo.Globals.WrappingHandle wh) + internal EoWrapper(Efl.Eo.WrappingHandle wh) { handle = wh.NativeHandle; AddWrapperSupervisor(); @@ -485,7 +485,7 @@ public abstract class EoWrapper : IWrapper, IDisposable /// But as is abstract, whis realized class will allow us to create C# instances of it. internal class ObjectRealized : Efl.Object { - protected ObjectRealized(Efl.Eo.Globals.WrappingHandle ch) : base(ch) { } + internal ObjectRealized(Efl.Eo.WrappingHandle ch) : base(ch) { } } } // namespace Efl diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs index f886167f31..4e3e2e4486 100644 --- a/src/bindings/mono/eo_mono/iwrapper.cs +++ b/src/bindings/mono/eo_mono/iwrapper.cs @@ -759,23 +759,25 @@ public static class Globals Monitor.Exit(Efl.All.InitLock); } - /// - /// Internal struct used by the binding to pass the native handle pointer - /// to the managed object wrapping constructor. - /// Internal usage only: do not use this class in inherited classes. - /// - public struct WrappingHandle - { - public WrappingHandle(IntPtr h) - { - NativeHandle = h; - } - public IntPtr NativeHandle { get; private set; } - } } // Globals +/// +/// Internal struct used by the binding to pass the native handle pointer +/// to the managed object wrapping constructor. +/// Internal usage only: do not use this class in inherited classes. +/// +internal struct WrappingHandle +{ + public WrappingHandle(IntPtr h) + { + NativeHandle = h; + } + + public IntPtr NativeHandle { get; private set; } +} + public static class Config { diff --git a/src/tests/efl_mono/Model.cs b/src/tests/efl_mono/Model.cs index 63d28d408f..144318b8a1 100644 --- a/src/tests/efl_mono/Model.cs +++ b/src/tests/efl_mono/Model.cs @@ -9,9 +9,9 @@ using System.Diagnostics.CodeAnalysis; namespace TestSuite { [SuppressMessage("Gendarme.Rules.Portability", "DoNotHardcodePathsRule")] -public class TestModel { +public static class TestModel { - public class VeggieViewModel + private class VeggieViewModel { public string Name { get; set; } public string Type { get; set; }