#define EFL_BETA #pragma warning disable CS1591 using System; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Linq; using System.Threading; using System.ComponentModel; namespace Efl { /// A generic configuration interface, that holds key-value pairs. /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. [Efl.IConfigConcrete.NativeMethods] [Efl.Eo.BindingEntity] public interface IConfig : Efl.Eo.IWrapper, IDisposable { /// A generic configuration value, referred to by name. /// Configuration option name. /// The value. It will be empty if it doesn't exist. The caller must free it after use (using eina_value_free() in C). Eina.Value GetConfig(System.String name); /// A generic configuration value, referred to by name. /// Configuration option name. /// Configuration option value. May be null if not found. /// false in case of error: value type was invalid, the config can't be changed, config does not exist... bool SetConfig(System.String name, Eina.Value value); } /// A generic configuration interface, that holds key-value pairs. /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. sealed public class IConfigConcrete : Efl.Eo.EoWrapper , IConfig { /// Pointer to the native class description. public override System.IntPtr NativeClass { get { if (((object)this).GetType() == typeof(IConfigConcrete)) { return GetEflClassStatic(); } else { return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()]; } } } /// Subclasses should override this constructor if they are expected to be instantiated from native code. /// Do not call this constructor directly. /// Tag struct storing the native handle of the object being constructed. private IConfigConcrete(ConstructingHandle ch) : base(ch) { } [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr efl_config_interface_get(); /// Initializes a new instance of the class. /// Internal usage: This is used when interacting with C code and should not be used directly. /// The native pointer to be wrapped. private IConfigConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh) { } /// A generic configuration value, referred to by name. /// Configuration option name. /// The value. It will be empty if it doesn't exist. The caller must free it after use (using eina_value_free() in C). public Eina.Value GetConfig(System.String name) { var _ret_var = Efl.IConfigConcrete.NativeMethods.efl_config_get_ptr.Value.Delegate(this.NativeHandle,name); Eina.Error.RaiseIfUnhandledException(); return _ret_var; } /// A generic configuration value, referred to by name. /// Configuration option name. /// Configuration option value. May be null if not found. /// false in case of error: value type was invalid, the config can't be changed, config does not exist... public bool SetConfig(System.String name, Eina.Value value) { var _ret_var = Efl.IConfigConcrete.NativeMethods.efl_config_set_ptr.Value.Delegate(this.NativeHandle,name, value); Eina.Error.RaiseIfUnhandledException(); return _ret_var; } private static IntPtr GetEflClassStatic() { return Efl.IConfigConcrete.efl_config_interface_get(); } /// Wrapper for native methods and virtual method delegates. /// For internal use by generated code only. public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods { private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl); /// Gets the list of Eo operations to override. /// The list of Eo operations to be overload. public override System.Collections.Generic.List GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_config_get_static_delegate == null) { efl_config_get_static_delegate = new efl_config_get_delegate(config_get); } if (methods.FirstOrDefault(m => m.Name == "GetConfig") != null) { 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) }); } if (efl_config_set_static_delegate == null) { efl_config_set_static_delegate = new efl_config_set_delegate(config_set); } if (methods.FirstOrDefault(m => m.Name == "SetConfig") != null) { 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) }); } return descs; } /// Returns the Eo class for the native methods of this class. /// The native class pointer. public override IntPtr GetEflClass() { return Efl.IConfigConcrete.efl_config_interface_get(); } #pragma warning disable CA1707, CS1591, SA1300, SA1600 [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); [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); public static Efl.Eo.FunctionWrapper efl_config_get_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_config_get"); private static Eina.Value config_get(System.IntPtr obj, System.IntPtr pd, System.String name) { Eina.Log.Debug("function efl_config_get was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { Eina.Value _ret_var = default(Eina.Value); try { _ret_var = ((IConfig)ws.Target).GetConfig(name); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } return _ret_var; } else { return efl_config_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name); } } private static efl_config_get_delegate efl_config_get_static_delegate; [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); [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); public static Efl.Eo.FunctionWrapper efl_config_set_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_config_set"); private static bool config_set(System.IntPtr obj, System.IntPtr pd, System.String name, Eina.Value value) { Eina.Log.Debug("function efl_config_set was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { bool _ret_var = default(bool); try { _ret_var = ((IConfig)ws.Target).SetConfig(name, value); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } return _ret_var; } else { return efl_config_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name, value); } } private static efl_config_set_delegate efl_config_set_static_delegate; #pragma warning restore CA1707, CS1591, SA1300, SA1600 } } } #if EFL_BETA #pragma warning disable CS1591 public static class EflIConfigConcrete_ExtensionMethods { } #pragma warning restore CS1591 #endif