2c7306926b61c6f15173c4f52ad7bea743d3a639
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_config.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.ComponentModel;
7 namespace Efl { 
8 /// <summary>A generic configuration interface, that holds key-value pairs.</summary>
9 [IConfigNativeInherit]
10 public interface IConfig : 
11     Efl.Eo.IWrapper, IDisposable
12 {
13     /// <summary>A generic configuration value, referred to by name.</summary>
14 /// <param name="name">Configuration option name.</param>
15 /// <returns>The value. It will be empty if it doesn&apos;t exist. The caller must free it after use (using <c>eina_value_free</c>() in C).</returns>
16 Eina.Value GetConfig( System.String name);
17     /// <summary>A generic configuration value, referred to by name.</summary>
18 /// <param name="name">Configuration option name.</param>
19 /// <param name="value">Configuration option value. May be <c>null</c> if not found.</param>
20 /// <returns><c>false</c> in case of error: value type was invalid, the config can&apos;t be changed, config does not exist...</returns>
21 bool SetConfig( System.String name,  Eina.Value value);
22         }
23 /// <summary>A generic configuration interface, that holds key-value pairs.</summary>
24 sealed public class IConfigConcrete : 
25
26 IConfig
27     
28 {
29     ///<summary>Pointer to the native class description.</summary>
30     public System.IntPtr NativeClass {
31         get {
32             if (((object)this).GetType() == typeof (IConfigConcrete))
33                 return Efl.IConfigNativeInherit.GetEflClassStatic();
34             else
35                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
36         }
37     }
38     private  System.IntPtr handle;
39     ///<summary>Pointer to the native instance.</summary>
40     public System.IntPtr NativeHandle {
41         get { return handle; }
42     }
43     [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
44         efl_config_interface_get();
45     ///<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>
46     private IConfigConcrete(System.IntPtr raw)
47     {
48         handle = raw;
49         RegisterEventProxies();
50     }
51     ///<summary>Destructor.</summary>
52     ~IConfigConcrete()
53     {
54         Dispose(false);
55     }
56     ///<summary>Releases the underlying native instance.</summary>
57     void Dispose(bool disposing)
58     {
59         if (handle != System.IntPtr.Zero) {
60             Efl.Eo.Globals.efl_unref(handle);
61             handle = System.IntPtr.Zero;
62         }
63     }
64     ///<summary>Releases the underlying native instance.</summary>
65     public void Dispose()
66     {
67         Dispose(true);
68         GC.SuppressFinalize(this);
69     }
70     ///<summary>Verifies if the given object is equal to this one.</summary>
71     public override bool Equals(object obj)
72     {
73         var other = obj as Efl.Object;
74         if (other == null)
75             return false;
76         return this.NativeHandle == other.NativeHandle;
77     }
78     ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
79     public override int GetHashCode()
80     {
81         return this.NativeHandle.ToInt32();
82     }
83     ///<summary>Turns the native pointer into a string representation.</summary>
84     public override String ToString()
85     {
86         return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
87     }
88     ///<summary>Register the Eo event wrappers making the bridge to C# events. Internal usage only.</summary>
89      void RegisterEventProxies()
90     {
91     }
92     /// <summary>A generic configuration value, referred to by name.</summary>
93     /// <param name="name">Configuration option name.</param>
94     /// <returns>The value. It will be empty if it doesn&apos;t exist. The caller must free it after use (using <c>eina_value_free</c>() in C).</returns>
95     public Eina.Value GetConfig( System.String name) {
96                                  var _ret_var = Efl.IConfigNativeInherit.efl_config_get_ptr.Value.Delegate(this.NativeHandle, name);
97         Eina.Error.RaiseIfUnhandledException();
98                         return _ret_var;
99  }
100     /// <summary>A generic configuration value, referred to by name.</summary>
101     /// <param name="name">Configuration option name.</param>
102     /// <param name="value">Configuration option value. May be <c>null</c> if not found.</param>
103     /// <returns><c>false</c> in case of error: value type was invalid, the config can&apos;t be changed, config does not exist...</returns>
104     public bool SetConfig( System.String name,  Eina.Value value) {
105                                                          var _ret_var = Efl.IConfigNativeInherit.efl_config_set_ptr.Value.Delegate(this.NativeHandle, name,  value);
106         Eina.Error.RaiseIfUnhandledException();
107                                         return _ret_var;
108  }
109     private static IntPtr GetEflClassStatic()
110     {
111         return Efl.IConfigConcrete.efl_config_interface_get();
112     }
113 }
114 public class IConfigNativeInherit  : Efl.Eo.NativeClass{
115     public  static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Efl);
116     public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
117     {
118         var descs = new System.Collections.Generic.List<Efl_Op_Description>();
119         var methods = Efl.Eo.Globals.GetUserMethods(type);
120         if (efl_config_get_static_delegate == null)
121             efl_config_get_static_delegate = new efl_config_get_delegate(config_get);
122         if (methods.FirstOrDefault(m => m.Name == "GetConfig") != null)
123             descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_config_get"), func = Marshal.GetFunctionPointerForDelegate(efl_config_get_static_delegate)});
124         if (efl_config_set_static_delegate == null)
125             efl_config_set_static_delegate = new efl_config_set_delegate(config_set);
126         if (methods.FirstOrDefault(m => m.Name == "SetConfig") != null)
127             descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_config_set"), func = Marshal.GetFunctionPointerForDelegate(efl_config_set_static_delegate)});
128         return descs;
129     }
130     public override IntPtr GetEflClass()
131     {
132         return Efl.IConfigConcrete.efl_config_interface_get();
133     }
134     public static  IntPtr GetEflClassStatic()
135     {
136         return Efl.IConfigConcrete.efl_config_interface_get();
137     }
138
139
140      [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))] private delegate Eina.Value efl_config_get_delegate(System.IntPtr obj, System.IntPtr pd,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String name);
141
142
143      [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))] public delegate Eina.Value efl_config_get_api_delegate(System.IntPtr obj,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String name);
144      public static Efl.Eo.FunctionWrapper<efl_config_get_api_delegate> efl_config_get_ptr = new Efl.Eo.FunctionWrapper<efl_config_get_api_delegate>(_Module, "efl_config_get");
145      private static Eina.Value config_get(System.IntPtr obj, System.IntPtr pd,  System.String name)
146     {
147         Eina.Log.Debug("function efl_config_get was called");
148         Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
149         if(wrapper != null) {
150                                                 Eina.Value _ret_var = default(Eina.Value);
151             try {
152                 _ret_var = ((IConfig)wrapper).GetConfig( name);
153             } catch (Exception e) {
154                 Eina.Log.Warning($"Callback error: {e.ToString()}");
155                 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
156             }
157                         return _ret_var;
158         } else {
159             return efl_config_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)),  name);
160         }
161     }
162     private static efl_config_get_delegate efl_config_get_static_delegate;
163
164
165      [return: MarshalAs(UnmanagedType.U1)] private delegate bool efl_config_set_delegate(System.IntPtr obj, System.IntPtr pd,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String name,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]  Eina.Value value);
166
167
168      [return: MarshalAs(UnmanagedType.U1)] public delegate bool efl_config_set_api_delegate(System.IntPtr obj,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]  System.String name,  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]  Eina.Value value);
169      public static Efl.Eo.FunctionWrapper<efl_config_set_api_delegate> efl_config_set_ptr = new Efl.Eo.FunctionWrapper<efl_config_set_api_delegate>(_Module, "efl_config_set");
170      private static bool config_set(System.IntPtr obj, System.IntPtr pd,  System.String name,  Eina.Value value)
171     {
172         Eina.Log.Debug("function efl_config_set was called");
173         Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
174         if(wrapper != null) {
175                                                                         bool _ret_var = default(bool);
176             try {
177                 _ret_var = ((IConfig)wrapper).SetConfig( name,  value);
178             } catch (Exception e) {
179                 Eina.Log.Warning($"Callback error: {e.ToString()}");
180                 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
181             }
182                                         return _ret_var;
183         } else {
184             return efl_config_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)),  name,  value);
185         }
186     }
187     private static efl_config_set_delegate efl_config_set_static_delegate;
188 }
189