Skip to content

Commit

Permalink
glib-2.0: Add GenericArray.find_custom() as variant of find_with_equa…
Browse files Browse the repository at this point in the history
…l_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.
  • Loading branch information
Corentin Noël authored and ricotz committed Nov 5, 2020
1 parent a7b2eb6 commit b02987b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vapi/glib-2.0.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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")]
Expand Down

0 comments on commit b02987b

Please sign in to comment.