aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-12-28 18:13:51 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2018-12-28 18:22:43 +0100
commitc6509aee0fc4871524690411f3a9dde8ac447c0c (patch)
tree12fa1502adb3c76410c46792e50f0b433545ff87
parentefl-mono: automatic code refs for event wrappers docs (diff)
downloadefl-c6509aee0fc4871524690411f3a9dde8ac447c0c.tar.gz
efl-mono: Remove Flush from C# Value API.
Summary: Fixes https://phab.enlightenment.org/T7387 Test Plan: run tests Reviewers: segfaultxavi, felipealmeida Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: https://phab.enlightenment.org/T7387 Differential Revision: https://phab.enlightenment.org/D7521
-rw-r--r--src/bindings/mono/eina_mono/eina_value.cs40
-rw-r--r--src/tests/efl_mono/Value.cs35
2 files changed, 1 insertions, 74 deletions
diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs
index 4deeb1ad63..9ff4de5b13 100644
--- a/src/bindings/mono/eina_mono/eina_value.cs
+++ b/src/bindings/mono/eina_mono/eina_value.cs
@@ -405,21 +405,6 @@ public struct ValueNative
}
}
-
-/// <summary>Exception for trying to access flushed values.</summary>
-[Serializable]
-public class ValueFlushedException : Exception
-{
- /// <summary> Default constructor.</summary>
- public ValueFlushedException() : base () { }
- /// <summary> Most commonly used contructor.</summary>
- public ValueFlushedException(string msg) : base(msg) { }
- /// <summary> Wraps an inner exception.</summary>
- public ValueFlushedException(string msg, Exception inner) : base(msg, inner) { }
- /// <summary> Serializable constructor.</summary>
- protected ValueFlushedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
-}
-
/// <summary>Exception for failures when setting an container item.</summary>
[Serializable]
public class SetItemFailedException : Exception
@@ -681,8 +666,6 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
/// <summary> Whether this wrapper owns (can free) the native value. </summary>
public Ownership Ownership { get; protected set;}
private bool Disposed;
- /// <summary> Whether this wrapper has already freed the native value. </summary>
- public bool Flushed { get; protected set;}
/// <summary> Whether this is an Optional value (meaning it can have a value or not). </summary>
public bool Optional {
get {
@@ -774,7 +757,6 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
throw new System.InvalidOperationException("Failed to copy value to managed memory.");
Disposed = false;
- Flushed = false;
Ownership = Ownership.Managed;
}
@@ -912,10 +894,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
if (type.IsContainer())
throw new ArgumentException("To setup a container you must provide a subtype.");
- bool ret = eina_value_setup_wrapper(this.Handle, ValueTypeBridge.GetNative(type));
- if (ret)
- Flushed = false;
- return ret;
+ return eina_value_setup_wrapper(this.Handle, ValueTypeBridge.GetNative(type));
}
public bool Setup(ValueType containerType, ValueType subtype, uint step=0) {
@@ -930,9 +909,6 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
break;
}
- if (ret)
- Flushed = false;
-
return ret;
}
@@ -940,8 +916,6 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
{
if (Disposed)
throw new ObjectDisposedException(GetType().Name);
- if (Flushed)
- throw new ValueFlushedException("Trying to use value that has been flushed. Setup it again.");
}
private void ContainerSanityChecks(int targetIndex=-1)
@@ -979,16 +953,6 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
throw new InvalidValueTypeException("Value is not an Optional one");
}
- /// <summary>Releases the memory stored by this value. It can be reused by calling setup again.
- /// </summary>
- public void Flush()
- {
- if (Disposed)
- throw new ObjectDisposedException(GetType().Name);
- eina_value_flush_wrapper(this.Handle);
- Flushed = true;
- }
-
/// <summary>Get a ValueNative struct with the *value* pointed by this Eina.Value.</summary>
public ValueNative GetNative()
{
@@ -1440,8 +1404,6 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
return this.CompareTo(other) == 0;
} catch (ObjectDisposedException) {
return false;
- } catch (ValueFlushedException) {
- return false;
}
}
diff --git a/src/tests/efl_mono/Value.cs b/src/tests/efl_mono/Value.cs
index 63b1d1f4be..6f2c5799b5 100644
--- a/src/tests/efl_mono/Value.cs
+++ b/src/tests/efl_mono/Value.cs
@@ -176,45 +176,10 @@ public static class TestEinaValue {
{
Eina.Value v = new Eina.Value(Eina.ValueType.Int32);
v.Dispose();
- Test.AssertRaises<ObjectDisposedException>(v.Flush);
Test.AssertRaises<ObjectDisposedException>(() => v.ToString());
Test.AssertRaises<ObjectDisposedException>(() => v.Set(24));
}
- public static void TestValueFlush()
- {
- using (Eina.Value v = new Eina.Value(Eina.ValueType.Int32)) {
- Test.Assert(v.Set(44));
- Test.Assert(!v.Flushed);
- v.Flush();
- Test.Assert(v.Flushed);
-
- int x;
- Test.AssertRaises<Eina.ValueFlushedException>(() => v.Get(out x));
- x = 42;
- Test.AssertRaises<Eina.ValueFlushedException>(() => v.Set(x));
-
- v.Setup(Eina.ValueType.String);
- Test.AssertNotRaises<Eina.ValueFlushedException>(() => v.Set("Hello, EFL"));
-
- string y = String.Empty;
- Test.AssertNotRaises<Eina.ValueFlushedException>(() => v.Get(out y));
- v.Flush();
- Test.AssertRaises<Eina.ValueFlushedException>(() => v.Get(out y));
-
- v.Setup(Eina.ValueType.Array, Eina.ValueType.UInt32);
-
- Test.AssertNotRaises<Eina.ValueFlushedException>(() =>
- v.Append(42));
- v.Flush();
- Test.AssertRaises<Eina.ValueFlushedException>(() =>
- v.Append(42));
-
- Test.AssertRaises<Eina.ValueFlushedException>(() => v.GetValueSubType());
-
- }
- }
-
private delegate bool BoolRet();
public static void TestValueOptionalInt()
{