summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorLucas Cavalcante de Sousa <lucas@expertisesolutions.com.br>2020-02-07 19:53:39 +0000
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2020-02-13 15:26:50 -0300
commit4f3b3a33f5b8b93cfbfb0740318087d277639ea4 (patch)
tree74ce8d0fbf5f701706953a52018f2910e3991e82 /src/bindings
parent93d4ffc9404cc2305c5690417fa0fc287afdf3a5 (diff)
efl_mono: Create insert list/array c# wrapper for eina_value.
Implements Insert() method to eina.Value containers (array/list). The Insert() (src/bindings/mono/eina_mono/eina_value.cs) method wraps native functions implemented with c (src/lib/eina/eina_inline_value.x). Resolves T7402 Differential Revision: https://phab.enlightenment.org/D11298
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/mono/eina_mono/eina_value.cs144
1 files changed, 144 insertions, 0 deletions
diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs
index 46d1ff02b5..538374f3f8 100644
--- a/src/bindings/mono/eina_mono/eina_value.cs
+++ b/src/bindings/mono/eina_mono/eina_value.cs
@@ -260,6 +260,58 @@ static internal class UnsafeNativeMethods
260 260
261 [DllImport(efl.Libs.CustomExports)] 261 [DllImport(efl.Libs.CustomExports)]
262 [return: MarshalAsAttribute(UnmanagedType.U1)] 262 [return: MarshalAsAttribute(UnmanagedType.U1)]
263 internal static extern bool eina_value_container_insert_wrapper_string(IntPtr handle, uint p, string data);
264
265 [DllImport(efl.Libs.CustomExports)]
266 [return: MarshalAsAttribute(UnmanagedType.U1)]
267 internal static extern bool eina_value_container_insert_wrapper_ptr(IntPtr handle, uint p, IntPtr data);
268
269 [DllImport(efl.Libs.CustomExports)]
270 [return: MarshalAsAttribute(UnmanagedType.U1)]
271 internal static extern bool eina_value_container_insert_wrapper_char(IntPtr handle, uint p, sbyte data);
272
273 [DllImport(efl.Libs.CustomExports)]
274 [return: MarshalAsAttribute(UnmanagedType.U1)]
275 internal static extern bool eina_value_container_insert_wrapper_uchar(IntPtr handle, uint p, byte data);
276
277 [DllImport(efl.Libs.CustomExports)]
278 [return: MarshalAsAttribute(UnmanagedType.U1)]
279 internal static extern bool eina_value_container_insert_wrapper_short(IntPtr handle, uint p, short data);
280
281 [DllImport(efl.Libs.CustomExports)]
282 [return: MarshalAsAttribute(UnmanagedType.U1)]
283 internal static extern bool eina_value_container_insert_wrapper_ushort(IntPtr handle, uint p, ushort data);
284
285 [DllImport(efl.Libs.CustomExports)]
286 [return: MarshalAsAttribute(UnmanagedType.U1)]
287 internal static extern bool eina_value_container_insert_wrapper_int(IntPtr handle, uint p, int data);
288
289 [DllImport(efl.Libs.CustomExports)]
290 [return: MarshalAsAttribute(UnmanagedType.U1)]
291 internal static extern bool eina_value_container_insert_wrapper_uint(IntPtr handle, uint p, uint data);
292
293 [DllImport(efl.Libs.CustomExports)]
294 [return: MarshalAsAttribute(UnmanagedType.U1)]
295 internal static extern bool eina_value_container_insert_wrapper_long(IntPtr handle, uint p, long data);
296
297 [DllImport(efl.Libs.CustomExports)]
298 [return: MarshalAsAttribute(UnmanagedType.U1)]
299 internal static extern bool eina_value_container_insert_wrapper_ulong(IntPtr handle, uint p, ulong data);
300
301 [DllImport(efl.Libs.CustomExports)]
302 [return: MarshalAsAttribute(UnmanagedType.U1)]
303 internal static extern bool eina_value_container_insert_wrapper_float(IntPtr handle, uint p, float data);
304
305 [DllImport(efl.Libs.CustomExports)]
306 [return: MarshalAsAttribute(UnmanagedType.U1)]
307 internal static extern bool eina_value_container_insert_wrapper_double(IntPtr handle, uint p, double data);
308
309 [DllImport(efl.Libs.CustomExports)]
310 [return: MarshalAsAttribute(UnmanagedType.U1)]
311 internal static extern bool eina_value_list_insert_wrapper(IntPtr handle, uint p, IntPtr data);
312
313 [DllImport(efl.Libs.CustomExports)]
314 [return: MarshalAsAttribute(UnmanagedType.U1)]
263 internal static extern bool eina_value_container_get_wrapper(IntPtr handle, int index, out IntPtr output); 315 internal static extern bool eina_value_container_get_wrapper(IntPtr handle, int index, out IntPtr output);
264 316
265 [DllImport(efl.Libs.CustomExports)] 317 [DllImport(efl.Libs.CustomExports)]
@@ -3425,6 +3477,98 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
3425 return false; 3477 return false;
3426 } 3478 }
3427 3479
3480 /// <summary>Insert new values to this container at a given position.
3481 ///
3482 /// <para>Since EFL 1.23.</para>
3483 /// </summary>
3484 /// <param name="o">The new value to be inserted.</param>
3485 /// <param name="p">The position to insert the new value.</param>
3486 /// <returns><c>true</c> if the value was successfully insert.</returns>
3487 public bool Insert(object o, uint p)
3488 {
3489 Contract.Requires(o != null, nameof(o));
3490 ContainerSanityChecks();
3491
3492 switch (GetValueSubType())
3493 {
3494 case ValueType.SByte:
3495 {
3496 sbyte b = Convert.ToSByte(o, CultureInfo.CurrentCulture);
3497 return eina_value_container_insert_wrapper_char(this.Handle, p, b);
3498 }
3499
3500 case ValueType.Byte:
3501 {
3502 byte b = Convert.ToByte(o, CultureInfo.CurrentCulture);
3503 return eina_value_container_insert_wrapper_uchar(this.Handle, p, b);
3504 }
3505
3506 case ValueType.Short:
3507 {
3508 short b = Convert.ToInt16(o, CultureInfo.CurrentCulture);
3509 return eina_value_container_insert_wrapper_short(this.Handle, p, b);
3510 }
3511
3512 case ValueType.UShort:
3513 {
3514 ushort b = Convert.ToUInt16(o, CultureInfo.CurrentCulture);
3515 return eina_value_container_insert_wrapper_ushort(this.Handle, p, b);
3516 }
3517
3518 case ValueType.Int32:
3519 {
3520 int x = Convert.ToInt32(o, CultureInfo.CurrentCulture);
3521 return eina_value_container_insert_wrapper_int(this.Handle, p, x);
3522 }
3523
3524 case ValueType.UInt32:
3525 {
3526 uint x = Convert.ToUInt32(o, CultureInfo.CurrentCulture);
3527 return eina_value_container_insert_wrapper_uint(this.Handle, p, x);
3528 }
3529
3530 case ValueType.Long:
3531 case ValueType.Int64:
3532 {
3533 long x = Convert.ToInt64(o, CultureInfo.CurrentCulture);
3534 return eina_value_container_insert_wrapper_long(this.Handle, p, x);
3535 }
3536
3537 case ValueType.ULong:
3538 case ValueType.UInt64:
3539 {
3540 ulong x = Convert.ToUInt64(o, CultureInfo.CurrentCulture);
3541 return eina_value_container_insert_wrapper_ulong(this.Handle, p, x);
3542 }
3543
3544 case ValueType.Float:
3545 {
3546 float x = Convert.ToSingle(o, CultureInfo.CurrentCulture);
3547 return eina_value_container_insert_wrapper_float(this.Handle, p, x);
3548 }
3549
3550 case ValueType.Double:
3551 {
3552 double x = Convert.ToDouble(o, CultureInfo.CurrentCulture);
3553 return eina_value_container_insert_wrapper_double(this.Handle, p, x);
3554 }
3555
3556 case ValueType.String:
3557 {
3558 string x = Convert.ToString(o, CultureInfo.CurrentCulture);
3559 return eina_value_container_insert_wrapper_string(this.Handle, p, x);
3560 }
3561 case ValueType.Object:
3562 {
3563 var x = (Efl.Object) o;
3564 return eina_value_container_insert_wrapper_ptr(this.Handle, p, x.NativeHandle);
3565 }
3566 }
3567
3568 return false;
3569 }
3570
3571
3428 /// <summary>Indexer for this container. 3572 /// <summary>Indexer for this container.
3429 /// 3573 ///
3430 /// <para>Since EFL 1.23.</para> 3574 /// <para>Since EFL 1.23.</para>