[EflSharp] Update Circle and efl cs files (#819)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_file_save.eo.cs
index b0ed7fd..1e5d11f 100644 (file)
@@ -3,11 +3,13 @@ using System;
 using System.Runtime.InteropServices;
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading;
 using System.ComponentModel;
-namespace Efl { 
+namespace Efl {
+
 /// <summary>Efl file saving interface
 /// (Since EFL 1.22)</summary>
-[IFileSaveNativeInherit]
+[Efl.IFileSaveConcrete.NativeMethods]
 public interface IFileSave : 
     Efl.Eo.IWrapper, IDisposable
 {
@@ -20,7 +22,7 @@ public interface IFileSave :
 /// <param name="key">The image key in the file (if an Eet one), or <c>null</c>, otherwise.</param>
 /// <param name="info">The flags to be used (<c>null</c> for defaults).</param>
 /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
-bool Save( System.String file,  System.String key,  ref Efl.FileSaveInfo info);
+bool Save(System.String file, System.String key, ref Efl.FileSaveInfo info);
     }
 /// <summary>Efl file saving interface
 /// (Since EFL 1.22)</summary>
@@ -30,68 +32,103 @@ IFileSave
     
 {
     ///<summary>Pointer to the native class description.</summary>
-    public System.IntPtr NativeClass {
-        get {
-            if (((object)this).GetType() == typeof (IFileSaveConcrete))
-                return Efl.IFileSaveNativeInherit.GetEflClassStatic();
+    public System.IntPtr NativeClass
+    {
+        get
+        {
+            if (((object)this).GetType() == typeof(IFileSaveConcrete))
+            {
+                return GetEflClassStatic();
+            }
             else
+            {
                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
+            }
         }
     }
+
     private  System.IntPtr handle;
     ///<summary>Pointer to the native instance.</summary>
-    public System.IntPtr NativeHandle {
+    public System.IntPtr NativeHandle
+    {
         get { return handle; }
     }
+
     [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
         efl_file_save_interface_get();
-    ///<summary>Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
+    /// <summary>Initializes a new instance of the <see cref="IFileSave"/> class.
+    /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
     private IFileSaveConcrete(System.IntPtr raw)
     {
         handle = raw;
-        RegisterEventProxies();
     }
     ///<summary>Destructor.</summary>
     ~IFileSaveConcrete()
     {
         Dispose(false);
     }
+
     ///<summary>Releases the underlying native instance.</summary>
-    void Dispose(bool disposing)
+    private void Dispose(bool disposing)
     {
-        if (handle != System.IntPtr.Zero) {
-            Efl.Eo.Globals.efl_unref(handle);
-            handle = System.IntPtr.Zero;
+        if (handle != System.IntPtr.Zero)
+        {
+            IntPtr h = handle;
+            handle = IntPtr.Zero;
+
+            IntPtr gcHandlePtr = IntPtr.Zero;
+            if (disposing)
+            {
+                Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
+            }
+            else
+            {
+                Monitor.Enter(Efl.All.InitLock);
+                if (Efl.All.MainLoopInitialized)
+                {
+                    Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
+                }
+
+                Monitor.Exit(Efl.All.InitLock);
+            }
         }
+
     }
+
     ///<summary>Releases the underlying native instance.</summary>
     public void Dispose()
     {
         Dispose(true);
         GC.SuppressFinalize(this);
     }
-    ///<summary>Verifies if the given object is equal to this one.</summary>
-    public override bool Equals(object obj)
+
+    /// <summary>Verifies if the given object is equal to this one.</summary>
+    /// <param name="instance">The object to compare to.</param>
+    /// <returns>True if both objects point to the same native object.</returns>
+    public override bool Equals(object instance)
     {
-        var other = obj as Efl.Object;
+        var other = instance as Efl.Object;
         if (other == null)
+        {
             return false;
+        }
         return this.NativeHandle == other.NativeHandle;
     }
-    ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
+
+    /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
+    /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
     public override int GetHashCode()
     {
         return this.NativeHandle.ToInt32();
     }
-    ///<summary>Turns the native pointer into a string representation.</summary>
+
+    /// <summary>Turns the native pointer into a string representation.</summary>
+    /// <returns>A string with the type and the native pointer for this object.</returns>
     public override String ToString()
     {
         return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
     }
-    ///<summary>Register the Eo event wrappers making the bridge to C# events. Internal usage only.</summary>
-     void RegisterEventProxies()
-    {
-    }
+
     /// <summary>Save the given image object&apos;s contents to an (image) file.
     /// The extension suffix on <c>file</c> will determine which saver module Evas is to use when saving, thus the final file&apos;s format. If the file supports multiple data stored in it (Eet ones), you can specify the key to be used as the index of the image in it.
     /// 
@@ -101,9 +138,9 @@ IFileSave
     /// <param name="key">The image key in the file (if an Eet one), or <c>null</c>, otherwise.</param>
     /// <param name="info">The flags to be used (<c>null</c> for defaults).</param>
     /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
-    public bool Save( System.String file,  System.String key,  ref Efl.FileSaveInfo info) {
+    public bool Save(System.String file, System.String key, ref Efl.FileSaveInfo info) {
                          Efl.FileSaveInfo.NativeStruct _in_info = info;
-                                                        var _ret_var = Efl.IFileSaveNativeInherit.efl_file_save_ptr.Value.Delegate(this.NativeHandle, file,  key,  ref _in_info);
+                                                        var _ret_var = Efl.IFileSaveConcrete.NativeMethods.efl_file_save_ptr.Value.Delegate(this.NativeHandle,file, key, ref _in_info);
         Eina.Error.RaiseIfUnhandledException();
                                                 info = _in_info;
         return _ret_var;
@@ -112,57 +149,85 @@ IFileSave
     {
         return Efl.IFileSaveConcrete.efl_file_save_interface_get();
     }
-}
-public class IFileSaveNativeInherit  : Efl.Eo.NativeClass{
-    public  static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Efl);
-    public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
-    {
-        var descs = new System.Collections.Generic.List<Efl_Op_Description>();
-        var methods = Efl.Eo.Globals.GetUserMethods(type);
-        if (efl_file_save_static_delegate == null)
-            efl_file_save_static_delegate = new efl_file_save_delegate(save);
-        if (methods.FirstOrDefault(m => m.Name == "Save") != null)
-            descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_file_save"), func = Marshal.GetFunctionPointerForDelegate(efl_file_save_static_delegate)});
-        return descs;
-    }
-    public override IntPtr GetEflClass()
-    {
-        return Efl.IFileSaveConcrete.efl_file_save_interface_get();
-    }
-    public static  IntPtr GetEflClassStatic()
+    /// <summary>Wrapper for native methods and virtual method delegates.
+    /// For internal use by generated code only.</summary>
+    public class NativeMethods  : Efl.Eo.NativeClass
     {
-        return Efl.IFileSaveConcrete.efl_file_save_interface_get();
-    }
+        private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
+        /// <summary>Gets the list of Eo operations to override.</summary>
+        /// <returns>The list of Eo operations to be overload.</returns>
+        public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
+        {
+            var descs = new System.Collections.Generic.List<Efl_Op_Description>();
+            var methods = Efl.Eo.Globals.GetUserMethods(type);
 
+            if (efl_file_save_static_delegate == null)
+            {
+                efl_file_save_static_delegate = new efl_file_save_delegate(save);
+            }
 
-     [return: MarshalAs(UnmanagedType.U1)] private delegate bool efl_file_save_delegate(System.IntPtr obj, System.IntPtr pd,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String file,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String key,   ref Efl.FileSaveInfo.NativeStruct info);
+            if (methods.FirstOrDefault(m => m.Name == "Save") != null)
+            {
+                descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_file_save"), func = Marshal.GetFunctionPointerForDelegate(efl_file_save_static_delegate) });
+            }
 
+            return descs;
+        }
+        /// <summary>Returns the Eo class for the native methods of this class.</summary>
+        /// <returns>The native class pointer.</returns>
+        public override IntPtr GetEflClass()
+        {
+            return Efl.IFileSaveConcrete.efl_file_save_interface_get();
+        }
 
-     [return: MarshalAs(UnmanagedType.U1)] public delegate bool efl_file_save_api_delegate(System.IntPtr obj,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String file,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String key,   ref Efl.FileSaveInfo.NativeStruct info);
-     public static Efl.Eo.FunctionWrapper<efl_file_save_api_delegate> efl_file_save_ptr = new Efl.Eo.FunctionWrapper<efl_file_save_api_delegate>(_Module, "efl_file_save");
-     private static bool save(System.IntPtr obj, System.IntPtr pd,  System.String file,  System.String key,  ref Efl.FileSaveInfo.NativeStruct info)
-    {
-        Eina.Log.Debug("function efl_file_save was called");
-        Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
-        if(wrapper != null) {
-                                    Efl.FileSaveInfo _in_info = info;
+        #pragma warning disable CA1707, SA1300, SA1600
+
+        [return: MarshalAs(UnmanagedType.U1)]
+        private delegate bool efl_file_save_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key,  ref Efl.FileSaveInfo.NativeStruct info);
+
+        [return: MarshalAs(UnmanagedType.U1)]
+        public delegate bool efl_file_save_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key,  ref Efl.FileSaveInfo.NativeStruct info);
+
+        public static Efl.Eo.FunctionWrapper<efl_file_save_api_delegate> efl_file_save_ptr = new Efl.Eo.FunctionWrapper<efl_file_save_api_delegate>(Module, "efl_file_save");
+
+        private static bool save(System.IntPtr obj, System.IntPtr pd, System.String file, System.String key, ref Efl.FileSaveInfo.NativeStruct info)
+        {
+            Eina.Log.Debug("function efl_file_save was called");
+            Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
+            if (wrapper != null)
+            {
+                        Efl.FileSaveInfo _in_info = info;
                                                             bool _ret_var = default(bool);
-            try {
-                _ret_var = ((IFileSave)wrapper).Save( file,  key,  ref _in_info);
-            } catch (Exception e) {
-                Eina.Log.Warning($"Callback error: {e.ToString()}");
-                Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
-            }
+                try
+                {
+                    _ret_var = ((IFileSave)wrapper).Save(file, key, ref _in_info);
+                }
+                catch (Exception e)
+                {
+                    Eina.Log.Warning($"Callback error: {e.ToString()}");
+                    Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
+                }
+
                                                 info = _in_info;
         return _ret_var;
-        } else {
-            return efl_file_save_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)),  file,  key,  ref info);
+
+            }
+            else
+            {
+                return efl_file_save_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), file, key, ref info);
+            }
         }
-    }
-    private static efl_file_save_delegate efl_file_save_static_delegate;
+
+        private static efl_file_save_delegate efl_file_save_static_delegate;
+
+        #pragma warning restore CA1707, SA1300, SA1600
+
+}
 }
-} 
-namespace Efl { 
+}
+
+namespace Efl {
+
 /// <summary>Info used to determine various attributes when saving a file.
 /// (Since EFL 1.22)</summary>
 [StructLayout(LayoutKind.Sequential)]
@@ -176,9 +241,9 @@ public struct FileSaveInfo
     public System.String Encoding;
     ///<summary>Constructor for FileSaveInfo.</summary>
     public FileSaveInfo(
-        uint Quality=default(uint),
-        uint Compression=default(uint),
-        System.String Encoding=default(System.String)    )
+        uint Quality = default(uint),
+        uint Compression = default(uint),
+        System.String Encoding = default(System.String)    )
     {
         this.Quality = Quality;
         this.Compression = Compression;
@@ -225,4 +290,5 @@ public struct FileSaveInfo
 
 }
 
-} 
+}
+