2 #pragma warning disable CS1591
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
7 using System.Threading;
8 using System.ComponentModel;
11 /// <summary>A generic configuration interface, that holds key-value pairs.</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.IConfigConcrete.NativeMethods]
14 [Efl.Eo.BindingEntity]
15 public interface IConfig :
16 Efl.Eo.IWrapper, IDisposable
18 /// <summary>A generic configuration value, referred to by name.</summary>
19 /// <param name="name">Configuration option name.</param>
20 /// <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>
21 Eina.Value GetConfig(System.String name);
22 /// <summary>A generic configuration value, referred to by name.</summary>
23 /// <param name="name">Configuration option name.</param>
24 /// <param name="value">Configuration option value. May be <c>null</c> if not found.</param>
25 /// <returns><c>false</c> in case of error: value type was invalid, the config can't be changed, config does not exist...</returns>
26 bool SetConfig(System.String name, Eina.Value value);
28 /// <summary>A generic configuration interface, that holds key-value pairs.</summary>
29 /// <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>
30 sealed public class IConfigConcrete :
35 /// <summary>Pointer to the native class description.</summary>
36 public override System.IntPtr NativeClass
40 if (((object)this).GetType() == typeof(IConfigConcrete))
42 return GetEflClassStatic();
46 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
51 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
52 /// Do not call this constructor directly.</summary>
53 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
54 private IConfigConcrete(ConstructingHandle ch) : base(ch)
58 [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
59 efl_config_interface_get();
60 /// <summary>Initializes a new instance of the <see cref="IConfig"/> class.
61 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
62 /// <param name="wh">The native pointer to be wrapped.</param>
63 private IConfigConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
67 /// <summary>A generic configuration value, referred to by name.</summary>
68 /// <param name="name">Configuration option name.</param>
69 /// <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>
70 public Eina.Value GetConfig(System.String name) {
71 var _ret_var = Efl.IConfigConcrete.NativeMethods.efl_config_get_ptr.Value.Delegate(this.NativeHandle,name);
72 Eina.Error.RaiseIfUnhandledException();
75 /// <summary>A generic configuration value, referred to by name.</summary>
76 /// <param name="name">Configuration option name.</param>
77 /// <param name="value">Configuration option value. May be <c>null</c> if not found.</param>
78 /// <returns><c>false</c> in case of error: value type was invalid, the config can't be changed, config does not exist...</returns>
79 public bool SetConfig(System.String name, Eina.Value value) {
80 var _ret_var = Efl.IConfigConcrete.NativeMethods.efl_config_set_ptr.Value.Delegate(this.NativeHandle,name, value);
81 Eina.Error.RaiseIfUnhandledException();
84 private static IntPtr GetEflClassStatic()
86 return Efl.IConfigConcrete.efl_config_interface_get();
88 /// <summary>Wrapper for native methods and virtual method delegates.
89 /// For internal use by generated code only.</summary>
90 public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
92 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
93 /// <summary>Gets the list of Eo operations to override.</summary>
94 /// <returns>The list of Eo operations to be overload.</returns>
95 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
97 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
98 var methods = Efl.Eo.Globals.GetUserMethods(type);
100 if (efl_config_get_static_delegate == null)
102 efl_config_get_static_delegate = new efl_config_get_delegate(config_get);
105 if (methods.FirstOrDefault(m => m.Name == "GetConfig") != null)
107 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) });
110 if (efl_config_set_static_delegate == null)
112 efl_config_set_static_delegate = new efl_config_set_delegate(config_set);
115 if (methods.FirstOrDefault(m => m.Name == "SetConfig") != null)
117 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) });
122 /// <summary>Returns the Eo class for the native methods of this class.</summary>
123 /// <returns>The native class pointer.</returns>
124 public override IntPtr GetEflClass()
126 return Efl.IConfigConcrete.efl_config_interface_get();
129 #pragma warning disable CA1707, CS1591, SA1300, SA1600
131 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]
132 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);
134 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]
135 public delegate Eina.Value efl_config_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String name);
137 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");
139 private static Eina.Value config_get(System.IntPtr obj, System.IntPtr pd, System.String name)
141 Eina.Log.Debug("function efl_config_get was called");
142 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
145 Eina.Value _ret_var = default(Eina.Value);
148 _ret_var = ((IConfig)ws.Target).GetConfig(name);
152 Eina.Log.Warning($"Callback error: {e.ToString()}");
153 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
161 return efl_config_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name);
165 private static efl_config_get_delegate efl_config_get_static_delegate;
167 [return: MarshalAs(UnmanagedType.U1)]
168 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);
170 [return: MarshalAs(UnmanagedType.U1)]
171 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);
173 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");
175 private static bool config_set(System.IntPtr obj, System.IntPtr pd, System.String name, Eina.Value value)
177 Eina.Log.Debug("function efl_config_set was called");
178 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
181 bool _ret_var = default(bool);
184 _ret_var = ((IConfig)ws.Target).SetConfig(name, value);
188 Eina.Log.Warning($"Callback error: {e.ToString()}");
189 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
197 return efl_config_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name, value);
201 private static efl_config_set_delegate efl_config_set_static_delegate;
203 #pragma warning restore CA1707, CS1591, SA1300, SA1600
210 #pragma warning disable CS1591
211 public static class EflIConfigConcrete_ExtensionMethods {
214 #pragma warning restore CS1591