1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
12 /// <summary>This object can maintain a set of key value pairs
13 /// A object of this type alone does not apply the object to the system. For getting the value into the system, see <see cref="Efl.Core.ProcEnv"/>.
15 /// A object can be forked, which will only copy its values, changes to the returned object will not change the object where it is forked off.</summary>
16 [Efl.Core.Env.NativeMethods]
17 public class Env : Efl.Object, Efl.IDuplicate
19 ///<summary>Pointer to the native class description.</summary>
20 public override System.IntPtr NativeClass
24 if (((object)this).GetType() == typeof(Env))
26 return GetEflClassStatic();
30 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
35 [System.Runtime.InteropServices.DllImport(efl.Libs.Ecore)] internal static extern System.IntPtr
36 efl_core_env_class_get();
37 /// <summary>Initializes a new instance of the <see cref="Env"/> class.</summary>
38 /// <param name="parent">Parent instance.</param>
39 public Env(Efl.Object parent= null
40 ) : base(efl_core_env_class_get(), typeof(Env), parent)
42 FinishInstantiation();
45 /// <summary>Initializes a new instance of the <see cref="Env"/> class.
46 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
47 /// <param name="raw">The native pointer to be wrapped.</param>
48 protected Env(System.IntPtr raw) : base(raw)
52 /// <summary>Initializes a new instance of the <see cref="Env"/> class.
53 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
54 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
55 /// <param name="managedType">The managed type of the public constructor that originated this call.</param>
56 /// <param name="parent">The Efl.Object parent of this instance.</param>
57 protected Env(IntPtr baseKlass, System.Type managedType, Efl.Object parent) : base(baseKlass, managedType, parent)
61 /// <summary>Get the value of the <c>var</c>, or <c>null</c> if no such <c>var</c> exists in the object</summary>
62 /// <param name="var">The name of the variable</param>
63 /// <returns>Set var to this value if not <c>NULL</c>, otherwise clear this env value if value is <c>NULL</c> or if it is an empty string</returns>
64 virtual public System.String GetEnv(System.String var) {
65 var _ret_var = Efl.Core.Env.NativeMethods.efl_core_env_get_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),var);
66 Eina.Error.RaiseIfUnhandledException();
69 /// <summary>Add a new pair to this object</summary>
70 /// <param name="var">The name of the variable</param>
71 /// <param name="value">Set var to this value if not <c>NULL</c>, otherwise clear this env value if value is <c>NULL</c> or if it is an empty string</param>
72 virtual public void SetEnv(System.String var, System.String value) {
73 Efl.Core.Env.NativeMethods.efl_core_env_set_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),var, value);
74 Eina.Error.RaiseIfUnhandledException();
76 /// <summary>Get the content of this object.
77 /// This will return a iterator that contains all keys that are part of this object.</summary>
78 virtual public Eina.Iterator<System.String> GetContent() {
79 var _ret_var = Efl.Core.Env.NativeMethods.efl_core_env_content_get_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
80 Eina.Error.RaiseIfUnhandledException();
81 return new Eina.Iterator<System.String>(_ret_var, false, false);
83 /// <summary>Remove the pair with the matching <c>var</c> from this object</summary>
84 /// <param name="var">The name of the variable</param>
85 virtual public void Unset(System.String var) {
86 Efl.Core.Env.NativeMethods.efl_core_env_unset_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),var);
87 Eina.Error.RaiseIfUnhandledException();
89 /// <summary>Remove all pairs from this object</summary>
90 virtual public void Clear() {
91 Efl.Core.Env.NativeMethods.efl_core_env_clear_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
92 Eina.Error.RaiseIfUnhandledException();
94 /// <summary>Creates a carbon copy of this object and returns it.
95 /// The newly created object will have no event handlers or anything of the sort.</summary>
96 /// <returns>Returned carbon copy</returns>
97 virtual public Efl.IDuplicate Duplicate() {
98 var _ret_var = Efl.IDuplicateConcrete.NativeMethods.efl_duplicate_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
99 Eina.Error.RaiseIfUnhandledException();
102 /// <summary>Get the content of this object.
103 /// This will return a iterator that contains all keys that are part of this object.</summary>
104 public Eina.Iterator<System.String> Content {
105 get { return GetContent(); }
107 private static IntPtr GetEflClassStatic()
109 return Efl.Core.Env.efl_core_env_class_get();
111 /// <summary>Wrapper for native methods and virtual method delegates.
112 /// For internal use by generated code only.</summary>
113 public new class NativeMethods : Efl.Object.NativeMethods
115 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Ecore);
116 /// <summary>Gets the list of Eo operations to override.</summary>
117 /// <returns>The list of Eo operations to be overload.</returns>
118 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
120 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
121 var methods = Efl.Eo.Globals.GetUserMethods(type);
123 if (efl_core_env_get_static_delegate == null)
125 efl_core_env_get_static_delegate = new efl_core_env_get_delegate(env_get);
128 if (methods.FirstOrDefault(m => m.Name == "GetEnv") != null)
130 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_core_env_get"), func = Marshal.GetFunctionPointerForDelegate(efl_core_env_get_static_delegate) });
133 if (efl_core_env_set_static_delegate == null)
135 efl_core_env_set_static_delegate = new efl_core_env_set_delegate(env_set);
138 if (methods.FirstOrDefault(m => m.Name == "SetEnv") != null)
140 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_core_env_set"), func = Marshal.GetFunctionPointerForDelegate(efl_core_env_set_static_delegate) });
143 if (efl_core_env_content_get_static_delegate == null)
145 efl_core_env_content_get_static_delegate = new efl_core_env_content_get_delegate(content_get);
148 if (methods.FirstOrDefault(m => m.Name == "GetContent") != null)
150 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_core_env_content_get"), func = Marshal.GetFunctionPointerForDelegate(efl_core_env_content_get_static_delegate) });
153 if (efl_core_env_unset_static_delegate == null)
155 efl_core_env_unset_static_delegate = new efl_core_env_unset_delegate(unset);
158 if (methods.FirstOrDefault(m => m.Name == "Unset") != null)
160 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_core_env_unset"), func = Marshal.GetFunctionPointerForDelegate(efl_core_env_unset_static_delegate) });
163 if (efl_core_env_clear_static_delegate == null)
165 efl_core_env_clear_static_delegate = new efl_core_env_clear_delegate(clear);
168 if (methods.FirstOrDefault(m => m.Name == "Clear") != null)
170 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_core_env_clear"), func = Marshal.GetFunctionPointerForDelegate(efl_core_env_clear_static_delegate) });
173 if (efl_duplicate_static_delegate == null)
175 efl_duplicate_static_delegate = new efl_duplicate_delegate(duplicate);
178 if (methods.FirstOrDefault(m => m.Name == "Duplicate") != null)
180 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_duplicate"), func = Marshal.GetFunctionPointerForDelegate(efl_duplicate_static_delegate) });
183 descs.AddRange(base.GetEoOps(type));
186 /// <summary>Returns the Eo class for the native methods of this class.</summary>
187 /// <returns>The native class pointer.</returns>
188 public override IntPtr GetEflClass()
190 return Efl.Core.Env.efl_core_env_class_get();
193 #pragma warning disable CA1707, CS1591, SA1300, SA1600
195 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]
196 private delegate System.String efl_core_env_get_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var);
198 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]
199 public delegate System.String efl_core_env_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var);
201 public static Efl.Eo.FunctionWrapper<efl_core_env_get_api_delegate> efl_core_env_get_ptr = new Efl.Eo.FunctionWrapper<efl_core_env_get_api_delegate>(Module, "efl_core_env_get");
203 private static System.String env_get(System.IntPtr obj, System.IntPtr pd, System.String var)
205 Eina.Log.Debug("function efl_core_env_get was called");
206 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
209 System.String _ret_var = default(System.String);
212 _ret_var = ((Env)ws.Target).GetEnv(var);
216 Eina.Log.Warning($"Callback error: {e.ToString()}");
217 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
225 return efl_core_env_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), var);
229 private static efl_core_env_get_delegate efl_core_env_get_static_delegate;
232 private delegate void efl_core_env_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String value);
235 public delegate void efl_core_env_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String value);
237 public static Efl.Eo.FunctionWrapper<efl_core_env_set_api_delegate> efl_core_env_set_ptr = new Efl.Eo.FunctionWrapper<efl_core_env_set_api_delegate>(Module, "efl_core_env_set");
239 private static void env_set(System.IntPtr obj, System.IntPtr pd, System.String var, System.String value)
241 Eina.Log.Debug("function efl_core_env_set was called");
242 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
248 ((Env)ws.Target).SetEnv(var, value);
252 Eina.Log.Warning($"Callback error: {e.ToString()}");
253 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
260 efl_core_env_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), var, value);
264 private static efl_core_env_set_delegate efl_core_env_set_static_delegate;
267 private delegate System.IntPtr efl_core_env_content_get_delegate(System.IntPtr obj, System.IntPtr pd);
270 public delegate System.IntPtr efl_core_env_content_get_api_delegate(System.IntPtr obj);
272 public static Efl.Eo.FunctionWrapper<efl_core_env_content_get_api_delegate> efl_core_env_content_get_ptr = new Efl.Eo.FunctionWrapper<efl_core_env_content_get_api_delegate>(Module, "efl_core_env_content_get");
274 private static System.IntPtr content_get(System.IntPtr obj, System.IntPtr pd)
276 Eina.Log.Debug("function efl_core_env_content_get was called");
277 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
280 Eina.Iterator<System.String> _ret_var = default(Eina.Iterator<System.String>);
283 _ret_var = ((Env)ws.Target).GetContent();
287 Eina.Log.Warning($"Callback error: {e.ToString()}");
288 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
291 return _ret_var.Handle;
296 return efl_core_env_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
300 private static efl_core_env_content_get_delegate efl_core_env_content_get_static_delegate;
303 private delegate void efl_core_env_unset_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var);
306 public delegate void efl_core_env_unset_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var);
308 public static Efl.Eo.FunctionWrapper<efl_core_env_unset_api_delegate> efl_core_env_unset_ptr = new Efl.Eo.FunctionWrapper<efl_core_env_unset_api_delegate>(Module, "efl_core_env_unset");
310 private static void unset(System.IntPtr obj, System.IntPtr pd, System.String var)
312 Eina.Log.Debug("function efl_core_env_unset was called");
313 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
319 ((Env)ws.Target).Unset(var);
323 Eina.Log.Warning($"Callback error: {e.ToString()}");
324 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
331 efl_core_env_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), var);
335 private static efl_core_env_unset_delegate efl_core_env_unset_static_delegate;
338 private delegate void efl_core_env_clear_delegate(System.IntPtr obj, System.IntPtr pd);
341 public delegate void efl_core_env_clear_api_delegate(System.IntPtr obj);
343 public static Efl.Eo.FunctionWrapper<efl_core_env_clear_api_delegate> efl_core_env_clear_ptr = new Efl.Eo.FunctionWrapper<efl_core_env_clear_api_delegate>(Module, "efl_core_env_clear");
345 private static void clear(System.IntPtr obj, System.IntPtr pd)
347 Eina.Log.Debug("function efl_core_env_clear was called");
348 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
354 ((Env)ws.Target).Clear();
358 Eina.Log.Warning($"Callback error: {e.ToString()}");
359 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
366 efl_core_env_clear_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
370 private static efl_core_env_clear_delegate efl_core_env_clear_static_delegate;
372 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.OwnTag>))]
373 private delegate Efl.IDuplicate efl_duplicate_delegate(System.IntPtr obj, System.IntPtr pd);
375 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.OwnTag>))]
376 public delegate Efl.IDuplicate efl_duplicate_api_delegate(System.IntPtr obj);
378 public static Efl.Eo.FunctionWrapper<efl_duplicate_api_delegate> efl_duplicate_ptr = new Efl.Eo.FunctionWrapper<efl_duplicate_api_delegate>(Module, "efl_duplicate");
380 private static Efl.IDuplicate duplicate(System.IntPtr obj, System.IntPtr pd)
382 Eina.Log.Debug("function efl_duplicate was called");
383 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
386 Efl.IDuplicate _ret_var = default(Efl.IDuplicate);
389 _ret_var = ((Env)ws.Target).Duplicate();
393 Eina.Log.Warning($"Callback error: {e.ToString()}");
394 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
402 return efl_duplicate_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
406 private static efl_duplicate_delegate efl_duplicate_static_delegate;
408 #pragma warning restore CA1707, CS1591, SA1300, SA1600