summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-03-10 13:54:26 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-03-10 17:39:37 -0300
commitbbb208abb30c24b490dfe5e3d69cd81934a6ae11 (patch)
treed708dd008d8bc541370d1768b04edaf5e75d975f
parent230cc00eeb2e38421a27b2badb6422c29f767f91 (diff)
efl-mono: Add object type support for Eina.Value
-rw-r--r--src/bindings/mono/eina_mono/eina_value.cs15
-rw-r--r--src/lib/efl_mono/efl_custom_exports_mono.c3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs
index 6fae14b022..ce92140c37 100644
--- a/src/bindings/mono/eina_mono/eina_value.cs
+++ b/src/bindings/mono/eina_mono/eina_value.cs
@@ -389,6 +389,10 @@ static internal class UnsafeNativeMethods {
389 // Error 389 // Error
390 [DllImport(efl.Libs.CustomExports)] 390 [DllImport(efl.Libs.CustomExports)]
391 internal static extern IntPtr type_error(); 391 internal static extern IntPtr type_error();
392
393 // Error
394 [DllImport(efl.Libs.CustomExports)]
395 internal static extern IntPtr type_object();
392} 396}
393} 397}
394 398
@@ -472,6 +476,7 @@ public enum ValueType {
472 Optional, 476 Optional,
473 /// <summary>Error values.</summary> 477 /// <summary>Error values.</summary>
474 Error, 478 Error,
479 Object,
475 /// <summary>Empty values.</summary> 480 /// <summary>Empty values.</summary>
476 Empty, 481 Empty,
477} 482}
@@ -530,6 +535,11 @@ static class ValueTypeMethods {
530 return val == ValueType.Error; 535 return val == ValueType.Error;
531 } 536 }
532 537
538 public static bool IsObject(this ValueType val)
539 {
540 return val == ValueType.Object;
541 }
542
533 /// <summary>Returns the Marshal.SizeOf for the given ValueType native structure.</summary> 543 /// <summary>Returns the Marshal.SizeOf for the given ValueType native structure.</summary>
534 public static int MarshalSizeOf(this ValueType val) 544 public static int MarshalSizeOf(this ValueType val)
535 { 545 {
@@ -620,6 +630,9 @@ static class ValueTypeBridge
620 ManagedToNative.Add(ValueType.Error, type_error()); 630 ManagedToNative.Add(ValueType.Error, type_error());
621 NativeToManaged.Add(type_error(), ValueType.Error); 631 NativeToManaged.Add(type_error(), ValueType.Error);
622 632
633 ManagedToNative.Add(ValueType.Object, type_object());
634 NativeToManaged.Add(type_object(), ValueType.Object);
635
623 ManagedToNative.Add(ValueType.Empty, IntPtr.Zero); 636 ManagedToNative.Add(ValueType.Empty, IntPtr.Zero);
624 NativeToManaged.Add(IntPtr.Zero, ValueType.Empty); 637 NativeToManaged.Add(IntPtr.Zero, ValueType.Empty);
625 638
@@ -1869,6 +1882,8 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1869 return Convert.ToUInt32(data.ToInt32()); 1882 return Convert.ToUInt32(data.ToInt32());
1870 case ValueType.String: 1883 case ValueType.String:
1871 return StringConversion.NativeUtf8ToManagedString(data); 1884 return StringConversion.NativeUtf8ToManagedString(data);
1885 case ValueType.Object:
1886 return new Efl.Object (data);
1872 default: 1887 default:
1873 return null; 1888 return null;
1874 } 1889 }
diff --git a/src/lib/efl_mono/efl_custom_exports_mono.c b/src/lib/efl_mono/efl_custom_exports_mono.c
index 246a7bcf71..03022a7426 100644
--- a/src/lib/efl_mono/efl_custom_exports_mono.c
+++ b/src/lib/efl_mono/efl_custom_exports_mono.c
@@ -321,6 +321,9 @@ EAPI const Eina_Value_Type *type_list() {
321EAPI const Eina_Value_Type *type_error() { 321EAPI const Eina_Value_Type *type_error() {
322 return EINA_VALUE_TYPE_ERROR; 322 return EINA_VALUE_TYPE_ERROR;
323} 323}
324EAPI const Eina_Value_Type *type_object() {
325 return EINA_VALUE_TYPE_OBJECT;
326}
324 327
325EAPI const Eina_Value_Type *type_optional() { 328EAPI const Eina_Value_Type *type_optional() {
326 return EINA_VALUE_TYPE_OPTIONAL; 329 return EINA_VALUE_TYPE_OPTIONAL;