1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
10 /// <summary>A generic configuration interface, that holds key-value pairs.</summary>
11 [Efl.IConfigConcrete.NativeMethods]
12 public interface IConfig :
13 Efl.Eo.IWrapper, IDisposable
15 /// <summary>A generic configuration value, referred to by name.</summary>
16 /// <param name="name">Configuration option name.</param>
17 /// <returns>The value. It will be empty if it doesn't exist. The caller must free it after use (using <c>eina_value_free</c>() in C).</returns>
18 Eina.Value GetConfig(System.String name);
19 /// <summary>A generic configuration value, referred to by name.</summary>
20 /// <param name="name">Configuration option name.</param>
21 /// <param name="value">Configuration option value. May be <c>null</c> if not found.</param>
22 /// <returns><c>false</c> in case of error: value type was invalid, the config can't be changed, config does not exist...</returns>
23 bool SetConfig(System.String name, Eina.Value value);
25 /// <summary>A generic configuration interface, that holds key-value pairs.</summary>
26 sealed public class IConfigConcrete :
31 ///<summary>Pointer to the native class description.</summary>
32 public override System.IntPtr NativeClass
36 if (((object)this).GetType() == typeof(IConfigConcrete))
38 return GetEflClassStatic();
42 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
47 [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
48 efl_config_interface_get();
49 /// <summary>Initializes a new instance of the <see cref="IConfig"/> class.
50 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
51 private IConfigConcrete(System.IntPtr raw) : base(raw)
55 /// <summary>A generic configuration value, referred to by name.</summary>
56 /// <param name="name">Configuration option name.</param>
57 /// <returns>The value. It will be empty if it doesn't exist. The caller must free it after use (using <c>eina_value_free</c>() in C).</returns>
58 public Eina.Value GetConfig(System.String name) {
59 var _ret_var = Efl.IConfigConcrete.NativeMethods.efl_config_get_ptr.Value.Delegate(this.NativeHandle,name);
60 Eina.Error.RaiseIfUnhandledException();
63 /// <summary>A generic configuration value, referred to by name.</summary>
64 /// <param name="name">Configuration option name.</param>
65 /// <param name="value">Configuration option value. May be <c>null</c> if not found.</param>
66 /// <returns><c>false</c> in case of error: value type was invalid, the config can't be changed, config does not exist...</returns>
67 public bool SetConfig(System.String name, Eina.Value value) {
68 var _ret_var = Efl.IConfigConcrete.NativeMethods.efl_config_set_ptr.Value.Delegate(this.NativeHandle,name, value);
69 Eina.Error.RaiseIfUnhandledException();
72 private static IntPtr GetEflClassStatic()
74 return Efl.IConfigConcrete.efl_config_interface_get();
76 /// <summary>Wrapper for native methods and virtual method delegates.
77 /// For internal use by generated code only.</summary>
78 public class NativeMethods : Efl.Eo.NativeClass
80 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
81 /// <summary>Gets the list of Eo operations to override.</summary>
82 /// <returns>The list of Eo operations to be overload.</returns>
83 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
85 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
86 var methods = Efl.Eo.Globals.GetUserMethods(type);
88 if (efl_config_get_static_delegate == null)
90 efl_config_get_static_delegate = new efl_config_get_delegate(config_get);
93 if (methods.FirstOrDefault(m => m.Name == "GetConfig") != null)
95 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) });
98 if (efl_config_set_static_delegate == null)
100 efl_config_set_static_delegate = new efl_config_set_delegate(config_set);
103 if (methods.FirstOrDefault(m => m.Name == "SetConfig") != null)
105 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) });
110 /// <summary>Returns the Eo class for the native methods of this class.</summary>
111 /// <returns>The native class pointer.</returns>
112 public override IntPtr GetEflClass()
114 return Efl.IConfigConcrete.efl_config_interface_get();
117 #pragma warning disable CA1707, CS1591, SA1300, SA1600
119 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]
120 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);
122 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]
123 public delegate Eina.Value efl_config_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String name);
125 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");
127 private static Eina.Value config_get(System.IntPtr obj, System.IntPtr pd, System.String name)
129 Eina.Log.Debug("function efl_config_get was called");
130 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
133 Eina.Value _ret_var = default(Eina.Value);
136 _ret_var = ((IConfig)ws.Target).GetConfig(name);
140 Eina.Log.Warning($"Callback error: {e.ToString()}");
141 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
149 return efl_config_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name);
153 private static efl_config_get_delegate efl_config_get_static_delegate;
155 [return: MarshalAs(UnmanagedType.U1)]
156 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);
158 [return: MarshalAs(UnmanagedType.U1)]
159 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);
161 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");
163 private static bool config_set(System.IntPtr obj, System.IntPtr pd, System.String name, Eina.Value value)
165 Eina.Log.Debug("function efl_config_set was called");
166 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
169 bool _ret_var = default(bool);
172 _ret_var = ((IConfig)ws.Target).SetConfig(name, value);
176 Eina.Log.Warning($"Callback error: {e.ToString()}");
177 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
185 return efl_config_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name, value);
189 private static efl_config_set_delegate efl_config_set_static_delegate;
191 #pragma warning restore CA1707, CS1591, SA1300, SA1600