summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bindings/mono/eina_mono/eina_value.cs77
-rw-r--r--src/tests/efl_mono/ValueEolian.cs9
2 files changed, 85 insertions, 1 deletions
diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs
index be84e4adff..6fae14b022 100644
--- a/src/bindings/mono/eina_mono/eina_value.cs
+++ b/src/bindings/mono/eina_mono/eina_value.cs
@@ -792,6 +792,83 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
792 this.Ownership = Ownership.Managed; 792 this.Ownership = Ownership.Managed;
793 } 793 }
794 794
795 /// <summary>Type-specific constructor, for convenience.</summary>
796 public Value(byte x) : this(ValueType.Byte)
797 {
798 if (!Set(x))
799 throw new InvalidOperationException("Couldn't set value.");
800 }
801
802 /// <summary>Type-specific constructor, for convenience.</summary>
803 public Value(sbyte x) : this(ValueType.SByte)
804 {
805 if (!Set(x))
806 throw new InvalidOperationException("Couldn't set value.");
807 }
808
809 /// <summary>Type-specific constructor, for convenience.</summary>
810 public Value(short x) : this(ValueType.Short)
811 {
812 if (!Set(x))
813 throw new InvalidOperationException("Couldn't set value.");
814 }
815
816 /// <summary>Type-specific constructor, for convenience.</summary>
817 public Value(ushort x) : this(ValueType.UShort)
818 {
819 if (!Set(x))
820 throw new InvalidOperationException("Couldn't set value.");
821 }
822
823 /// <summary>Type-specific constructor, for convenience.</summary>
824 public Value(int x) : this(ValueType.Int32)
825 {
826 if (!Set(x))
827 throw new InvalidOperationException("Couldn't set value.");
828 }
829
830 /// <summary>Type-specific constructor, for convenience.</summary>
831 public Value(uint x) : this(ValueType.UInt32)
832 {
833 if (!Set(x))
834 throw new InvalidOperationException("Couldn't set value.");
835 }
836
837 /// <summary>Type-specific constructor, for convenience.</summary>
838 public Value(long x) : this(ValueType.Long)
839 {
840 if (!Set(x))
841 throw new InvalidOperationException("Couldn't set value.");
842 }
843
844 /// <summary>Type-specific constructor, for convenience.</summary>
845 public Value(ulong x) : this(ValueType.ULong)
846 {
847 if (!Set(x))
848 throw new InvalidOperationException("Couldn't set value.");
849 }
850
851 /// <summary>Type-specific constructor, for convenience.</summary>
852 public Value(float x) : this(ValueType.Float)
853 {
854 if (!Set(x))
855 throw new InvalidOperationException("Couldn't set value.");
856 }
857
858 /// <summary>Type-specific constructor, for convenience.</summary>
859 public Value(double x) : this(ValueType.Double)
860 {
861 if (!Set(x))
862 throw new InvalidOperationException("Couldn't set value.");
863 }
864
865 /// <summary>Type-specific constructor, for convenience.</summary>
866 public Value(string x) : this(ValueType.String)
867 {
868 if (!Set(x))
869 throw new InvalidOperationException("Couldn't set value.");
870 }
871
795 /// <summary>Implicit conversion from managed value to native struct representation.</summary> 872 /// <summary>Implicit conversion from managed value to native struct representation.</summary>
796 public static implicit operator ValueNative(Value v) 873 public static implicit operator ValueNative(Value v)
797 { 874 {
diff --git a/src/tests/efl_mono/ValueEolian.cs b/src/tests/efl_mono/ValueEolian.cs
index 4d33dfacde..ea178d4ac9 100644
--- a/src/tests/efl_mono/ValueEolian.cs
+++ b/src/tests/efl_mono/ValueEolian.cs
@@ -151,7 +151,14 @@ public static class TestEinaValueEolian {
151 Test.AssertEquals(expected, received); 151 Test.AssertEquals(expected, received);
152 Test.AssertEquals(Eina.ValueType.Double, received.GetValueType()); 152 Test.AssertEquals(Eina.ValueType.Double, received.GetValueType());
153 153
154 154 // Check for 0
155 // This is a special value, since C# can silently convert it to an enum
156 // leading to collisions with Eina.ValueType
157 expected = new Eina.Value(0);
158 obj.SetValue(0);
159 obj.OutValue(out received);
160 Test.AssertEquals(expected, received);
161 Test.AssertEquals(Eina.ValueType.Int32, received.GetValueType());
155 } 162 }
156} 163}
157#pragma warning restore 1591 164#pragma warning restore 1591