xartigas pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=dcb6380ab5a0d2bbf29429676258c33d09b5b45c
commit dcb6380ab5a0d2bbf29429676258c33d09b5b45c Author: Lauro Moura <lauromo...@expertisesolutions.com.br> Date: Fri Oct 11 11:22:32 2019 +0200 csharp: Add missing docs to slice. Summary: Also removed uneeded methods. Slice also may need some API love to be actually useful later. ref T8292 Reviewers: segfaultxavi, felipealmeida, brunobelo, woohyun Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8292 Differential Revision: https://phab.enlightenment.org/D10327 --- src/bindings/mono/eina_mono/eina_slice.cs | 74 +++++++++++++++++++++++++------ src/tests/efl_mono/Eina.cs | 2 +- 2 files changed, 61 insertions(+), 15 deletions(-) diff --git a/src/bindings/mono/eina_mono/eina_slice.cs b/src/bindings/mono/eina_mono/eina_slice.cs index a0c8fd971c..20bd81f6f7 100644 --- a/src/bindings/mono/eina_mono/eina_slice.cs +++ b/src/bindings/mono/eina_mono/eina_slice.cs @@ -2,15 +2,33 @@ using System; using System.Runtime.InteropServices; +using System.ComponentModel; namespace Eina { +/// <summary> +/// Basic interface for both slice types. +/// <para>Since EFL 1.23.</para> +/// </summary> public interface ISliceBase { + /// <summary> + /// The length of this slice in bytes. + /// <para>Since EFL 1.23.</para> + /// </summary> UIntPtr Len {get;set;} + + /// <summary> + /// The contents of this slice. + /// <para>Since EFL 1.23.</para> + /// </summary> IntPtr Mem {get;set;} + /// <summary> + /// The length in bytes as an integer. + /// <para>Since EFL 1.23.</para> + /// </summary> int Length {get;set;} }; @@ -21,27 +39,39 @@ public interface ISliceBase [StructLayout(LayoutKind.Sequential)] public struct Slice : ISliceBase { + /// <summary> + /// The length of this slice. + /// <para>Since EFL 1.23.</para> + /// </summary> public UIntPtr Len {get;set;} + + /// <summary> + /// The contents of this slice. + /// <para>Since EFL 1.23.</para> + /// </summary> public IntPtr Mem {get;set;} + /// <summary> + /// The length as an integer. + /// <para>Since EFL 1.23.</para> + /// </summary> public int Length { get { return (int)Len; } set { Len = (UIntPtr)value; } } + /// <summary> + /// Creates a new slice from the given memory and length. + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="mem">The memory slice.</param> + /// <param name="len">The length.</param> public Slice(IntPtr mem, UIntPtr len) { Mem = mem; Len = len; } - - public Slice PinnedDataSet(IntPtr mem, UIntPtr len) - { - Mem = mem; - Len = len; - return this; - } } /// <summary>Pointer to a slice of native memory. @@ -51,28 +81,44 @@ public struct Slice : ISliceBase [StructLayout(LayoutKind.Sequential)] public struct RwSlice : ISliceBase { + /// <summary> + /// The length of this slice. + /// <para>Since EFL 1.23.</para> + /// </summary> public UIntPtr Len {get;set;} + + /// <summary> + /// The contents of this slice. + /// <para>Since EFL 1.23.</para> + /// </summary> public IntPtr Mem {get;set;} + /// <summary> + /// The length as an integer. + /// <para>Since EFL 1.23.</para> + /// </summary> public int Length { get { return (int)Len; } set { Len = (UIntPtr)value; } } + /// <summary> + /// Creates a new slice from the given memory and length. + /// <para>Since EFL 1.23.</para> + /// </summary> + /// <param name="mem">The memory slice.</param> + /// <param name="len">The length.</param> public RwSlice(IntPtr mem, UIntPtr len) { Mem = mem; Len = len; } - public RwSlice PinnedDataSet(IntPtr mem, UIntPtr len) - { - Mem = mem; - Len = len; - return this; - } - + /// <summary> + /// Returns a read-only slice from this writable memory. + /// <para>Since EFL 1.23.</para> + /// </summary> Slice ToSlice() { var r = new Slice(); diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs index cebe2ec2e6..5a9b94e9af 100644 --- a/src/tests/efl_mono/Eina.cs +++ b/src/tests/efl_mono/Eina.cs @@ -340,7 +340,7 @@ class TestEinaSlice public static void pinned_data_set() { var binbuf = new Eina.Binbuf(); - binbuf.Append(new Eina.Slice().PinnedDataSet(pinnedPtr, (UIntPtr)3)); + binbuf.Append(new Eina.Slice(pinnedPtr, (UIntPtr)3)); Test.Assert(binbuf.GetBytes().SequenceEqual(base_seq)); } #endif --