[EflSharp] Update Circle and efl cs files (#995)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_observer.eo.cs
1 #define EFL_BETA
2 #pragma warning disable CS1591
3 using System;
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
6 using System.Linq;
7 using System.Threading;
8 using System.ComponentModel;
9 namespace Efl {
10
11 /// <summary>Efl observer interface</summary>
12 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
13 [Efl.IObserverConcrete.NativeMethods]
14 [Efl.Eo.BindingEntity]
15 public interface IObserver : 
16     Efl.Eo.IWrapper, IDisposable
17 {
18     /// <summary>Update observer according to the changes of observable object.</summary>
19 /// <param name="obs">An observable object</param>
20 /// <param name="key">A key to classify observer groups</param>
21 /// <param name="data">Required data to update the observer, usually passed by observable object</param>
22 void Update(Efl.Object obs, System.String key, System.IntPtr data);
23     }
24 /// <summary>Efl observer interface</summary>
25 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
26 sealed public  class IObserverConcrete :
27     Efl.Eo.EoWrapper
28     , IObserver
29     
30 {
31     /// <summary>Pointer to the native class description.</summary>
32     public override System.IntPtr NativeClass
33     {
34         get
35         {
36             if (((object)this).GetType() == typeof(IObserverConcrete))
37             {
38                 return GetEflClassStatic();
39             }
40             else
41             {
42                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
43             }
44         }
45     }
46
47     /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
48     /// Do not call this constructor directly.</summary>
49     /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
50     private IObserverConcrete(ConstructingHandle ch) : base(ch)
51     {
52     }
53
54     [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
55         efl_observer_interface_get();
56     /// <summary>Initializes a new instance of the <see cref="IObserver"/> class.
57     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
58     /// <param name="wh">The native pointer to be wrapped.</param>
59     private IObserverConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
60     {
61     }
62
63     /// <summary>Update observer according to the changes of observable object.</summary>
64     /// <param name="obs">An observable object</param>
65     /// <param name="key">A key to classify observer groups</param>
66     /// <param name="data">Required data to update the observer, usually passed by observable object</param>
67     public void Update(Efl.Object obs, System.String key, System.IntPtr data) {
68                                                                                  Efl.IObserverConcrete.NativeMethods.efl_observer_update_ptr.Value.Delegate(this.NativeHandle,obs, key, data);
69         Eina.Error.RaiseIfUnhandledException();
70                                                          }
71     private static IntPtr GetEflClassStatic()
72     {
73         return Efl.IObserverConcrete.efl_observer_interface_get();
74     }
75     /// <summary>Wrapper for native methods and virtual method delegates.
76     /// For internal use by generated code only.</summary>
77     public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
78     {
79         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
80         /// <summary>Gets the list of Eo operations to override.</summary>
81         /// <returns>The list of Eo operations to be overload.</returns>
82         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
83         {
84             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
85             var methods = Efl.Eo.Globals.GetUserMethods(type);
86
87             if (efl_observer_update_static_delegate == null)
88             {
89                 efl_observer_update_static_delegate = new efl_observer_update_delegate(update);
90             }
91
92             if (methods.FirstOrDefault(m => m.Name == "Update") != null)
93             {
94                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_observer_update"), func = Marshal.GetFunctionPointerForDelegate(efl_observer_update_static_delegate) });
95             }
96
97             return descs;
98         }
99         /// <summary>Returns the Eo class for the native methods of this class.</summary>
100         /// <returns>The native class pointer.</returns>
101         public override IntPtr GetEflClass()
102         {
103             return Efl.IObserverConcrete.efl_observer_interface_get();
104         }
105
106         #pragma warning disable CA1707, CS1591, SA1300, SA1600
107
108         
109         private delegate void efl_observer_update_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Object obs, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key,  System.IntPtr data);
110
111         
112         public delegate void efl_observer_update_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Object obs, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key,  System.IntPtr data);
113
114         public static Efl.Eo.FunctionWrapper<efl_observer_update_api_delegate> efl_observer_update_ptr = new Efl.Eo.FunctionWrapper<efl_observer_update_api_delegate>(Module, "efl_observer_update");
115
116         private static void update(System.IntPtr obj, System.IntPtr pd, Efl.Object obs, System.String key, System.IntPtr data)
117         {
118             Eina.Log.Debug("function efl_observer_update was called");
119             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
120             if (ws != null)
121             {
122                                                                                     
123                 try
124                 {
125                     ((IObserver)ws.Target).Update(obs, key, data);
126                 }
127                 catch (Exception e)
128                 {
129                     Eina.Log.Warning($"Callback error: {e.ToString()}");
130                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
131                 }
132
133                                                         
134             }
135             else
136             {
137                 efl_observer_update_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), obs, key, data);
138             }
139         }
140
141         private static efl_observer_update_delegate efl_observer_update_static_delegate;
142
143         #pragma warning restore CA1707, CS1591, SA1300, SA1600
144
145 }
146 }
147 }
148
149 #if EFL_BETA
150 #pragma warning disable CS1591
151 public static class EflIObserverConcrete_ExtensionMethods {
152 }
153 #pragma warning restore CS1591
154 #endif