summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eina_mono/eina_list.cs
diff options
context:
space:
mode:
authorBruno da Silva Belo <brunodasilvabelo@gmail.com>2019-10-14 11:01:36 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-14 11:08:02 -0300
commit4eee6f560c7f42aedf59002f976d14eeea8c3143 (patch)
tree95bc959dd0c47005de726a011f7fa07a74345727 /src/bindings/mono/eina_mono/eina_list.cs
parent0477a7256091425ab845160f2b14bef264fcd7ed (diff)
csharp: updating eina_list docs.
Summary: ref T8293 Reviewers: lauromoura, felipealmeida, segfaultxavi, woohyun Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8293 Differential Revision: https://phab.enlightenment.org/D10351
Diffstat (limited to 'src/bindings/mono/eina_mono/eina_list.cs')
-rw-r--r--src/bindings/mono/eina_mono/eina_list.cs147
1 files changed, 111 insertions, 36 deletions
diff --git a/src/bindings/mono/eina_mono/eina_list.cs b/src/bindings/mono/eina_mono/eina_list.cs
index cf78745..bb269db 100644
--- a/src/bindings/mono/eina_mono/eina_list.cs
+++ b/src/bindings/mono/eina_mono/eina_list.cs
@@ -107,24 +107,33 @@ public static class ListNativeFunctions
107} 107}
108 108
109/// <summary>Native wrapper around a linked list of items. 109/// <summary>Native wrapper around a linked list of items.
110/// 110/// <para>Since EFL 1.23.</para>
111/// Since EFL 1.23.
112/// </summary> 111/// </summary>
113public class List<T> : IEnumerable<T>, IDisposable 112public class List<T> : IEnumerable<T>, IDisposable
114{ 113{
115 114
116 [EditorBrowsable(EditorBrowsableState.Never)] 115 [EditorBrowsable(EditorBrowsableState.Never)]
117 public IntPtr Handle {get;set;} = IntPtr.Zero; 116 public IntPtr Handle {get;set;} = IntPtr.Zero;
118 /// <summary>Whether this managed list owns the native one.</summary> 117 /// <summary>Whether this managed list owns the native one.
118 /// <para>Since EFL 1.23.</para>
119 /// </summary>
119 public bool Own {get;set;} 120 public bool Own {get;set;}
120 /// <summary>Whether the native list wrapped owns the content it points to.</summary> 121 /// <summary>Whether the native list wrapped owns the content it points to.
122 /// <para>Since EFL 1.23.</para>
123 ///</summary>
121 public bool OwnContent {get;set;} 124 public bool OwnContent {get;set;}
122 125
123 /// <summary>Delegate for comparing two elements of this list.</summary> 126 /// <summary>Delegate for comparing two elements of this list.
127 /// <para>Since EFL 1.23.</para>
128 /// </summary>
129 /// <param name="a">First element.</param>
130 /// <param name="b">Second element.</param>
124 /// <returns>-1, 0 or 1 for respectively smaller, equal or larger.</returns> 131 /// <returns>-1, 0 or 1 for respectively smaller, equal or larger.</returns>
125 public delegate int Compare(T a, T b); 132 public delegate int Compare(T a, T b);
126 133
127 /// <summary>The number of elements on this list.</summary> 134 /// <summary>The number of elements on this list.
135 /// <para>Since EFL 1.23.</para>
136 /// </summary>
128 public int Length 137 public int Length
129 { 138 {
130 get { return Count(); } 139 get { return Count(); }
@@ -164,7 +173,9 @@ public class List<T> : IEnumerable<T>, IDisposable
164 } 173 }
165 174
166 175
167 /// <summary>Creates a new empty list.</summary> 176 /// <summary>Creates a new empty list.
177 /// <para>Since EFL 1.23.</para>
178 /// </summary>
168 public List() 179 public List()
169 { 180 {
170 InitNew(); 181 InitNew();
@@ -188,13 +199,17 @@ public class List<T> : IEnumerable<T>, IDisposable
188 OwnContent = ownContent; 199 OwnContent = ownContent;
189 } 200 }
190 201
191 /// <summary>Finalizes this list.</summary> 202 /// <summary>Finalizes this list.
203 /// <para>Since EFL 1.23.</para>
204 /// </summary>
192 ~List() 205 ~List()
193 { 206 {
194 Dispose(false); 207 Dispose(false);
195 } 208 }
196 209
197 /// <summary>Disposes of this list.</summary> 210 /// <summary>Disposes of this list.
211 /// <para>Since EFL 1.23.</para>
212 /// </summary>
198 /// <param name="disposing">Whether this was called from the finalizer (<c>false</c>) or from the 213 /// <param name="disposing">Whether this was called from the finalizer (<c>false</c>) or from the
199 /// <see cref="Dispose()"/> method.</param> 214 /// <see cref="Dispose()"/> method.</param>
200 protected virtual void Dispose(bool disposing) 215 protected virtual void Dispose(bool disposing)
@@ -227,20 +242,26 @@ public class List<T> : IEnumerable<T>, IDisposable
227 } 242 }
228 } 243 }
229 244
230 /// <summary>Disposes of this list.</summary> 245 /// <summary>Disposes of this list.
246 /// <para>Since EFL 1.23.</para>
247 /// </summary>
231 public void Dispose() 248 public void Dispose()
232 { 249 {
233 Dispose(true); 250 Dispose(true);
234 GC.SuppressFinalize(this); 251 GC.SuppressFinalize(this);
235 } 252 }
236 253
237 /// <summary>Disposes of this list.</summary> 254 /// <summary>Disposes of this list.
255 /// <para>Since EFL 1.23.</para>
256 /// </summary>
238 public void Free() 257 public void Free()
239 { 258 {
240 Dispose(); 259 Dispose();
241 } 260 }
242 261
243 /// <summary>Relinquishes of the native list.</summary> 262 /// <summary>Relinquishes of the native list.
263 /// <para>Since EFL 1.23.</para>
264 /// </summary>
244 /// <returns>The previously wrapped native list handle.</returns> 265 /// <returns>The previously wrapped native list handle.</returns>
245 public IntPtr Release() 266 public IntPtr Release()
246 { 267 {
@@ -249,27 +270,40 @@ public class List<T> : IEnumerable<T>, IDisposable
249 return h; 270 return h;
250 } 271 }
251 272
252 /// <summary>Sets whether this wrapper should own the native list or not.</summary> 273 /// <summary>Sets whether this wrapper should own the native list or not.
274 /// <para>Since EFL 1.23.</para>
275 /// </summary>
276 /// <param name="ownAll">If the hash own for all ownerships.</param>
253 public void SetOwnership(bool ownAll) 277 public void SetOwnership(bool ownAll)
254 { 278 {
255 Own = ownAll; 279 Own = ownAll;
256 OwnContent = ownAll; 280 OwnContent = ownAll;
257 } 281 }
258 282
259 /// <summary>Sets whether this wrapper should own the native list and its content or not.</summary> 283 /// <summary>Sets whether this wrapper should own the native list and
284 /// its content or not.
285 /// <para>Since EFL 1.23.</para>
286 /// </summary>
287 /// <param name="own">If own the object.</param>
288 /// <param name="ownContent">If own the content's object.</param>
260 public void SetOwnership(bool own, bool ownContent) 289 public void SetOwnership(bool own, bool ownContent)
261 { 290 {
262 Own = own; 291 Own = own;
263 OwnContent = ownContent; 292 OwnContent = ownContent;
264 } 293 }
265 294
266 /// <summary>Returns the number of elements in this list.</summary> 295 /// <summary>Returns the number of elements in this list.
296 /// <para>Since EFL 1.23.</para>
297 /// </summary>
298 /// <returns>The number of elements.</returns>
267 public int Count() 299 public int Count()
268 { 300 {
269 return (int)eina_list_count_custom_export_mono(Handle); 301 return (int)eina_list_count_custom_export_mono(Handle);
270 } 302 }
271 303
272 /// <summary>Appends <c>val</c> to the list.</summary> 304 /// <summary>Appends <c>val</c> to the list.
305 /// <para>Since EFL 1.23.</para>
306 /// </summary>
273 /// <param name="val">The item to be appended.</param> 307 /// <param name="val">The item to be appended.</param>
274 public void Append(T val) 308 public void Append(T val)
275 { 309 {
@@ -277,7 +311,9 @@ public class List<T> : IEnumerable<T>, IDisposable
277 Handle = eina_list_append(Handle, ele); 311 Handle = eina_list_append(Handle, ele);
278 } 312 }
279 313
280 /// <summary>Prepends <c>val</c> to the list.</summary> 314 /// <summary>Prepends <c>val</c> to the list.
315 /// <para>Since EFL 1.23.</para>
316 /// </summary>
281 /// <param name="val">The item to be prepended.</param> 317 /// <param name="val">The item to be prepended.</param>
282 public void Prepend(T val) 318 public void Prepend(T val)
283 { 319 {
@@ -285,7 +321,10 @@ public class List<T> : IEnumerable<T>, IDisposable
285 Handle = eina_list_prepend(Handle, ele); 321 Handle = eina_list_prepend(Handle, ele);
286 } 322 }
287 323
288 /// <summary>Inserts <c>val</c> in the list in a sorted manner. It presumes the list is already sorted.</summary> 324 /// <summary>Inserts <c>val</c> in the list in a sorted manner.
325 /// It presumes the list is already sorted.
326 /// <para>Since EFL 1.23.</para>
327 /// </summary>
289 /// <param name="val">The item to be inserted.</param> 328 /// <param name="val">The item to be inserted.</param>
290 public void SortedInsert(T val) 329 public void SortedInsert(T val)
291 { 330 {
@@ -293,8 +332,11 @@ public class List<T> : IEnumerable<T>, IDisposable
293 Handle = eina_list_sorted_insert(Handle, EinaCompareCb<T>(), ele); 332 Handle = eina_list_sorted_insert(Handle, EinaCompareCb<T>(), ele);
294 } 333 }
295 334
296 /// <summary>Inserts <c>val</c> in the list in a sorted manner with the given <c>compareCb</c> for element comparison. 335 /// <summary>Inserts <c>val</c> in the list in a sorted manner with the
297 /// It presumes the list is already sorted.</summary> 336 /// given <c>compareCb</c> for element comparison.
337 /// It presumes the list is already sorted.
338 /// <para>Since EFL 1.23.</para>
339 /// </summary>
298 /// <param name="compareCb">The function to compare two elements of the list.</param> 340 /// <param name="compareCb">The function to compare two elements of the list.</param>
299 /// <param name="val">The item to be inserted.</param> 341 /// <param name="val">The item to be inserted.</param>
300 public void SortedInsert(Compare compareCb, T val) 342 public void SortedInsert(Compare compareCb, T val)
@@ -303,21 +345,27 @@ public class List<T> : IEnumerable<T>, IDisposable
303 Handle = eina_list_sorted_insert(Handle, Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)), ele); 345 Handle = eina_list_sorted_insert(Handle, Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)), ele);
304 } 346 }
305 347
306 /// <summary>Sorts <c>limit</c> elements in this list inplace.</summary> 348 /// <summary>Sorts <c>limit</c> elements in this list inplace.
349 /// <para>Since EFL 1.23.</para>
350 /// </summary>
307 /// <param name="limit">The max number of elements to be sorted.</param> 351 /// <param name="limit">The max number of elements to be sorted.</param>
308 public void Sort(int limit = 0) 352 public void Sort(int limit = 0)
309 { 353 {
310 Handle = eina_list_sort(Handle, (uint)limit, EinaCompareCb<T>()); 354 Handle = eina_list_sort(Handle, (uint)limit, EinaCompareCb<T>());
311 } 355 }
312 356
313 /// <summary>Sorts all elements in this list inplace.</summary> 357 /// <summary>Sorts all elements in this list inplace.
358 /// <para>Since EFL 1.23.</para>
359 /// </summary>
314 /// <param name="compareCb">The function to compare two elements of the list.</param> 360 /// <param name="compareCb">The function to compare two elements of the list.</param>
315 public void Sort(Compare compareCb) 361 public void Sort(Compare compareCb)
316 { 362 {
317 Handle = eina_list_sort(Handle, 0, Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb))); 363 Handle = eina_list_sort(Handle, 0, Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)));
318 } 364 }
319 365
320 /// <summary>Sorts <c>limit</c> elements in this list inplace.</summary> 366 /// <summary>Sorts <c>limit</c> elements in this list inplace.
367 /// <para>Since EFL 1.23.</para>
368 /// </summary>
321 /// <param name="limit">The max number of elements to be sorted.</param> 369 /// <param name="limit">The max number of elements to be sorted.</param>
322 /// <param name="compareCb">The function to compare two elements of the list.</param> 370 /// <param name="compareCb">The function to compare two elements of the list.</param>
323 public void Sort(int limit, Compare compareCb) 371 public void Sort(int limit, Compare compareCb)
@@ -333,8 +381,11 @@ public class List<T> : IEnumerable<T>, IDisposable
333 } 381 }
334 382
335 /// <summary>Returns the <c>n</c>th element of this list. Due to marshalling details, the returned element 383 /// <summary>Returns the <c>n</c>th element of this list. Due to marshalling details, the returned element
336 /// may be a different C# object from the one you used to append.</summary> 384 /// may be a different C# object from the one you used to append.
385 /// <para>Since EFL 1.23.</para>
386 /// </summary>
337 /// <param name="n">The 0-based index to be retrieved.</param> 387 /// <param name="n">The 0-based index to be retrieved.</param>
388 /// <returns>The value in the specified element.</returns>
338 public T Nth(int n) 389 public T Nth(int n)
339 { 390 {
340 // TODO: check bounds ??? 391 // TODO: check bounds ???
@@ -342,7 +393,9 @@ public class List<T> : IEnumerable<T>, IDisposable
342 return NativeToManaged<T>(ele); 393 return NativeToManaged<T>(ele);
343 } 394 }
344 395
345 /// <summary>Sets the data at the <c>idx</c> position.</summary> 396 /// <summary>Sets the data at the <c>idx</c> position.
397 /// <para>Since EFL 1.23.</para>
398 /// </summary>
346 /// <param name="idx">The 0-based index to be set.</param> 399 /// <param name="idx">The 0-based index to be set.</param>
347 /// <param name="val">The value to be inserted.</param> 400 /// <param name="val">The value to be inserted.</param>
348 public void DataSet(int idx, T val) 401 public void DataSet(int idx, T val)
@@ -362,7 +415,9 @@ public class List<T> : IEnumerable<T>, IDisposable
362 InternalDataSet(pos, ele); 415 InternalDataSet(pos, ele);
363 } 416 }
364 417
365 /// <summary>Accessor for the data at the <c>idx</c> position.</summary> 418 /// <summary>Accessor for the data at the <c>idx</c> position.
419 /// <para>Since EFL 1.23.</para>
420 /// </summary>
366 /// <param name="idx">The 0-based index to be get/set.</param> 421 /// <param name="idx">The 0-based index to be get/set.</param>
367 public T this[int idx] 422 public T this[int idx]
368 { 423 {
@@ -376,7 +431,9 @@ public class List<T> : IEnumerable<T>, IDisposable
376 } 431 }
377 } 432 }
378 433
379 /// <summary>Returns the data at the last list element.</summary> 434 /// <summary>Returns the data at the last list element.
435 /// <para>Since EFL 1.23.</para>
436 /// </summary>
380 /// <returns>The value contained in the last list position.</returns> 437 /// <returns>The value contained in the last list position.</returns>
381 public T LastDataGet() 438 public T LastDataGet()
382 { 439 {
@@ -384,7 +441,9 @@ public class List<T> : IEnumerable<T>, IDisposable
384 return NativeToManaged<T>(ele); 441 return NativeToManaged<T>(ele);
385 } 442 }
386 443
387 /// <summary>Reverses this list in place.</summary> 444 /// <summary>Reverses this list in place.
445 /// <para>Since EFL 1.23.</para>
446 /// </summary>
388 /// <returns>A reference to this object.</returns> 447 /// <returns>A reference to this object.</returns>
389 public List<T> Reverse() 448 public List<T> Reverse()
390 { 449 {
@@ -392,13 +451,17 @@ public class List<T> : IEnumerable<T>, IDisposable
392 return this; 451 return this;
393 } 452 }
394 453
395 /// <summary>Randomly shuffles this list in place.</summary> 454 /// <summary>Randomly shuffles this list in place.
455 /// <para>Since EFL 1.23.</para>
456 /// </summary>
396 public void Shuffle() 457 public void Shuffle()
397 { 458 {
398 Handle = eina_list_shuffle(Handle, IntPtr.Zero); 459 Handle = eina_list_shuffle(Handle, IntPtr.Zero);
399 } 460 }
400 461
401 /// <summary>Gets a C# array of the elements in this list.</summary> 462 /// <summary>Gets a C# array of the elements in this list.
463 /// <para>Since EFL 1.23.</para>
464 /// </summary>
402 /// <returns>A managed array of the elements.</returns> 465 /// <returns>A managed array of the elements.</returns>
403 public T[] ToArray() 466 public T[] ToArray()
404 { 467 {
@@ -412,7 +475,9 @@ public class List<T> : IEnumerable<T>, IDisposable
412 return managed; 475 return managed;
413 } 476 }
414 477
415 /// <summary>Appends the given array of elements to this list.</summary> 478 /// <summary>Appends the given array of elements to this list.
479 /// <para>Since EFL 1.23.</para>
480 /// </summary>
416 /// <param name="values">The values to be appended.</param> 481 /// <param name="values">The values to be appended.</param>
417 public void AppendArray(T[] values) 482 public void AppendArray(T[] values)
418 { 483 {
@@ -423,21 +488,27 @@ public class List<T> : IEnumerable<T>, IDisposable
423 } 488 }
424 489
425 490
426 /// <summary>Gets an iterator that iterates this list in normal order.</summary> 491 /// <summary>Gets an iterator that iterates this list in normal order.
492 /// <para>Since EFL 1.23.</para>
493 /// </summary>
427 /// <returns>The iterator.</returns> 494 /// <returns>The iterator.</returns>
428 public Eina.Iterator<T> GetIterator() 495 public Eina.Iterator<T> GetIterator()
429 { 496 {
430 return new Eina.Iterator<T>(eina_list_iterator_new(Handle), true); 497 return new Eina.Iterator<T>(eina_list_iterator_new(Handle), true);
431 } 498 }
432 499
433 /// <summary>Gets an iterator that iterates this list in reverse order.</summary> 500 /// <summary>Gets an iterator that iterates this list in reverse order.
501 /// <para>Since EFL 1.23.</para>
502 /// </summary>
434 /// <returns>The iterator.</returns> 503 /// <returns>The iterator.</returns>
435 public Eina.Iterator<T> GetReversedIterator() 504 public Eina.Iterator<T> GetReversedIterator()
436 { 505 {
437 return new Eina.Iterator<T>(eina_list_iterator_reversed_new(Handle), true); 506 return new Eina.Iterator<T>(eina_list_iterator_reversed_new(Handle), true);
438 } 507 }
439 508
440 /// <summary>Gets an enumerator into this list.</summary> 509 /// <summary>Gets an enumerator into this list.
510 /// <para>Since EFL 1.23.</para>
511 /// </summary>
441 /// <returns>The enumerator.</returns> 512 /// <returns>The enumerator.</returns>
442 public IEnumerator<T> GetEnumerator() 513 public IEnumerator<T> GetEnumerator()
443 { 514 {
@@ -447,14 +518,18 @@ public class List<T> : IEnumerable<T>, IDisposable
447 } 518 }
448 } 519 }
449 520
450 /// <summary>Gets an enumerator into this list.</summary> 521 /// <summary>Gets an enumerator into this list.
522 /// <para>Since EFL 1.23.</para>
523 /// </summary>
451 /// <returns>The enumerator.</returns> 524 /// <returns>The enumerator.</returns>
452 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() 525 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
453 { 526 {
454 return this.GetEnumerator(); 527 return this.GetEnumerator();
455 } 528 }
456 529
457 /// <summary> Gets an Accessor for this List.</summary> 530 /// <summary> Gets an Accessor for this List.
531 /// <para>Since EFL 1.23.</para>
532 /// </summary>
458 /// <returns>The accessor.</returns> 533 /// <returns>The accessor.</returns>
459 public Eina.Accessor<T> GetAccessor() 534 public Eina.Accessor<T> GetAccessor()
460 { 535 {