1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.ComponentModel;
7 namespace Efl { namespace Core {
8 /// <summary>This object can maintain a set of key value pairs
9 /// 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"/>.
11 /// 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>
13 public class Env : Efl.Object, Efl.Eo.IWrapper,Efl.IDuplicate
15 ///<summary>Pointer to the native class description.</summary>
16 public override System.IntPtr NativeClass {
18 if (((object)this).GetType() == typeof (Env))
19 return Efl.Core.EnvNativeInherit.GetEflClassStatic();
21 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
24 [System.Runtime.InteropServices.DllImport(efl.Libs.Ecore)] internal static extern System.IntPtr
25 efl_core_env_class_get();
26 ///<summary>Creates a new instance.</summary>
27 ///<param name="parent">Parent instance.</param>
28 public Env(Efl.Object parent= null
30 base(efl_core_env_class_get(), typeof(Env), parent)
32 FinishInstantiation();
34 ///<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>
35 protected Env(System.IntPtr raw) : base(raw)
37 RegisterEventProxies();
39 ///<summary>Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
40 protected Env(IntPtr base_klass, System.Type managed_type, Efl.Object parent) : base(base_klass, managed_type, parent) {}
41 ///<summary>Verifies if the given object is equal to this one.</summary>
42 public override bool Equals(object obj)
44 var other = obj as Efl.Object;
47 return this.NativeHandle == other.NativeHandle;
49 ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
50 public override int GetHashCode()
52 return this.NativeHandle.ToInt32();
54 ///<summary>Turns the native pointer into a string representation.</summary>
55 public override String ToString()
57 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
59 ///<summary>Register the Eo event wrappers making the bridge to C# events. Internal usage only.</summary>
60 protected override void RegisterEventProxies()
62 base.RegisterEventProxies();
64 /// <summary>Get the value of the <c>var</c>, or <c>null</c> if no such <c>var</c> exists in the object</summary>
65 /// <param name="var">The name of the variable</param>
66 /// <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>
67 virtual public System.String GetEnv( System.String var) {
68 var _ret_var = Efl.Core.EnvNativeInherit.efl_core_env_get_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle), var);
69 Eina.Error.RaiseIfUnhandledException();
72 /// <summary>Add a new pair to this object</summary>
73 /// <param name="var">The name of the variable</param>
74 /// <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>
75 /// <returns></returns>
76 virtual public void SetEnv( System.String var, System.String value) {
77 Efl.Core.EnvNativeInherit.efl_core_env_set_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle), var, value);
78 Eina.Error.RaiseIfUnhandledException();
80 /// <summary>Get the content of this object.
81 /// This will return a iterator that contains all keys that are part of this object.</summary>
82 /// <returns></returns>
83 virtual public Eina.Iterator<System.String> GetContent() {
84 var _ret_var = Efl.Core.EnvNativeInherit.efl_core_env_content_get_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
85 Eina.Error.RaiseIfUnhandledException();
86 return new Eina.Iterator<System.String>(_ret_var, false, false);
88 /// <summary>Remove the pair with the matching <c>var</c> from this object</summary>
89 /// <param name="var">The name of the variable</param>
90 /// <returns></returns>
91 virtual public void Unset( System.String var) {
92 Efl.Core.EnvNativeInherit.efl_core_env_unset_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle), var);
93 Eina.Error.RaiseIfUnhandledException();
95 /// <summary>Remove all pairs from this object</summary>
96 /// <returns></returns>
97 virtual public void Clear() {
98 Efl.Core.EnvNativeInherit.efl_core_env_clear_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
99 Eina.Error.RaiseIfUnhandledException();
101 /// <summary>Creates a carbon copy of this object and returns it.
102 /// The newly created object will have no event handlers or anything of the sort.</summary>
103 /// <returns>Returned carbon copy</returns>
104 virtual public Efl.IDuplicate DoDuplicate() {
105 var _ret_var = Efl.IDuplicateNativeInherit.efl_duplicate_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
106 Eina.Error.RaiseIfUnhandledException();
109 /// <summary>Get the content of this object.
110 /// This will return a iterator that contains all keys that are part of this object.</summary>
112 public Eina.Iterator<System.String> Content {
113 get { return GetContent(); }
115 private static IntPtr GetEflClassStatic()
117 return Efl.Core.Env.efl_core_env_class_get();
120 public class EnvNativeInherit : Efl.ObjectNativeInherit{
121 public new static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Ecore);
122 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
124 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
125 var methods = Efl.Eo.Globals.GetUserMethods(type);
126 if (efl_core_env_get_static_delegate == null)
127 efl_core_env_get_static_delegate = new efl_core_env_get_delegate(env_get);
128 if (methods.FirstOrDefault(m => m.Name == "GetEnv") != null)
129 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)});
130 if (efl_core_env_set_static_delegate == null)
131 efl_core_env_set_static_delegate = new efl_core_env_set_delegate(env_set);
132 if (methods.FirstOrDefault(m => m.Name == "SetEnv") != null)
133 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)});
134 if (efl_core_env_content_get_static_delegate == null)
135 efl_core_env_content_get_static_delegate = new efl_core_env_content_get_delegate(content_get);
136 if (methods.FirstOrDefault(m => m.Name == "GetContent") != null)
137 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)});
138 if (efl_core_env_unset_static_delegate == null)
139 efl_core_env_unset_static_delegate = new efl_core_env_unset_delegate(unset);
140 if (methods.FirstOrDefault(m => m.Name == "Unset") != null)
141 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)});
142 if (efl_core_env_clear_static_delegate == null)
143 efl_core_env_clear_static_delegate = new efl_core_env_clear_delegate(clear);
144 if (methods.FirstOrDefault(m => m.Name == "Clear") != null)
145 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)});
146 if (efl_duplicate_static_delegate == null)
147 efl_duplicate_static_delegate = new efl_duplicate_delegate(duplicate);
148 if (methods.FirstOrDefault(m => m.Name == "DoDuplicate") != null)
149 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_duplicate"), func = Marshal.GetFunctionPointerForDelegate(efl_duplicate_static_delegate)});
150 descs.AddRange(base.GetEoOps(type));
153 public override IntPtr GetEflClass()
155 return Efl.Core.Env.efl_core_env_class_get();
157 public static new IntPtr GetEflClassStatic()
159 return Efl.Core.Env.efl_core_env_class_get();
163 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] 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);
166 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] public delegate System.String efl_core_env_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var);
167 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");
168 private static System.String env_get(System.IntPtr obj, System.IntPtr pd, System.String var)
170 Eina.Log.Debug("function efl_core_env_get was called");
171 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
172 if(wrapper != null) {
173 System.String _ret_var = default(System.String);
175 _ret_var = ((Env)wrapper).GetEnv( var);
176 } catch (Exception e) {
177 Eina.Log.Warning($"Callback error: {e.ToString()}");
178 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
182 return efl_core_env_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), var);
185 private static efl_core_env_get_delegate efl_core_env_get_static_delegate;
188 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);
191 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);
192 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");
193 private static void env_set(System.IntPtr obj, System.IntPtr pd, System.String var, System.String value)
195 Eina.Log.Debug("function efl_core_env_set was called");
196 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
197 if(wrapper != null) {
200 ((Env)wrapper).SetEnv( var, value);
201 } catch (Exception e) {
202 Eina.Log.Warning($"Callback error: {e.ToString()}");
203 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
206 efl_core_env_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), var, value);
209 private static efl_core_env_set_delegate efl_core_env_set_static_delegate;
212 private delegate System.IntPtr efl_core_env_content_get_delegate(System.IntPtr obj, System.IntPtr pd);
215 public delegate System.IntPtr efl_core_env_content_get_api_delegate(System.IntPtr obj);
216 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");
217 private static System.IntPtr content_get(System.IntPtr obj, System.IntPtr pd)
219 Eina.Log.Debug("function efl_core_env_content_get was called");
220 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
221 if(wrapper != null) {
222 Eina.Iterator<System.String> _ret_var = default(Eina.Iterator<System.String>);
224 _ret_var = ((Env)wrapper).GetContent();
225 } catch (Exception e) {
226 Eina.Log.Warning($"Callback error: {e.ToString()}");
227 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
229 return _ret_var.Handle;
231 return efl_core_env_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
234 private static efl_core_env_content_get_delegate efl_core_env_content_get_static_delegate;
237 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);
240 public delegate void efl_core_env_unset_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String var);
241 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");
242 private static void unset(System.IntPtr obj, System.IntPtr pd, System.String var)
244 Eina.Log.Debug("function efl_core_env_unset was called");
245 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
246 if(wrapper != null) {
249 ((Env)wrapper).Unset( var);
250 } catch (Exception e) {
251 Eina.Log.Warning($"Callback error: {e.ToString()}");
252 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
255 efl_core_env_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), var);
258 private static efl_core_env_unset_delegate efl_core_env_unset_static_delegate;
261 private delegate void efl_core_env_clear_delegate(System.IntPtr obj, System.IntPtr pd);
264 public delegate void efl_core_env_clear_api_delegate(System.IntPtr obj);
265 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");
266 private static void clear(System.IntPtr obj, System.IntPtr pd)
268 Eina.Log.Debug("function efl_core_env_clear was called");
269 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
270 if(wrapper != null) {
273 ((Env)wrapper).Clear();
274 } catch (Exception e) {
275 Eina.Log.Warning($"Callback error: {e.ToString()}");
276 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
279 efl_core_env_clear_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
282 private static efl_core_env_clear_delegate efl_core_env_clear_static_delegate;
285 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.IDuplicateConcrete, Efl.Eo.OwnTag>))] private delegate Efl.IDuplicate efl_duplicate_delegate(System.IntPtr obj, System.IntPtr pd);
288 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalTest<Efl.IDuplicateConcrete, Efl.Eo.OwnTag>))] public delegate Efl.IDuplicate efl_duplicate_api_delegate(System.IntPtr obj);
289 public static Efl.Eo.FunctionWrapper<efl_duplicate_api_delegate> efl_duplicate_ptr = new Efl.Eo.FunctionWrapper<efl_duplicate_api_delegate>(_Module, "efl_duplicate");
290 private static Efl.IDuplicate duplicate(System.IntPtr obj, System.IntPtr pd)
292 Eina.Log.Debug("function efl_duplicate was called");
293 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
294 if(wrapper != null) {
295 Efl.IDuplicate _ret_var = default(Efl.IDuplicate);
297 _ret_var = ((Env)wrapper).DoDuplicate();
298 } catch (Exception e) {
299 Eina.Log.Warning($"Callback error: {e.ToString()}");
300 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
304 return efl_duplicate_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
307 private static efl_duplicate_delegate efl_duplicate_static_delegate;