2019-10-24 06:01:50 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2019 by its authors. See AUTHORS.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2017-12-06 16:03:55 -08:00
|
|
|
#pragma warning disable 1591
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Collections.Generic;
|
2019-09-30 19:10:40 -07:00
|
|
|
using System.ComponentModel;
|
2019-12-17 05:56:42 -08:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2019-12-23 14:15:50 -08:00
|
|
|
using System.Diagnostics.Contracts;
|
2017-11-23 16:49:22 -08:00
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
using static Eina.TraitFunctions;
|
|
|
|
using static Eina.ListNativeFunctions;
|
|
|
|
using Eina.Callbacks;
|
2017-11-23 16:49:22 -08:00
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
namespace Eina
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-09-30 19:10:40 -07:00
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
2019-12-18 18:46:11 -08:00
|
|
|
internal static class ListNativeFunctions
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_append(IntPtr list, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_prepend(IntPtr list, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_append_relative(IntPtr list, IntPtr data, IntPtr relative);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_append_relative_list(IntPtr list, IntPtr data, IntPtr relative);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_prepend_relative(IntPtr list, IntPtr data, IntPtr relative);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_prepend_relative_list(IntPtr list, IntPtr data, IntPtr relative);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_sorted_insert(IntPtr list, IntPtr func, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_remove(IntPtr list, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_remove_list(IntPtr list, IntPtr remove_list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_promote_list(IntPtr list, IntPtr move_list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_demote_list(IntPtr list, IntPtr move_list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_data_find(IntPtr list, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_data_find_list(IntPtr list, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_move(ref IntPtr to, ref IntPtr from, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_move_list(ref IntPtr to, ref IntPtr from, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_free(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void
|
2019-04-05 15:57:29 -07:00
|
|
|
efl_mono_thread_safe_eina_list_free(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_nth(IntPtr list, uint n);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_nth_list(IntPtr list, uint n);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_reverse(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_reverse_clone(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_clone(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_sort(IntPtr list, uint limit, IntPtr func);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_shuffle(IntPtr list, IntPtr func);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_merge(IntPtr left, IntPtr right);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_sorted_merge(IntPtr left, IntPtr right, IntPtr func);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_split_list(IntPtr list, IntPtr relative, ref IntPtr right);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_search_sorted_near_list(IntPtr list, IntPtr func, IntPtr data, IntPtr result_cmp);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_search_sorted_list(IntPtr list, IntPtr func, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_search_sorted(IntPtr list, IntPtr func, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_search_unsorted_list(IntPtr list, IntPtr func, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_search_unsorted(IntPtr list, IntPtr func, IntPtr data);
|
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_iterator_new(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_iterator_reversed_new(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_accessor_new(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eina)] internal static extern int
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_data_idx(IntPtr list, IntPtr data);
|
|
|
|
|
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_last_custom_export_mono(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_next_custom_export_mono(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_prev_custom_export_mono(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_data_get_custom_export_mono(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_data_set_custom_export_mono(IntPtr list, IntPtr data);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern uint
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_count_custom_export_mono(IntPtr list);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
eina_list_last_data_get_custom_export_mono(IntPtr list);
|
|
|
|
}
|
|
|
|
|
2019-10-03 23:46:29 -07:00
|
|
|
/// <summary>Native wrapper around a linked list of items.
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <para>Since EFL 1.23.</para>
|
2019-10-03 23:46:29 -07:00
|
|
|
/// </summary>
|
2019-12-17 05:56:42 -08:00
|
|
|
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix",
|
|
|
|
Justification="This is a generalized container mapping the native one.")]
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public class List<T> : IList<T>, IEnumerable<T>, IDisposable
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
2019-09-30 19:10:40 -07:00
|
|
|
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public IntPtr Handle {get; set; } = IntPtr.Zero;
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Whether this managed list owns the native one.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
internal bool Own { get; set; }
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Whether the native list wrapped owns the content it points to.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
///</summary>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
internal bool OwnContent { get; set; }
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Delegate for comparing two elements of this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="a">First element.</param>
|
|
|
|
/// <param name="b">Second element.</param>
|
2019-09-30 19:08:44 -07:00
|
|
|
/// <returns>-1, 0 or 1 for respectively smaller, equal or larger.</returns>
|
|
|
|
public delegate int Compare(T a, T b);
|
|
|
|
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public bool IsReadOnly { get => !OwnContent; }
|
|
|
|
|
|
|
|
/// <summary>The number of elements in this list.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
2019-10-14 07:01:36 -07:00
|
|
|
/// </summary>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public int Count
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
get => (int)eina_list_count_custom_export_mono(Handle);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
private void InitNew()
|
|
|
|
{
|
|
|
|
Handle = IntPtr.Zero;
|
|
|
|
Own = true;
|
|
|
|
OwnContent = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private IntPtr InternalLast()
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> eina_list_last_custom_export_mono(Handle);
|
2017-11-23 16:49:22 -08:00
|
|
|
|
|
|
|
private static IntPtr InternalNext(IntPtr list)
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> eina_list_next_custom_export_mono(list);
|
|
|
|
|
|
|
|
private static IntPtr InternalPrev(IntPtr list)
|
|
|
|
=> eina_list_prev_custom_export_mono(list);
|
|
|
|
|
|
|
|
private static IntPtr InternalDataGet(IntPtr list)
|
|
|
|
=> eina_list_data_get_custom_export_mono(list);
|
|
|
|
|
|
|
|
private static IntPtr InternalDataSet(IntPtr list, IntPtr data)
|
|
|
|
=> eina_list_data_set_custom_export_mono(list, data);
|
|
|
|
|
|
|
|
private IntPtr GetNative(int idx, Func<IntPtr, uint, IntPtr> f)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
if (!(0 <= idx && idx < Count))
|
|
|
|
{
|
2019-12-18 12:42:08 -08:00
|
|
|
throw new ArgumentOutOfRangeException(nameof(idx), $"{nameof(idx)} cannot be negative, neither smaller than {nameof(Count)}");
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
var ele = f(Handle, (uint)idx);
|
|
|
|
if (ele == IntPtr.Zero)
|
|
|
|
{
|
2019-12-18 12:42:08 -08:00
|
|
|
throw new ArgumentOutOfRangeException(nameof(idx), $"There is no position {nameof(idx)}");
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ele;
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
private IntPtr GetNativeDataPointer(int idx)
|
|
|
|
=> GetNative(idx, eina_list_nth);
|
|
|
|
|
|
|
|
private IntPtr GetNativePointer(int idx)
|
|
|
|
=> GetNative(idx, eina_list_nth_list);
|
|
|
|
|
|
|
|
private void RequireWritable()
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
if (IsReadOnly)
|
|
|
|
{
|
|
|
|
throw new NotSupportedException("Cannot modify read-only container.");
|
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
private void CheckOwnerships()
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
if ((Own == false) && (OwnContent == true))
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException(nameof(Own) + "/" + nameof(OwnContent));
|
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
private void DeleteData(IntPtr ele)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
if (OwnContent)
|
|
|
|
{
|
|
|
|
NativeFree<T>(InternalDataGet(ele));
|
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
private U LoopingThrough<U>(T val, Func<int, U> f1, Func<U> f2)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
IntPtr cur = Handle;
|
|
|
|
for (; cur != IntPtr.Zero; ++i, cur = InternalNext(cur))
|
|
|
|
{
|
|
|
|
if (NativeToManaged<T>(InternalDataGet(cur)).Equals(val))
|
|
|
|
{
|
|
|
|
return f1(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return f2();
|
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Creates a new empty list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public List() => InitNew();
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <summary>Creates a new list wrapping the given handle.</summary>
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
2017-11-23 16:49:22 -08:00
|
|
|
public List(IntPtr handle, bool own)
|
|
|
|
{
|
|
|
|
Handle = handle;
|
|
|
|
Own = own;
|
|
|
|
OwnContent = own;
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
CheckOwnerships();
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <summary>Creates a new list wrapping the given handle.</summary>
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
2017-11-23 16:49:22 -08:00
|
|
|
public List(IntPtr handle, bool own, bool ownContent)
|
|
|
|
{
|
|
|
|
Handle = handle;
|
|
|
|
Own = own;
|
|
|
|
OwnContent = ownContent;
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
CheckOwnerships();
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Finalizes this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
~List() => Dispose(false);
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Disposes of this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="disposing">Whether this was called from the finalizer (<c>false</c>) or from the
|
|
|
|
/// <see cref="Dispose()"/> method.</param>
|
2017-11-23 16:49:22 -08:00
|
|
|
protected virtual void Dispose(bool disposing)
|
|
|
|
{
|
|
|
|
IntPtr h = Handle;
|
|
|
|
Handle = IntPtr.Zero;
|
|
|
|
if (h == IntPtr.Zero)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
return;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
for (IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr))
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
if (!OwnContent)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
break;
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
|
|
|
|
DeleteData(curr);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Own)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-04-05 15:57:29 -07:00
|
|
|
if (disposing)
|
|
|
|
{
|
|
|
|
eina_list_free(h);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_mono_thread_safe_eina_list_free(h);
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Disposes of this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2017-11-23 16:49:22 -08:00
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
Dispose(true);
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Disposes of this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public void Free() => Dispose();
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Sets whether this wrapper should own the native list or not.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ownAll">If the hash own for all ownerships.</param>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
internal void SetOwnership(bool ownAll)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
Own = ownAll;
|
|
|
|
OwnContent = ownAll;
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
CheckOwnerships();
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Sets whether this wrapper should own the native list and
|
|
|
|
/// its content or not.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="own">If own the object.</param>
|
|
|
|
/// <param name="ownContent">If own the content's object.</param>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
internal void SetOwnership(bool own, bool ownContent)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
Own = own;
|
|
|
|
OwnContent = ownContent;
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
CheckOwnerships();
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Appends <c>val</c> to the list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="val">The item to be appended.</param>
|
2017-11-23 16:49:22 -08:00
|
|
|
public void Append(T val)
|
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
Handle = eina_list_append(Handle, ManagedToNativeAlloc(val));
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Prepends <c>val</c> to the list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="val">The item to be prepended.</param>
|
2017-11-23 16:49:22 -08:00
|
|
|
public void Prepend(T val)
|
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
Handle = eina_list_prepend(Handle, ManagedToNativeAlloc(val));
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Inserts <c>val</c> in the list in a sorted manner.
|
|
|
|
/// It presumes the list is already sorted.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="val">The item to be inserted.</param>
|
2017-11-23 16:49:22 -08:00
|
|
|
public void SortedInsert(T val)
|
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
Handle = eina_list_sorted_insert(Handle,
|
|
|
|
EinaCompareCb<T>(),
|
|
|
|
ManagedToNativeAlloc(val));
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Inserts <c>val</c> in the list in a sorted manner with the
|
|
|
|
/// given <c>compareCb</c> for element comparison.
|
|
|
|
/// It presumes the list is already sorted.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="compareCb">The function to compare two elements of the list.</param>
|
|
|
|
/// <param name="val">The item to be inserted.</param>
|
2019-09-30 19:08:44 -07:00
|
|
|
public void SortedInsert(Compare compareCb, T val)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
Handle = eina_list_sorted_insert(Handle,
|
|
|
|
Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)),
|
|
|
|
ManagedToNativeAlloc(val));
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Sorts <c>limit</c> elements in this list inplace.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="limit">The max number of elements to be sorted.</param>
|
2017-11-23 16:49:22 -08:00
|
|
|
public void Sort(int limit = 0)
|
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
Handle = eina_list_sort(Handle, (uint)limit, EinaCompareCb<T>());
|
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Sorts all elements in this list inplace.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="compareCb">The function to compare two elements of the list.</param>
|
2019-09-30 19:08:44 -07:00
|
|
|
public void Sort(Compare compareCb)
|
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
Handle = eina_list_sort(Handle, (uint)0,
|
|
|
|
Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)));
|
2019-09-30 19:08:44 -07:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Sorts <c>limit</c> elements in this list inplace.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="limit">The max number of elements to be sorted.</param>
|
|
|
|
/// <param name="compareCb">The function to compare two elements of the list.</param>
|
2019-09-30 19:08:44 -07:00
|
|
|
public void Sort(int limit, Compare compareCb)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
Handle = eina_list_sort(Handle, (uint)limit,
|
|
|
|
Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)));
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-09-30 19:08:44 -07:00
|
|
|
private Eina.Callbacks.EinaCompareCb GetNativeCompareCb(Compare managedCb)
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> (IntPtr a, IntPtr b)
|
|
|
|
=> managedCb(NativeToManaged<T>(a), NativeToManaged<T>(b));
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <summary>Returns the <c>n</c>th element of this list. Due to marshalling details, the returned element
|
2019-10-14 07:01:36 -07:00
|
|
|
/// may be a different C# object from the one you used to append.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="n">The 0-based index to be retrieved.</param>
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <returns>The value in the specified element.</returns>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public T Nth(int n) => NativeToManaged<T>(GetNativeDataPointer(n));
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Sets the data at the <c>idx</c> position.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="idx">The 0-based index to be set.</param>
|
|
|
|
/// <param name="val">The value to be inserted.</param>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
internal void DataSet(int idx, T val)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
IntPtr pos = GetNativePointer(idx);
|
|
|
|
DeleteData(pos);
|
|
|
|
InternalDataSet(pos, ManagedToNativeAlloc(val));
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Accessor for the data at the <c>idx</c> position.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="idx">The 0-based index to be get/set.</param>
|
2017-11-23 16:49:22 -08:00
|
|
|
public T this[int idx]
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return Nth(idx);
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
DataSet(idx, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Returns the data at the last list element.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>The value contained in the last list position.</returns>
|
2017-11-23 16:49:22 -08:00
|
|
|
public T LastDataGet()
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> NativeToManaged<T>(eina_list_last_data_get_custom_export_mono(Handle));
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Reverses this list in place.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>A reference to this object.</returns>
|
2018-09-06 08:10:51 -07:00
|
|
|
public List<T> Reverse()
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
Handle = eina_list_reverse(Handle);
|
2018-09-06 08:10:51 -07:00
|
|
|
return this;
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Randomly shuffles this list in place.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2017-11-23 16:49:22 -08:00
|
|
|
public void Shuffle()
|
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
Handle = eina_list_shuffle(Handle, IntPtr.Zero);
|
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Gets a C# array of the elements in this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>A managed array of the elements.</returns>
|
2017-11-23 16:49:22 -08:00
|
|
|
public T[] ToArray()
|
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
var managed = new T[Count];
|
2017-11-23 16:49:22 -08:00
|
|
|
int i = 0;
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
for (IntPtr curr = Handle; curr != IntPtr.Zero;
|
|
|
|
curr = InternalNext(curr), ++i)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
managed[i] = NativeToManaged<T>(InternalDataGet(curr));
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
return managed;
|
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Appends the given array of elements to this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <param name="values">The values to be appended.</param>
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
public void Append(T[] values)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
2019-12-23 14:15:50 -08:00
|
|
|
Contract.Requires(values != null, nameof(values));
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
foreach (T v in values)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
Append(v);
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Gets an iterator that iterates this list in normal order.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>The iterator.</returns>
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
public Eina.Iterator<T> GetIterator()
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> new Eina.Iterator<T>(eina_list_iterator_new(Handle), true);
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Gets an iterator that iterates this list in reverse order.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>The iterator.</returns>
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
public Eina.Iterator<T> GetReversedIterator()
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> new Eina.Iterator<T>(eina_list_iterator_reversed_new(Handle), true);
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Gets an enumerator into this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>The enumerator.</returns>
|
2017-11-23 16:49:22 -08:00
|
|
|
public IEnumerator<T> GetEnumerator()
|
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
for (IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr))
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
yield return NativeToManaged<T>(InternalDataGet(curr));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary>Gets an enumerator into this list.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>The enumerator.</returns>
|
2017-11-23 16:49:22 -08:00
|
|
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> this.GetEnumerator();
|
2018-05-17 20:50:37 -07:00
|
|
|
|
2019-10-14 07:01:36 -07:00
|
|
|
/// <summary> Gets an Accessor for this List.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
2019-09-30 19:10:40 -07:00
|
|
|
/// <returns>The accessor.</returns>
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
public Eina.Accessor<T> GetAccessor()
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
=> new Eina.Accessor<T>(eina_list_accessor_new(Handle),
|
|
|
|
Ownership.Managed);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Removes the first occurrence of a specific object.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="val">The object to remove.</param>
|
|
|
|
public bool Remove(T val)
|
2018-05-17 20:50:37 -07:00
|
|
|
{
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
var prev_count = Count;
|
|
|
|
var deleted = LoopingThrough(val,
|
|
|
|
(i) =>
|
|
|
|
{
|
|
|
|
RemoveAt(i);
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
() => false);
|
|
|
|
|
|
|
|
return deleted && (prev_count - 1 == Count);
|
2018-05-17 20:50:37 -07:00
|
|
|
}
|
c#: Implement IList<T> to Eina.List.
Summary:
Container can have three configuration over `Own` and `OwnContent`:
`Own = true` and `OwnContent = true`;
`Own = true` and `OwnContent = false`;
`Own = false`and `OwnContent = false;
If someone try to instanciate the container with `Own = false` and `OwnContent = true`, a exception raises.
There is two Ownerships' behaviours in c#, where `IsReadOnly` is responsible and `IsReadOnly = !OwnContent`:
Full Ownership: User can use modify/Add/Remove operations over the container, this is implemented with `OwnContent = true`.
No Ownership: User **cannot** use modify/Add/Remove operations, this is implemented with `OwnContent = false`.
For the memory, `Own` frees the node, while `OwnContent` frees the data portion.
ref T8487
Reviewers: lauromoura, felipealmeida, YOhoho, segfaultxavi, jptiz
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8487
Differential Revision: https://phab.enlightenment.org/D10742
2019-12-11 13:47:45 -08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Adds an item.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="val">The object to add.</param>
|
|
|
|
public void Add(T val) => Append(val);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Removes all items.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
public void Clear()
|
|
|
|
{
|
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
for (; Handle != IntPtr.Zero;)
|
|
|
|
{
|
|
|
|
Handle = eina_list_remove_list(Handle, Handle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Determines whether the <see cref="List{T}" /> contains a specific value.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="val">The object to locate.</param>
|
|
|
|
public bool Contains(T val)
|
|
|
|
=> LoopingThrough(val, (i) => true, () => false);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Determines the index of a specific item.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="val">The object to locate.</param>
|
|
|
|
public int IndexOf(T val)
|
|
|
|
=> LoopingThrough(val, (i) => i, () => -1);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Inserts an item to the <see cref="List{T}" /> at the specified index.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="idx">The zero-based index at which item should be inserted.</param>
|
|
|
|
/// <param name="val">The object to insert.</param>
|
|
|
|
public void Insert(int idx, T val)
|
|
|
|
{
|
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
if (idx == 0)
|
|
|
|
{
|
|
|
|
Prepend(val);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (idx == Count)
|
|
|
|
{
|
|
|
|
Append(val);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (idx < 0)
|
|
|
|
{
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(idx), $"{nameof(idx)} cannot be negative.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Count < idx)
|
|
|
|
{
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(idx), $"{nameof(idx)} cannot be greater than {nameof(Count)} + 1.");
|
|
|
|
}
|
|
|
|
|
|
|
|
Handle = eina_list_prepend_relative_list(Handle, ManagedToNativeAlloc(val),
|
|
|
|
GetNativePointer(idx));
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Removes the <see cref="List{T}" /> item at the specified index.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="idx">The zero-based index of the item to remove.</param>
|
|
|
|
public void RemoveAt(int idx)
|
|
|
|
{
|
|
|
|
RequireWritable();
|
|
|
|
|
|
|
|
var ele = GetNativePointer(idx);
|
|
|
|
DeleteData(ele);
|
|
|
|
Handle = eina_list_remove_list(Handle, ele);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Copies the elements of the <see cref="List{T}" /> to an
|
|
|
|
/// <see cref="Array" />, starting at a particular <see cref="Array" /> index.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="array">The one-dimensional <see cref="Array" /> that is the
|
|
|
|
/// destination of the elements copied from <see cref="List{T}" />.
|
|
|
|
/// The <see cref="Array" /> must have zero-based indexing.</param>
|
|
|
|
/// <param name="arrayIndex">The zero-based index in array at which copying
|
|
|
|
/// begins.</param>
|
|
|
|
public void CopyTo(T[] array, int arrayIndex)
|
|
|
|
=> ToArray().CopyTo(array, arrayIndex);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|