summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eina_mono
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/mono/eina_mono')
-rw-r--r--src/bindings/mono/eina_mono/eina_common.cs8
-rw-r--r--src/bindings/mono/eina_mono/eina_container_common.cs24
-rw-r--r--src/bindings/mono/eina_mono/eina_error.cs18
-rw-r--r--src/bindings/mono/eina_mono/eina_slice.cs5
-rw-r--r--src/bindings/mono/eina_mono/eina_stringshare.cs10
-rw-r--r--src/bindings/mono/eina_mono/eina_value.cs144
6 files changed, 178 insertions, 31 deletions
diff --git a/src/bindings/mono/eina_mono/eina_common.cs b/src/bindings/mono/eina_mono/eina_common.cs
index a4f2ff4c5f..014e77d020 100644
--- a/src/bindings/mono/eina_mono/eina_common.cs
+++ b/src/bindings/mono/eina_mono/eina_common.cs
@@ -55,6 +55,9 @@ internal static partial class NativeCustomExportFunctions
efl_mono_native_free_addr_get();
[DllImport(efl.Libs.CustomExports)] public static extern IntPtr
efl_mono_native_efl_unref_addr_get();
+
+ [DllImport(efl.Libs.Eina)] public static extern IntPtr
+ eina_slstr_copy_new(string str);
}
/// <summary>Wrapper around native memory DllImport'd functions.
@@ -94,6 +97,11 @@ public static class MemoryNative
return NativeCustomExportFunctions.efl_mono_native_strdup(str);
}
+ public static IntPtr SlstrCopyNew(string str)
+ {
+ return NativeCustomExportFunctions.eina_slstr_copy_new(str);
+ }
+
/// <summary>
/// Retrieves an instance of a string for use in program.
/// <para>Since EFL 1.23.</para>
diff --git a/src/bindings/mono/eina_mono/eina_container_common.cs b/src/bindings/mono/eina_mono/eina_container_common.cs
index 192469a033..a07153e51a 100644
--- a/src/bindings/mono/eina_mono/eina_container_common.cs
+++ b/src/bindings/mono/eina_mono/eina_container_common.cs
@@ -1003,22 +1003,6 @@ internal static class TraitFunctions
private static IDictionary<System.Type, object> register = new Dictionary<System.Type, object>();
- private static System.Type AsEflInstantiableType(System.Type type)
- {
- if (!IsEflObject(type))
- {
- return null;
- }
-
- if (type.IsInterface)
- {
- string fullName = type.FullName + "Concrete";
- return type.Assembly.GetType(fullName); // That was our best guess...
- }
-
- return type; // Not interface, so it should be a concrete.
- }
-
public static object RegisterTypeTraits<T>()
{
Eina.Log.Debug($"Finding TypeTraits for {typeof(T).Name}");
@@ -1026,14 +1010,6 @@ internal static class TraitFunctions
var type = typeof(T);
if (IsEflObject(type))
{
- System.Type concrete = AsEflInstantiableType(type);
- if (concrete == null || !type.IsAssignableFrom(concrete))
- {
- throw new Exception("Failed to get a suitable concrete class for this type.");
- }
-
- // No need to pass concrete as the traits class will use reflection to get the actually most
- // derived type returned.
traits = new EflObjectElementTraits<T>();
}
else if (IsString(type))
diff --git a/src/bindings/mono/eina_mono/eina_error.cs b/src/bindings/mono/eina_mono/eina_error.cs
index 1300e796ab..004792fdb7 100644
--- a/src/bindings/mono/eina_mono/eina_error.cs
+++ b/src/bindings/mono/eina_mono/eina_error.cs
@@ -59,11 +59,27 @@ public struct Error : IComparable<Error>, IEquatable<Error>
/// <para>Since EFL 1.23.</para>
/// </summary>
public static readonly Error ENOENT = new Error(2);
+
+ /// <summary>
+ /// Return architecture independent ECANCELED error code.
+ /// Returns 125 for Linux, 89 for OSX and 105 for Windows.
+ /// <para>Since EFL 1.25.</para>
+ /// </summary>
+ private static int IndependentECANCELED()
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ return new Error(125);
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ return new Error(89);
+ else // Windows
+ return new Error(105);
+ }
+
/// <summary>
/// Cancelled error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
- public static readonly Error ECANCELED = new Error(125);
+ public static readonly Error ECANCELED = IndependentECANCELED();
/// <summary>
/// Constructor.
diff --git a/src/bindings/mono/eina_mono/eina_slice.cs b/src/bindings/mono/eina_mono/eina_slice.cs
index 912ddea3bd..0b9311e48c 100644
--- a/src/bindings/mono/eina_mono/eina_slice.cs
+++ b/src/bindings/mono/eina_mono/eina_slice.cs
@@ -232,7 +232,9 @@ public struct RwSlice : ISliceBase, IEquatable<RwSlice>
}
-public static class Eina_SliceUtils
+namespace Eina
+{
+public static class SliceExtensions
{
public static byte[] GetBytes(this Eina.ISliceBase slc)
{
@@ -243,3 +245,4 @@ public static class Eina_SliceUtils
return mArray;
}
}
+}
diff --git a/src/bindings/mono/eina_mono/eina_stringshare.cs b/src/bindings/mono/eina_mono/eina_stringshare.cs
index 58656fe8ca..741817294d 100644
--- a/src/bindings/mono/eina_mono/eina_stringshare.cs
+++ b/src/bindings/mono/eina_mono/eina_stringshare.cs
@@ -69,7 +69,7 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
/// <summary>
/// Main constructor. Wrap the given string.
/// Have private acess to avoid wrapping a null reference,
- /// use convertion or the factory method to create a new instance.
+ /// use conversion or the factory method to create a new instance.
/// <para>Since EFL 1.23.</para>
/// <see cref="Create(string)"/>
/// <see cref="implicit operator Stringshare(string)"/>
@@ -108,7 +108,7 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
}
/// <summary>
- /// Implicit convertion to string.
+ /// Implicit conversion to string.
/// </summary>
public static implicit operator string(Stringshare ss)
{
@@ -121,12 +121,12 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
}
/// <summary>
- /// Implicit convertion from string to Stringshare.
+ /// Implicit conversion from string to Stringshare.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <remarks>
/// Note that this method can be used to create an instance of this class,
- /// either via an explicit cast or an implicit convertion.
+ /// either via an explicit cast or an implicit conversion.
/// <seealso cref="Create(string)"/>
/// </remarks>
public static implicit operator Stringshare(string s)
@@ -145,7 +145,7 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
/// </summary>
/// <remarks>
/// Note that this method can be used to create an instance of this class,
- /// either via an explicit cast or an implicit convertion.
+ /// either via an explicit cast or an implicit conversion.
/// <seealso cref="Create(string)"/>
/// </remarks>
public static Stringshare FromString(string s) => s;
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
[DllImport(efl.Libs.CustomExports)]
[return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_string(IntPtr handle, uint p, string data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_ptr(IntPtr handle, uint p, IntPtr data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_char(IntPtr handle, uint p, sbyte data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_uchar(IntPtr handle, uint p, byte data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_short(IntPtr handle, uint p, short data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_ushort(IntPtr handle, uint p, ushort data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_int(IntPtr handle, uint p, int data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_uint(IntPtr handle, uint p, uint data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_long(IntPtr handle, uint p, long data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_ulong(IntPtr handle, uint p, ulong data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_float(IntPtr handle, uint p, float data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_container_insert_wrapper_double(IntPtr handle, uint p, double data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
+ internal static extern bool eina_value_list_insert_wrapper(IntPtr handle, uint p, IntPtr data);
+
+ [DllImport(efl.Libs.CustomExports)]
+ [return: MarshalAsAttribute(UnmanagedType.U1)]
internal static extern bool eina_value_container_get_wrapper(IntPtr handle, int index, out IntPtr output);
[DllImport(efl.Libs.CustomExports)]
@@ -3425,6 +3477,98 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
return false;
}
+ /// <summary>Insert new values to this container at a given position.
+ ///
+ /// <para>Since EFL 1.23.</para>
+ /// </summary>
+ /// <param name="o">The new value to be inserted.</param>
+ /// <param name="p">The position to insert the new value.</param>
+ /// <returns><c>true</c> if the value was successfully insert.</returns>
+ public bool Insert(object o, uint p)
+ {
+ Contract.Requires(o != null, nameof(o));
+ ContainerSanityChecks();
+
+ switch (GetValueSubType())
+ {
+ case ValueType.SByte:
+ {
+ sbyte b = Convert.ToSByte(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_char(this.Handle, p, b);
+ }
+
+ case ValueType.Byte:
+ {
+ byte b = Convert.ToByte(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_uchar(this.Handle, p, b);
+ }
+
+ case ValueType.Short:
+ {
+ short b = Convert.ToInt16(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_short(this.Handle, p, b);
+ }
+
+ case ValueType.UShort:
+ {
+ ushort b = Convert.ToUInt16(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_ushort(this.Handle, p, b);
+ }
+
+ case ValueType.Int32:
+ {
+ int x = Convert.ToInt32(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_int(this.Handle, p, x);
+ }
+
+ case ValueType.UInt32:
+ {
+ uint x = Convert.ToUInt32(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_uint(this.Handle, p, x);
+ }
+
+ case ValueType.Long:
+ case ValueType.Int64:
+ {
+ long x = Convert.ToInt64(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_long(this.Handle, p, x);
+ }
+
+ case ValueType.ULong:
+ case ValueType.UInt64:
+ {
+ ulong x = Convert.ToUInt64(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_ulong(this.Handle, p, x);
+ }
+
+ case ValueType.Float:
+ {
+ float x = Convert.ToSingle(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_float(this.Handle, p, x);
+ }
+
+ case ValueType.Double:
+ {
+ double x = Convert.ToDouble(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_double(this.Handle, p, x);
+ }
+
+ case ValueType.String:
+ {
+ string x = Convert.ToString(o, CultureInfo.CurrentCulture);
+ return eina_value_container_insert_wrapper_string(this.Handle, p, x);
+ }
+ case ValueType.Object:
+ {
+ var x = (Efl.Object) o;
+ return eina_value_container_insert_wrapper_ptr(this.Handle, p, x.NativeHandle);
+ }
+ }
+
+ return false;
+ }
+
+
/// <summary>Indexer for this container.
///
/// <para>Since EFL 1.23.</para>