summaryrefslogtreecommitdiffstats
path: root/modules/gdnative
diff options
context:
space:
mode:
authorpoke1024 <poke1024@gmx.de>2017-11-02 19:04:38 +0100
committerBernhard Liebl <Bernhard.Liebl@gmx.org>2017-11-21 08:50:31 +0100
commitd6e54de50239e8ac1de645bd411eeddbf627e4dc (patch)
treea8ac54ac05e8b13daca8eb78c8235ca934180507 /modules/gdnative
parent7c90d51b729d31557ad6d45a5fe18d11f6752cf1 (diff)
downloadredot-engine-d6e54de50239e8ac1de645bd411eeddbf627e4dc.tar.gz
Add bsearch and bsearch_custom to Array
Diffstat (limited to 'modules/gdnative')
-rw-r--r--modules/gdnative/gdnative/array.cpp11
-rw-r--r--modules/gdnative/gdnative_api.json20
-rw-r--r--modules/gdnative/include/gdnative/array.h4
3 files changed, 35 insertions, 0 deletions
diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp
index e0d9514985..8351c43574 100644
--- a/modules/gdnative/gdnative/array.cpp
+++ b/modules/gdnative/gdnative/array.cpp
@@ -302,6 +302,17 @@ void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, con
self->sort_custom((Object *)p_obj, *func);
}
+godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before) {
+ Array *self = (Array *)p_self;
+ return self->bsearch((const Variant *)p_value, p_before);
+}
+
+godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before) {
+ Array *self = (Array *)p_self;
+ const String *func = (const String *)p_func;
+ return self->bsearch_custom((const Variant *)p_value, (Object *)p_obj, *func, p_before);
+}
+
void GDAPI godot_array_destroy(godot_array *p_self) {
((Array *)p_self)->~Array();
}
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 007c7955d4..0438a196cf 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -2680,6 +2680,26 @@
]
},
{
+ "name": "godot_array_bsearch",
+ "return_type": "godot_int",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"],
+ ["const godot_bool", "p_before"]
+ ]
+ },
+ {
+ "name": "godot_array_bsearch_custom",
+ "return_type": "godot_int",
+ "arguments": [
+ ["godot_array *", "p_self"],
+ ["const godot_variant *", "p_value"],
+ ["godot_object *", "p_obj"],
+ ["const godot_string *", "p_func"],
+ ["const godot_bool", "p_before"]
+ ]
+ },
+ {
"name": "godot_array_destroy",
"return_type": "void",
"arguments": [
diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h
index 01ae61e280..484ffd10ba 100644
--- a/modules/gdnative/include/gdnative/array.h
+++ b/modules/gdnative/include/gdnative/array.h
@@ -124,6 +124,10 @@ void GDAPI godot_array_sort(godot_array *p_self);
void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func);
+godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before);
+
+godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before);
+
void GDAPI godot_array_destroy(godot_array *p_self);
#ifdef __cplusplus