csharp: Changing visibility of nested class/struct
authorBruno da Silva Belo <bruno.belo@expertisesolutions.com.br>
Mon, 4 Nov 2019 17:40:18 +0000 (14:40 -0300)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 11 Nov 2019 02:20:41 +0000 (11:20 +0900)
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
src/bin/eolian_mono/eolian/mono/struct_definition.hh
src/bindings/mono/eina_mono/eina_log.cs
src/bindings/mono/eldbus_mono/eldbus_common.cs
src/bindings/mono/eo_mono/EoWrapper.cs
src/bindings/mono/eo_mono/iwrapper.cs
src/tests/efl_mono/Model.cs

index 1697ace..f2c2c5a 100644 (file)
@@ -232,7 +232,7 @@ struct klass
              << scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << interface_name << "\"/> class.\n"
              << scope_tab << "/// Internal usage: This is used when interacting with C code and should not be used directly.</summary>\n"
              << scope_tab << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\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 << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> 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.</summary>\n"
                      << scope_tab << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\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"
index 45c1747..c733432 100644 (file)
@@ -291,7 +291,7 @@ struct struct_internal_definition_generator
           indent << "#pragma warning disable CS1591\n\n"
           << indent << "/// <summary>Internal wrapper for struct " << string << ".</summary>\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))
index 60e8054..2174c65 100644 (file)
@@ -79,7 +79,7 @@ public static class Log
     /// <summary>The colors to be used by the logging system.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class Color
+    internal static class Color
     {
         /// <summary>Light red
         /// <para>Since EFL 1.23.</para>
@@ -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);
index eeff865..562f61a 100644 (file)
@@ -178,7 +178,7 @@ public static class Argument
     /// The type of a byte.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class ByteType
+    internal static class ByteType
     {
         /// <summary>
         /// The code of the byte.
@@ -196,7 +196,7 @@ public static class Argument
     /// The type of a boolean
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class BooleanType
+    internal static class BooleanType
     {
         /// <summary>
         /// The code of the boolean.
@@ -214,7 +214,7 @@ public static class Argument
     /// The type of a Int16.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class Int16Type
+    internal static class Int16Type
     {
         /// <summary>
         /// The code of the Int16.
@@ -232,7 +232,7 @@ public static class Argument
     /// The type of an unsigned Int16.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class UInt16Type
+    internal static class UInt16Type
     {
         /// <summary>
         /// The code of the unsigned Int16.
@@ -250,7 +250,7 @@ public static class Argument
     /// The type of a Int32.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class Int32Type
+    internal static class Int32Type
     {
         /// <summary>
         /// The code of the Int32.
@@ -268,7 +268,7 @@ public static class Argument
     /// The type of an unsigned Int32.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class UInt32Type
+    internal static class UInt32Type
     {
         /// <summary>
         /// The code of the unsigned Int32.
@@ -286,7 +286,7 @@ public static class Argument
     /// The type of a Int64.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class Int64Type
+    internal static class Int64Type
     {
         /// <summary>
         /// The code of the Int64.
@@ -304,7 +304,7 @@ public static class Argument
     /// The type of an unsigned Int64.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class UInt64Type
+    internal static class UInt64Type
     {
         /// <summary>
         /// The code of the unsigned Int64.
@@ -322,7 +322,7 @@ public static class Argument
     /// The type of the double.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class DoubleType
+    internal static class DoubleType
     {
         /// <summary>
         /// The code of the double.
@@ -340,7 +340,7 @@ public static class Argument
     /// The type of a string.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class StringType
+    internal static class StringType
     {
         /// <summary>
         /// The code of the string.
@@ -358,7 +358,7 @@ public static class Argument
     /// The type of an object path.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class ObjectPathType
+    internal static class ObjectPathType
     {
         /// <summary>
         /// The code of the object path.
@@ -376,7 +376,7 @@ public static class Argument
     /// The type of a signature.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class SignatureType
+    internal static class SignatureType
     {
         /// <summary>
         /// The code of the signature.
@@ -394,7 +394,7 @@ public static class Argument
     /// The type of a array.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class ArrayType
+    internal static class ArrayType
     {
         /// <summary>
         /// The code of the array.
@@ -412,7 +412,7 @@ public static class Argument
     /// The type of a struct.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class StructType
+    internal static class StructType
     {
         /// <summary>
         /// The code of the struct.
@@ -430,7 +430,7 @@ public static class Argument
     /// The type of a variant.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class VariantType
+    internal static class VariantType
     {
         /// <summary>
         /// The code of the variant.
@@ -448,7 +448,7 @@ public static class Argument
     /// The type of a dictionary.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class DictEntryType
+    internal static class DictEntryType
     {
         /// <summary>
         /// The code of the dictionary.
@@ -466,7 +466,7 @@ public static class Argument
     /// The type of an unix file descriptor.
     /// <para>Since EFL 1.23.</para>
     /// </summary>
-    public static class UnixFdType
+    internal static class UnixFdType
     {
         /// <summary>
         /// The code of unix fd.
index d49a5b5..621a8bc 100644 (file)
@@ -81,7 +81,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
     /// <para>Since EFL 1.23.</para>
     /// </summary>
     /// <param name="wh">The native pointer to be wrapped.</param>
-    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 <see cref="Efl.Object" /> is abstract, whis realized class will allow us to create C# instances of it.</summary>
 internal class ObjectRealized : Efl.Object
 {
-    protected ObjectRealized(Efl.Eo.Globals.WrappingHandle ch) : base(ch) { }
+    internal ObjectRealized(Efl.Eo.WrappingHandle ch) : base(ch) { }
 }
 
 } // namespace Efl
index f886167..4e3e2e4 100644 (file)
@@ -759,23 +759,25 @@ public static class Globals
         Monitor.Exit(Efl.All.InitLock);
     }
 
-    /// <summary>
-    /// 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.
-    /// </summary>
-    public struct WrappingHandle
-    {
-        public WrappingHandle(IntPtr h)
-        {
-            NativeHandle = h;
-        }
 
-        public IntPtr NativeHandle { get; private set; }
-    }
 
 } // Globals
 
+/// <summary>
+/// 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.
+/// </summary>
+internal struct WrappingHandle
+{
+    public WrappingHandle(IntPtr h)
+    {
+        NativeHandle = h;
+    }
+
+    public IntPtr NativeHandle { get; private set; }
+}
+
 public static class Config
 {
 
index 63d28d4..144318b 100644 (file)
@@ -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; }