diff --git a/src/bindings/mono/eina_mono/eina_inlist.cs b/src/bindings/mono/eina_mono/eina_inlist.cs index ed98730c5d..53b86c1ad1 100644 --- a/src/bindings/mono/eina_mono/eina_inlist.cs +++ b/src/bindings/mono/eina_mono/eina_inlist.cs @@ -3,6 +3,7 @@ using System; using System.Runtime.InteropServices; using System.Collections.Generic; +using System.ComponentModel; using static Eina.TraitFunctions; using static Eina.InlistNativeFunctions; @@ -11,6 +12,7 @@ using Eina.Callbacks; namespace Eina { +[EditorBrowsable(EditorBrowsableState.Never)] public static class InlistNativeFunctions { [DllImport(efl.Libs.Eina)] public static extern IntPtr @@ -81,13 +83,20 @@ public static class InlistNativeFunctions } /// Wrapper around an inplace list. -/// -/// Since EFL 1.23. +/// Since EFL 1.23. /// public class Inlist : IEnumerable, IDisposable { + [EditorBrowsable(EditorBrowsableState.Never)] public IntPtr Handle {get;set;} = IntPtr.Zero; + /// Whether this wrapper owns the native buffer. + /// Since EFL 1.23. + /// public bool Own {get;set;} + /// Who is in charge of releasing the resources wrapped by + /// this instance. + /// Since EFL 1.23. + /// public bool OwnContent {get;set;} public int Length @@ -140,11 +149,16 @@ public class Inlist : IEnumerable, IDisposable } + /// + /// Default constructor. + /// Since EFL 1.23. + /// public Inlist() { InitNew(); } + [EditorBrowsable(EditorBrowsableState.Never)] public Inlist(IntPtr handle, bool own) { Handle = handle; @@ -152,6 +166,7 @@ public class Inlist : IEnumerable, IDisposable OwnContent = own; } + [EditorBrowsable(EditorBrowsableState.Never)] public Inlist(IntPtr handle, bool own, bool ownContent) { Handle = handle; @@ -159,11 +174,20 @@ public class Inlist : IEnumerable, IDisposable OwnContent = ownContent; } + /// + /// Finalizer to be called from the Garbage Collector. + /// Since EFL 1.23. + /// ~Inlist() { Dispose(false); } + /// Disposes of this wrapper, releasing the native array if owned. + /// Since EFL 1.23. + /// + /// True if this was called from public method. False if + /// called from the C# finalizer. protected virtual void Dispose(bool disposing) { IntPtr h = Handle; @@ -192,41 +216,70 @@ public class Inlist : IEnumerable, IDisposable } } + /// Releases the native resources held by this instance. + /// Since EFL 1.23. + /// public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } + /// Releases the native resources held by this instance. + /// Since EFL 1.23. + /// public void Free() { Dispose(); } + /// + /// Releases the native inlist. + /// Since EFL 1.23. + /// + /// The native inlist. public IntPtr Release() { IntPtr h = Handle; Handle = IntPtr.Zero; return h; } - + + /// Sets all ownership. + /// Since EFL 1.23. + /// + /// If the hash own for all ownerships. public void SetOwnership(bool ownAll) { Own = ownAll; OwnContent = ownAll; } + /// Sets own individually. + /// Since EFL 1.23. + /// + /// If own the object. + /// If own the content's object. public void SetOwnership(bool own, bool ownContent) { Own = own; OwnContent = ownContent; } + /// + /// Gets the count of the number of items. + /// Since EFL 1.23. + /// + /// The number of members in the list. public int Count() { return (int)eina_inlist_count(Handle); } + /// + /// Cleanup the inlist. + /// Since EFL 1.23. + /// public void Clean() { while (Handle != IntPtr.Zero) @@ -237,18 +290,33 @@ public class Inlist : IEnumerable, IDisposable } } + /// + /// Adds a new value to the end. + /// Since EFL 1.23. + /// + /// The value to be added. public void Append(T val) { IntPtr node = ManagedToNativeAllocInlistNode(val); Handle = eina_inlist_append(Handle, node); } + /// + /// Adds a new value to the begin. + /// Since EFL 1.23. + /// + /// The value to be added. public void Prepend(T val) { IntPtr node = ManagedToNativeAllocInlistNode(val); Handle = eina_inlist_prepend(Handle, node); } + /// + /// Removes value at the specified position from list. + /// Since EFL 1.23. + /// + /// The given position. public void Remove(int idx) { IntPtr node = InternalAt(idx); @@ -256,6 +324,12 @@ public class Inlist : IEnumerable, IDisposable NativeFreeInlistNode(node, OwnContent); } + /// + /// Returns the element of the list at the specified position. + /// Since EFL 1.23. + /// + /// The position of the desired element. + /// The element at the specified position public T At(int idx) { IntPtr node = InternalAt(idx); @@ -267,6 +341,12 @@ public class Inlist : IEnumerable, IDisposable return NativeToManagedInlistNode(node); } + /// + /// Replaces the element at the specified position. + /// Since EFL 1.23. + /// + /// The position of the desired element. + /// The value of the element to be inserted. public void DataSet(int idx, T val) { IntPtr old = InternalAt(idx); @@ -283,6 +363,10 @@ public class Inlist : IEnumerable, IDisposable NativeFreeInlistNode(old, OwnContent); } + /// + /// Accessor by index to the elements of this list. + /// Since EFL 1.23. + /// public T this[int idx] { get @@ -295,6 +379,12 @@ public class Inlist : IEnumerable, IDisposable } } + + /// + /// Returns a array containing all of the elements in proper sequence. + /// Since EFL 1.23. + /// + /// A array public T[] ToArray() { var managed = new T[Count()]; @@ -307,6 +397,11 @@ public class Inlist : IEnumerable, IDisposable return managed; } + /// + /// Adds a array to the end. + /// Since EFL 1.23. + /// + /// The values to be added. public void AppendArray(T[] values) { foreach (T v in values) @@ -315,12 +410,18 @@ public class Inlist : IEnumerable, IDisposable } } - + + /// Gets an Iterator for this list. + /// Since EFL 1.23. + /// public Eina.Iterator GetIterator() { return new Eina.Iterator(eina_inlist_iterator_wrapper_new_custom_export_mono(Handle), true); } + /// Gets an Enumerator for this list. + /// Since EFL 1.23. + /// public IEnumerator GetEnumerator() { for (IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr)) @@ -334,7 +435,9 @@ public class Inlist : IEnumerable, IDisposable return this.GetEnumerator(); } - /// Gets an Accessor for this List. + /// Gets an Accessor for this List. + /// Since EFL 1.23. + /// public Eina.Accessor GetAccessor() { return new Eina.AccessorInList(eina_inlist_accessor_new(Handle), Ownership.Managed);