d51f94be4fa2cba04ce2c1e7e3df522bff547010
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_container_model.eo.cs
1 #pragma warning disable CS1591
2 using System;
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Threading;
7 using System.ComponentModel;
8 namespace Efl {
9
10 /// <summary>Class used to create data models from Eina containers.
11 /// Each container supplied represents a series of property values, each item being the property value for a child object.
12 /// 
13 /// The data in the given containers are copied and stored internally.
14 /// 
15 /// Several containers can be supplied and the number of allocated children is based on the container of the largest size.</summary>
16 [Efl.ContainerModel.NativeMethods]
17 public class ContainerModel : Efl.CompositeModel, Efl.Eo.IWrapper
18 {
19     ///<summary>Pointer to the native class description.</summary>
20     public override System.IntPtr NativeClass
21     {
22         get
23         {
24             if (((object)this).GetType() == typeof(ContainerModel))
25             {
26                 return GetEflClassStatic();
27             }
28             else
29             {
30                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
31             }
32         }
33     }
34
35     [System.Runtime.InteropServices.DllImport(efl.Libs.Ecore)] internal static extern System.IntPtr
36         efl_container_model_class_get();
37     /// <summary>Initializes a new instance of the <see cref="ContainerModel"/> class.</summary>
38     /// <param name="parent">Parent instance.</param>
39     /// <param name="model">Model that is/will be See <see cref="Efl.Ui.IView.SetModel"/></param>
40     /// <param name="index">Position of this object in the parent model. See <see cref="Efl.CompositeModel.SetIndex"/></param>
41     public ContainerModel(Efl.Object parent
42             , Efl.IModel model, uint? index = null) : base(efl_container_model_class_get(), typeof(ContainerModel), parent)
43     {
44         if (Efl.Eo.Globals.ParamHelperCheck(model))
45         {
46             SetModel(Efl.Eo.Globals.GetParamHelper(model));
47         }
48
49         if (Efl.Eo.Globals.ParamHelperCheck(index))
50         {
51             SetIndex(Efl.Eo.Globals.GetParamHelper(index));
52         }
53
54         FinishInstantiation();
55     }
56
57     /// <summary>Initializes a new instance of the <see cref="ContainerModel"/> class.
58     /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
59     /// <param name="raw">The native pointer to be wrapped.</param>
60     protected ContainerModel(System.IntPtr raw) : base(raw)
61     {
62             }
63
64     /// <summary>Initializes a new instance of the <see cref="ContainerModel"/> class.
65     /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
66     /// <param name="baseKlass">The pointer to the base native Eo class.</param>
67     /// <param name="managedType">The managed type of the public constructor that originated this call.</param>
68     /// <param name="parent">The Efl.Object parent of this instance.</param>
69     protected ContainerModel(IntPtr baseKlass, System.Type managedType, Efl.Object parent) : base(baseKlass, managedType, parent)
70     {
71     }
72
73     /// <summary>Verifies if the given object is equal to this one.</summary>
74     /// <param name="instance">The object to compare to.</param>
75     /// <returns>True if both objects point to the same native object.</returns>
76     public override bool Equals(object instance)
77     {
78         var other = instance as Efl.Object;
79         if (other == null)
80         {
81             return false;
82         }
83         return this.NativeHandle == other.NativeHandle;
84     }
85
86     /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
87     /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
88     public override int GetHashCode()
89     {
90         return this.NativeHandle.ToInt32();
91     }
92
93     /// <summary>Turns the native pointer into a string representation.</summary>
94     /// <returns>A string with the type and the native pointer for this object.</returns>
95     public override String ToString()
96     {
97         return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
98     }
99
100     /// <summary>Gets the type of the given property.</summary>
101     /// <param name="name">Property name</param>
102     /// <returns>Property type</returns>
103     virtual public Eina.ValueType GetChildPropertyValueType(System.String name) {
104                                  var _ret_var = Efl.ContainerModel.NativeMethods.efl_container_model_child_property_value_type_get_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),name);
105         Eina.Error.RaiseIfUnhandledException();
106                         return _ret_var;
107  }
108     /// <summary>Adds the given property to child objects and supply the values.
109     /// Each item will represent the value of the given property in the respective child within the data model.
110     /// 
111     /// New children objects are allocated as necessary.
112     /// 
113     /// Value type is required for compatibility with the <see cref="Efl.IModel"/> API.</summary>
114     /// <param name="name">Property name</param>
115     /// <param name="type">Property type</param>
116     /// <param name="values">Values to be added</param>
117     /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
118     virtual public bool AddChildProperty(System.String name, Eina.ValueType type, Eina.Iterator<System.IntPtr> values) {
119                          var _in_values = values.Handle;
120 values.Own = false;
121                                                         var _ret_var = Efl.ContainerModel.NativeMethods.efl_container_model_child_property_add_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),name, type, _in_values);
122         Eina.Error.RaiseIfUnhandledException();
123                                                         return _ret_var;
124  }
125     private static IntPtr GetEflClassStatic()
126     {
127         return Efl.ContainerModel.efl_container_model_class_get();
128     }
129     /// <summary>Wrapper for native methods and virtual method delegates.
130     /// For internal use by generated code only.</summary>
131     public new class NativeMethods : Efl.CompositeModel.NativeMethods
132     {
133         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Ecore);
134         /// <summary>Gets the list of Eo operations to override.</summary>
135         /// <returns>The list of Eo operations to be overload.</returns>
136         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
137         {
138             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
139             var methods = Efl.Eo.Globals.GetUserMethods(type);
140
141             if (efl_container_model_child_property_value_type_get_static_delegate == null)
142             {
143                 efl_container_model_child_property_value_type_get_static_delegate = new efl_container_model_child_property_value_type_get_delegate(child_property_value_type_get);
144             }
145
146             if (methods.FirstOrDefault(m => m.Name == "GetChildPropertyValueType") != null)
147             {
148                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_container_model_child_property_value_type_get"), func = Marshal.GetFunctionPointerForDelegate(efl_container_model_child_property_value_type_get_static_delegate) });
149             }
150
151             if (efl_container_model_child_property_add_static_delegate == null)
152             {
153                 efl_container_model_child_property_add_static_delegate = new efl_container_model_child_property_add_delegate(child_property_add);
154             }
155
156             if (methods.FirstOrDefault(m => m.Name == "AddChildProperty") != null)
157             {
158                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_container_model_child_property_add"), func = Marshal.GetFunctionPointerForDelegate(efl_container_model_child_property_add_static_delegate) });
159             }
160
161             descs.AddRange(base.GetEoOps(type));
162             return descs;
163         }
164         /// <summary>Returns the Eo class for the native methods of this class.</summary>
165         /// <returns>The native class pointer.</returns>
166         public override IntPtr GetEflClass()
167         {
168             return Efl.ContainerModel.efl_container_model_class_get();
169         }
170
171         #pragma warning disable CA1707, SA1300, SA1600
172
173         
174         private delegate Eina.ValueType efl_container_model_child_property_value_type_get_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String name);
175
176         
177         public delegate Eina.ValueType efl_container_model_child_property_value_type_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String name);
178
179         public static Efl.Eo.FunctionWrapper<efl_container_model_child_property_value_type_get_api_delegate> efl_container_model_child_property_value_type_get_ptr = new Efl.Eo.FunctionWrapper<efl_container_model_child_property_value_type_get_api_delegate>(Module, "efl_container_model_child_property_value_type_get");
180
181         private static Eina.ValueType child_property_value_type_get(System.IntPtr obj, System.IntPtr pd, System.String name)
182         {
183             Eina.Log.Debug("function efl_container_model_child_property_value_type_get was called");
184             Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
185             if (wrapper != null)
186             {
187                                     Eina.ValueType _ret_var = default(Eina.ValueType);
188                 try
189                 {
190                     _ret_var = ((ContainerModel)wrapper).GetChildPropertyValueType(name);
191                 }
192                 catch (Exception e)
193                 {
194                     Eina.Log.Warning($"Callback error: {e.ToString()}");
195                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
196                 }
197
198                         return _ret_var;
199
200             }
201             else
202             {
203                 return efl_container_model_child_property_value_type_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name);
204             }
205         }
206
207         private static efl_container_model_child_property_value_type_get_delegate efl_container_model_child_property_value_type_get_static_delegate;
208
209         [return: MarshalAs(UnmanagedType.U1)]
210         private delegate bool efl_container_model_child_property_add_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String name,  Eina.ValueType type,  System.IntPtr values);
211
212         [return: MarshalAs(UnmanagedType.U1)]
213         public delegate bool efl_container_model_child_property_add_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String name,  Eina.ValueType type,  System.IntPtr values);
214
215         public static Efl.Eo.FunctionWrapper<efl_container_model_child_property_add_api_delegate> efl_container_model_child_property_add_ptr = new Efl.Eo.FunctionWrapper<efl_container_model_child_property_add_api_delegate>(Module, "efl_container_model_child_property_add");
216
217         private static bool child_property_add(System.IntPtr obj, System.IntPtr pd, System.String name, Eina.ValueType type, System.IntPtr values)
218         {
219             Eina.Log.Debug("function efl_container_model_child_property_add was called");
220             Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
221             if (wrapper != null)
222             {
223                         var _in_values = new Eina.Iterator<System.IntPtr>(values, true, false);
224                                                             bool _ret_var = default(bool);
225                 try
226                 {
227                     _ret_var = ((ContainerModel)wrapper).AddChildProperty(name, type, _in_values);
228                 }
229                 catch (Exception e)
230                 {
231                     Eina.Log.Warning($"Callback error: {e.ToString()}");
232                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
233                 }
234
235                                                         return _ret_var;
236
237             }
238             else
239             {
240                 return efl_container_model_child_property_add_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), name, type, values);
241             }
242         }
243
244         private static efl_container_model_child_property_add_delegate efl_container_model_child_property_add_static_delegate;
245
246         #pragma warning restore CA1707, SA1300, SA1600
247
248 }
249 }
250 }
251