[EflSharp] Update Circle and efl cs files (#819)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_duplicate.eo.cs
1 #pragma warning disable CS1591
2 using System;
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Threading;
7 using System.ComponentModel;
8 namespace Efl {
9
10 /// <summary>An interface for duplication of objects.
11 /// Objects implementing this interface can be duplicated with <see cref="Efl.IDuplicate.Duplicate"/>.</summary>
12 [Efl.IDuplicateConcrete.NativeMethods]
13 public interface IDuplicate : 
14     Efl.Eo.IWrapper, IDisposable
15 {
16     /// <summary>Creates a carbon copy of this object and returns it.
17 /// The newly created object will have no event handlers or anything of the sort.</summary>
18 /// <returns>Returned carbon copy</returns>
19 Efl.IDuplicate Duplicate();
20     }
21 /// <summary>An interface for duplication of objects.
22 /// Objects implementing this interface can be duplicated with <see cref="Efl.IDuplicate.Duplicate"/>.</summary>
23 sealed public class IDuplicateConcrete : 
24
25 IDuplicate
26     
27 {
28     ///<summary>Pointer to the native class description.</summary>
29     public System.IntPtr NativeClass
30     {
31         get
32         {
33             if (((object)this).GetType() == typeof(IDuplicateConcrete))
34             {
35                 return GetEflClassStatic();
36             }
37             else
38             {
39                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
40             }
41         }
42     }
43
44     private  System.IntPtr handle;
45     ///<summary>Pointer to the native instance.</summary>
46     public System.IntPtr NativeHandle
47     {
48         get { return handle; }
49     }
50
51     [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
52         efl_duplicate_interface_get();
53     /// <summary>Initializes a new instance of the <see cref="IDuplicate"/> class.
54     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
55     private IDuplicateConcrete(System.IntPtr raw)
56     {
57         handle = raw;
58     }
59     ///<summary>Destructor.</summary>
60     ~IDuplicateConcrete()
61     {
62         Dispose(false);
63     }
64
65     ///<summary>Releases the underlying native instance.</summary>
66     private void Dispose(bool disposing)
67     {
68         if (handle != System.IntPtr.Zero)
69         {
70             IntPtr h = handle;
71             handle = IntPtr.Zero;
72
73             IntPtr gcHandlePtr = IntPtr.Zero;
74             if (disposing)
75             {
76                 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
77             }
78             else
79             {
80                 Monitor.Enter(Efl.All.InitLock);
81                 if (Efl.All.MainLoopInitialized)
82                 {
83                     Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
84                 }
85
86                 Monitor.Exit(Efl.All.InitLock);
87             }
88         }
89
90     }
91
92     ///<summary>Releases the underlying native instance.</summary>
93     public void Dispose()
94     {
95         Dispose(true);
96         GC.SuppressFinalize(this);
97     }
98
99     /// <summary>Verifies if the given object is equal to this one.</summary>
100     /// <param name="instance">The object to compare to.</param>
101     /// <returns>True if both objects point to the same native object.</returns>
102     public override bool Equals(object instance)
103     {
104         var other = instance as Efl.Object;
105         if (other == null)
106         {
107             return false;
108         }
109         return this.NativeHandle == other.NativeHandle;
110     }
111
112     /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
113     /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
114     public override int GetHashCode()
115     {
116         return this.NativeHandle.ToInt32();
117     }
118
119     /// <summary>Turns the native pointer into a string representation.</summary>
120     /// <returns>A string with the type and the native pointer for this object.</returns>
121     public override String ToString()
122     {
123         return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
124     }
125
126     /// <summary>Creates a carbon copy of this object and returns it.
127     /// The newly created object will have no event handlers or anything of the sort.</summary>
128     /// <returns>Returned carbon copy</returns>
129     public Efl.IDuplicate Duplicate() {
130          var _ret_var = Efl.IDuplicateConcrete.NativeMethods.efl_duplicate_ptr.Value.Delegate(this.NativeHandle);
131         Eina.Error.RaiseIfUnhandledException();
132         return _ret_var;
133  }
134     private static IntPtr GetEflClassStatic()
135     {
136         return Efl.IDuplicateConcrete.efl_duplicate_interface_get();
137     }
138     /// <summary>Wrapper for native methods and virtual method delegates.
139     /// For internal use by generated code only.</summary>
140     public class NativeMethods  : Efl.Eo.NativeClass
141     {
142         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
143         /// <summary>Gets the list of Eo operations to override.</summary>
144         /// <returns>The list of Eo operations to be overload.</returns>
145         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
146         {
147             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
148             var methods = Efl.Eo.Globals.GetUserMethods(type);
149
150             if (efl_duplicate_static_delegate == null)
151             {
152                 efl_duplicate_static_delegate = new efl_duplicate_delegate(duplicate);
153             }
154
155             if (methods.FirstOrDefault(m => m.Name == "Duplicate") != null)
156             {
157                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_duplicate"), func = Marshal.GetFunctionPointerForDelegate(efl_duplicate_static_delegate) });
158             }
159
160             return descs;
161         }
162         /// <summary>Returns the Eo class for the native methods of this class.</summary>
163         /// <returns>The native class pointer.</returns>
164         public override IntPtr GetEflClass()
165         {
166             return Efl.IDuplicateConcrete.efl_duplicate_interface_get();
167         }
168
169         #pragma warning disable CA1707, SA1300, SA1600
170
171         [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.OwnTag>))]
172         private delegate Efl.IDuplicate efl_duplicate_delegate(System.IntPtr obj, System.IntPtr pd);
173
174         [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.OwnTag>))]
175         public delegate Efl.IDuplicate efl_duplicate_api_delegate(System.IntPtr obj);
176
177         public static Efl.Eo.FunctionWrapper<efl_duplicate_api_delegate> efl_duplicate_ptr = new Efl.Eo.FunctionWrapper<efl_duplicate_api_delegate>(Module, "efl_duplicate");
178
179         private static Efl.IDuplicate duplicate(System.IntPtr obj, System.IntPtr pd)
180         {
181             Eina.Log.Debug("function efl_duplicate was called");
182             Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
183             if (wrapper != null)
184             {
185             Efl.IDuplicate _ret_var = default(Efl.IDuplicate);
186                 try
187                 {
188                     _ret_var = ((IDuplicate)wrapper).Duplicate();
189                 }
190                 catch (Exception e)
191                 {
192                     Eina.Log.Warning($"Callback error: {e.ToString()}");
193                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
194                 }
195
196         return _ret_var;
197
198             }
199             else
200             {
201                 return efl_duplicate_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
202             }
203         }
204
205         private static efl_duplicate_delegate efl_duplicate_static_delegate;
206
207         #pragma warning restore CA1707, SA1300, SA1600
208
209 }
210 }
211 }
212