[EflSharp] Update Circle and efl cs files (#945)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_loop_consumer.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 <see cref="Efl.LoopConsumer"/> is a class which requires one of the parents to provide an <see cref="Efl.Loop"/> interface when performing <see cref="Efl.Object.FindProvider"/>. It will enforce this by only allowing parents which provide such an interface or <c>NULL</c>.
11 /// (Since EFL 1.22)</summary>
12 [Efl.LoopConsumer.NativeMethods]
13 [Efl.Eo.BindingEntity]
14 public abstract class LoopConsumer : Efl.Object
15 {
16     ///<summary>Pointer to the native class description.</summary>
17     public override System.IntPtr NativeClass
18     {
19         get
20         {
21             if (((object)this).GetType() == typeof(LoopConsumer))
22             {
23                 return GetEflClassStatic();
24             }
25             else
26             {
27                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
28             }
29         }
30     }
31
32     [System.Runtime.InteropServices.DllImport(efl.Libs.Ecore)] internal static extern System.IntPtr
33         efl_loop_consumer_class_get();
34     /// <summary>Initializes a new instance of the <see cref="LoopConsumer"/> class.</summary>
35     /// <param name="parent">Parent instance.</param>
36     public LoopConsumer(Efl.Object parent= null
37             ) : base(efl_loop_consumer_class_get(), parent)
38     {
39         FinishInstantiation();
40     }
41
42     /// <summary>Constructor to be used when objects are expected to be constructed from native code.</summary>
43     /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
44     protected LoopConsumer(ConstructingHandle ch) : base(ch)
45     {
46     }
47
48     /// <summary>Initializes a new instance of the <see cref="LoopConsumer"/> class.
49     /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
50     /// <param name="wh">The native pointer to be wrapped.</param>
51     protected LoopConsumer(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
52     {
53     }
54
55     [Efl.Eo.PrivateNativeClass]
56     private class LoopConsumerRealized : LoopConsumer
57     {
58         private LoopConsumerRealized(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
59         {
60         }
61     }
62     /// <summary>Initializes a new instance of the <see cref="LoopConsumer"/> class.
63     /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
64     /// <param name="baseKlass">The pointer to the base native Eo class.</param>
65     /// <param name="parent">The Efl.Object parent of this instance.</param>
66     protected LoopConsumer(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
67     {
68     }
69
70     /// <summary>Gets a handle to the loop.
71     /// (Since EFL 1.22)</summary>
72     /// <returns>Efl loop</returns>
73     virtual public Efl.Loop GetLoop() {
74          var _ret_var = Efl.LoopConsumer.NativeMethods.efl_loop_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
75         Eina.Error.RaiseIfUnhandledException();
76         return _ret_var;
77  }
78     /// <summary>Creates a new future that is already resolved to a value.
79     /// This function creates a new future with an already known value, that will be resolved and dispatched by the loop scheduler as usual.
80     /// 
81     /// This is a helper that behaves the same as eina_future_resolved.
82     /// (Since EFL 1.22)</summary>
83     /// <param name="result">The value to be delivered.
84     /// Note that the value contents must survive this function scope, that is, do not use stack allocated blobs, arrays, structures or types that keep references to memory you give. Values will be automatically cleaned up using @ref eina_value_flush() once they are unused (no more future or futures returned a new value)</param>
85     /// <returns>The future or <c>NULL</c> on error.</returns>
86     virtual public  Eina.Future FutureResolved(Eina.Value result) {
87          var _in_result = result.GetNative();
88                         var _ret_var = Efl.LoopConsumer.NativeMethods.efl_loop_future_resolved_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),_in_result);
89         Eina.Error.RaiseIfUnhandledException();
90                         return _ret_var;
91  }
92     /// <summary>Creates a new future that is already rejected to a specified error using the <see cref="Efl.LoopConsumer.GetLoop"/>.
93     /// This function creates a new future with an already known error, that will be resolved and dispatched by the loop scheduler as usual.
94     /// 
95     /// This is a helper that behaves the same as @ref eina_future_rejected.
96     /// (Since EFL 1.22)</summary>
97     /// <param name="error">An Eina_Error value</param>
98     /// <returns>The future or <c>NULL</c> on error.</returns>
99     virtual public  Eina.Future FutureRejected(Eina.Error error) {
100                                  var _ret_var = Efl.LoopConsumer.NativeMethods.efl_loop_future_rejected_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),error);
101         Eina.Error.RaiseIfUnhandledException();
102                         return _ret_var;
103  }
104     /// <summary>Create a new promise with the scheduler coming from the loop provided by this object.
105     /// Note: You should not use eina_promise_data_set as this function rely on controlling the promise data.
106     /// (Since EFL 1.22)</summary>
107     /// <returns>The new promise.</returns>
108     virtual public Eina.Promise NewPromise() {
109          var _ret_var = Efl.LoopConsumer.NativeMethods.efl_loop_promise_new_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
110         Eina.Error.RaiseIfUnhandledException();
111         return _ret_var;
112  }
113     /// <summary>Async wrapper for <see cref="FutureResolved" />.</summary>
114     /// <param name="result">The value to be delivered.
115     /// Note that the value contents must survive this function scope, that is, do not use stack allocated blobs, arrays, structures or types that keep references to memory you give. Values will be automatically cleaned up using @ref eina_value_flush() once they are unused (no more future or futures returned a new value)</param>
116     /// <param name="token">Token to notify the async operation of external request to cancel.</param>
117     /// <returns>An async task wrapping the result of the operation.</returns>
118     public System.Threading.Tasks.Task<Eina.Value> FutureResolvedAsync(Eina.Value result, System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
119     {
120         Eina.Future future = FutureResolved( result);
121         return Efl.Eo.Globals.WrapAsync(future, token);
122     }
123
124     /// <summary>Async wrapper for <see cref="FutureRejected" />.</summary>
125     /// <param name="error">An Eina_Error value</param>
126     /// <param name="token">Token to notify the async operation of external request to cancel.</param>
127     /// <returns>An async task wrapping the result of the operation.</returns>
128     public System.Threading.Tasks.Task<Eina.Value> FutureRejectedAsync(Eina.Error error, System.Threading.CancellationToken token = default(System.Threading.CancellationToken))
129     {
130         Eina.Future future = FutureRejected( error);
131         return Efl.Eo.Globals.WrapAsync(future, token);
132     }
133
134     /// <summary>The loop to which this object belongs to.
135     /// (Since EFL 1.22)</summary>
136     /// <value>Efl loop</value>
137     public Efl.Loop Loop {
138         get { return GetLoop(); }
139     }
140     private static IntPtr GetEflClassStatic()
141     {
142         return Efl.LoopConsumer.efl_loop_consumer_class_get();
143     }
144     /// <summary>Wrapper for native methods and virtual method delegates.
145     /// For internal use by generated code only.</summary>
146     public new class NativeMethods : Efl.Object.NativeMethods
147     {
148         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Ecore);
149         /// <summary>Gets the list of Eo operations to override.</summary>
150         /// <returns>The list of Eo operations to be overload.</returns>
151         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
152         {
153             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
154             var methods = Efl.Eo.Globals.GetUserMethods(type);
155
156             if (efl_loop_get_static_delegate == null)
157             {
158                 efl_loop_get_static_delegate = new efl_loop_get_delegate(loop_get);
159             }
160
161             if (methods.FirstOrDefault(m => m.Name == "GetLoop") != null)
162             {
163                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_loop_get"), func = Marshal.GetFunctionPointerForDelegate(efl_loop_get_static_delegate) });
164             }
165
166             if (efl_loop_future_resolved_static_delegate == null)
167             {
168                 efl_loop_future_resolved_static_delegate = new efl_loop_future_resolved_delegate(future_resolved);
169             }
170
171             if (methods.FirstOrDefault(m => m.Name == "FutureResolved") != null)
172             {
173                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_loop_future_resolved"), func = Marshal.GetFunctionPointerForDelegate(efl_loop_future_resolved_static_delegate) });
174             }
175
176             if (efl_loop_future_rejected_static_delegate == null)
177             {
178                 efl_loop_future_rejected_static_delegate = new efl_loop_future_rejected_delegate(future_rejected);
179             }
180
181             if (methods.FirstOrDefault(m => m.Name == "FutureRejected") != null)
182             {
183                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_loop_future_rejected"), func = Marshal.GetFunctionPointerForDelegate(efl_loop_future_rejected_static_delegate) });
184             }
185
186             if (efl_loop_promise_new_static_delegate == null)
187             {
188                 efl_loop_promise_new_static_delegate = new efl_loop_promise_new_delegate(promise_new);
189             }
190
191             if (methods.FirstOrDefault(m => m.Name == "NewPromise") != null)
192             {
193                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_loop_promise_new"), func = Marshal.GetFunctionPointerForDelegate(efl_loop_promise_new_static_delegate) });
194             }
195
196             descs.AddRange(base.GetEoOps(type));
197             return descs;
198         }
199         /// <summary>Returns the Eo class for the native methods of this class.</summary>
200         /// <returns>The native class pointer.</returns>
201         public override IntPtr GetEflClass()
202         {
203             return Efl.LoopConsumer.efl_loop_consumer_class_get();
204         }
205
206         #pragma warning disable CA1707, CS1591, SA1300, SA1600
207
208         [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
209         private delegate Efl.Loop efl_loop_get_delegate(System.IntPtr obj, System.IntPtr pd);
210
211         [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
212         public delegate Efl.Loop efl_loop_get_api_delegate(System.IntPtr obj);
213
214         public static Efl.Eo.FunctionWrapper<efl_loop_get_api_delegate> efl_loop_get_ptr = new Efl.Eo.FunctionWrapper<efl_loop_get_api_delegate>(Module, "efl_loop_get");
215
216         private static Efl.Loop loop_get(System.IntPtr obj, System.IntPtr pd)
217         {
218             Eina.Log.Debug("function efl_loop_get was called");
219             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
220             if (ws != null)
221             {
222             Efl.Loop _ret_var = default(Efl.Loop);
223                 try
224                 {
225                     _ret_var = ((LoopConsumer)ws.Target).GetLoop();
226                 }
227                 catch (Exception e)
228                 {
229                     Eina.Log.Warning($"Callback error: {e.ToString()}");
230                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
231                 }
232
233         return _ret_var;
234
235             }
236             else
237             {
238                 return efl_loop_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
239             }
240         }
241
242         private static efl_loop_get_delegate efl_loop_get_static_delegate;
243
244         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
245         private delegate  Eina.Future efl_loop_future_resolved_delegate(System.IntPtr obj, System.IntPtr pd,  Eina.ValueNative result);
246
247         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
248         public delegate  Eina.Future efl_loop_future_resolved_api_delegate(System.IntPtr obj,  Eina.ValueNative result);
249
250         public static Efl.Eo.FunctionWrapper<efl_loop_future_resolved_api_delegate> efl_loop_future_resolved_ptr = new Efl.Eo.FunctionWrapper<efl_loop_future_resolved_api_delegate>(Module, "efl_loop_future_resolved");
251
252         private static  Eina.Future future_resolved(System.IntPtr obj, System.IntPtr pd, Eina.ValueNative result)
253         {
254             Eina.Log.Debug("function efl_loop_future_resolved was called");
255             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
256             if (ws != null)
257             {
258         var _in_result = new Eina.Value(result);
259                              Eina.Future _ret_var = default( Eina.Future);
260                 try
261                 {
262                     _ret_var = ((LoopConsumer)ws.Target).FutureResolved(_in_result);
263                 }
264                 catch (Exception e)
265                 {
266                     Eina.Log.Warning($"Callback error: {e.ToString()}");
267                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
268                 }
269
270                         return _ret_var;
271
272             }
273             else
274             {
275                 return efl_loop_future_resolved_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), result);
276             }
277         }
278
279         private static efl_loop_future_resolved_delegate efl_loop_future_resolved_static_delegate;
280
281         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
282         private delegate  Eina.Future efl_loop_future_rejected_delegate(System.IntPtr obj, System.IntPtr pd,  Eina.Error error);
283
284         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]
285         public delegate  Eina.Future efl_loop_future_rejected_api_delegate(System.IntPtr obj,  Eina.Error error);
286
287         public static Efl.Eo.FunctionWrapper<efl_loop_future_rejected_api_delegate> efl_loop_future_rejected_ptr = new Efl.Eo.FunctionWrapper<efl_loop_future_rejected_api_delegate>(Module, "efl_loop_future_rejected");
288
289         private static  Eina.Future future_rejected(System.IntPtr obj, System.IntPtr pd, Eina.Error error)
290         {
291             Eina.Log.Debug("function efl_loop_future_rejected was called");
292             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
293             if (ws != null)
294             {
295                                      Eina.Future _ret_var = default( Eina.Future);
296                 try
297                 {
298                     _ret_var = ((LoopConsumer)ws.Target).FutureRejected(error);
299                 }
300                 catch (Exception e)
301                 {
302                     Eina.Log.Warning($"Callback error: {e.ToString()}");
303                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
304                 }
305
306                         return _ret_var;
307
308             }
309             else
310             {
311                 return efl_loop_future_rejected_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), error);
312             }
313         }
314
315         private static efl_loop_future_rejected_delegate efl_loop_future_rejected_static_delegate;
316
317         
318         private delegate Eina.Promise efl_loop_promise_new_delegate(System.IntPtr obj, System.IntPtr pd);
319
320         
321         public delegate Eina.Promise efl_loop_promise_new_api_delegate(System.IntPtr obj);
322
323         public static Efl.Eo.FunctionWrapper<efl_loop_promise_new_api_delegate> efl_loop_promise_new_ptr = new Efl.Eo.FunctionWrapper<efl_loop_promise_new_api_delegate>(Module, "efl_loop_promise_new");
324
325         private static Eina.Promise promise_new(System.IntPtr obj, System.IntPtr pd)
326         {
327             Eina.Log.Debug("function efl_loop_promise_new was called");
328             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
329             if (ws != null)
330             {
331             Eina.Promise _ret_var = default(Eina.Promise);
332                 try
333                 {
334                     _ret_var = ((LoopConsumer)ws.Target).NewPromise();
335                 }
336                 catch (Exception e)
337                 {
338                     Eina.Log.Warning($"Callback error: {e.ToString()}");
339                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
340                 }
341
342         return _ret_var;
343
344             }
345             else
346             {
347                 return efl_loop_promise_new_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
348             }
349         }
350
351         private static efl_loop_promise_new_delegate efl_loop_promise_new_static_delegate;
352
353         #pragma warning restore CA1707, CS1591, SA1300, SA1600
354
355 }
356 }
357 }
358