diff options
author | Corentin Noël <corentin@elementary.io> | 2020-11-03 17:22:48 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-11-05 12:39:52 +0100 |
commit | b02987bb4fed9ea3c0f338b130a4b3e36194042c (patch) | |
tree | e51a4f8313fdb4f1440c13cbcd8d032ef90c0407 | |
parent | a7b2eb60f0bf7189648fe58a801fff2bf096f9de (diff) | |
download | vala-b02987bb4fed9ea3c0f338b130a4b3e36194042c.tar.gz |
glib-2.0: Add GenericArray.find_custom() as variant of find_with_equal_func()
This allows the needle to be a different type as the actual element type.
The implementation of ArraySearchFunc<G,T> is more customizable this way.
-rw-r--r-- | vapi/glib-2.0.vapi | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi index d024eb294..23841a337 100644 --- a/vapi/glib-2.0.vapi +++ b/vapi/glib-2.0.vapi @@ -5399,6 +5399,9 @@ namespace GLib { public void** pdata; } + [CCode (cname = "GEqualFunc", has_target = false)] + public delegate bool ArraySearchFunc<G,T> (G element, T needle); + [Compact] [CCode (cname = "GPtrArray", cprefix = "g_ptr_array_", ref_function = "g_ptr_array_ref", unref_function = "g_ptr_array_unref", type_id = "G_TYPE_PTR_ARRAY")] [GIR (name = "PtrArray")] @@ -5416,6 +5419,9 @@ namespace GLib { [Version (since = "2.54")] public bool find (G needle, out uint index = null); [Version (since = "2.54")] + [CCode (cname = "g_ptr_array_find_with_equal_func")] + public bool find_custom<T> (T needle, GLib.ArraySearchFunc<G,T>? equal_func, out uint index = null); + [Version (since = "2.54")] public bool find_with_equal_func (G needle, GLib.EqualFunc<G>? equal_func, out uint index = null); public void foreach (GLib.Func<G> func); [CCode (cname = "g_ptr_array_index")] |