diff options
author | shaderbeast <jd16581556@gmail.com> | 2019-05-23 10:23:47 +0200 |
---|---|---|
committer | shaderbeast <jd16581556@gmail.com> | 2019-05-23 10:23:47 +0200 |
commit | 48bd2e459fe4c0ca7dc2a29446128eff9fa99070 (patch) | |
tree | 50a906da912c5752ec8a597b367b2d747a17d2c9 /modules/gdnative | |
parent | 0239d8bd9fa03965439aac2482d18746f807bd00 (diff) |
Added native binding for dictionary duplication
Added entry in gdnative_api.json
Added function to header as well
Fixed versioning
Diffstat (limited to 'modules/gdnative')
-rw-r--r-- | modules/gdnative/gdnative/dictionary.cpp | 9 | ||||
-rw-r--r-- | modules/gdnative/gdnative_api.json | 19 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/dictionary.h | 2 |
3 files changed, 29 insertions, 1 deletions
diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index 2c6c9e2de2..fff3fc3625 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -55,6 +55,15 @@ void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) { self->~Dictionary(); } +godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep) { + const Dictionary *self = (const Dictionary *)p_self; + godot_dictionary res; + Dictionary *val = (Dictionary *)&res; + memnew_placement(val, Dictionary); + *val = self->duplicate(p_deep); + return res; +} + godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self) { const Dictionary *self = (const Dictionary *)p_self; return self->size(); diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 9882a89794..de36a43384 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -11,7 +11,24 @@ "major": 1, "minor": 1 }, - "next": null, + "next": { + "type": "CORE", + "version": { + "major": 1, + "minor": 2 + }, + "next": null, + "api": [ + { + "name": "godot_dictionary_duplicate", + "return_type": "godot_dictionary", + "arguments": [ + ["const godot_dictionary *", "p_self"], + ["const godot_bool", "p_deep"] + ] + } + ] + }, "api": [ { "name": "godot_color_to_abgr32", diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h index 14e35b4692..483cd9c4e3 100644 --- a/modules/gdnative/include/gdnative/dictionary.h +++ b/modules/gdnative/include/gdnative/dictionary.h @@ -63,6 +63,8 @@ void GDAPI godot_dictionary_new(godot_dictionary *r_dest); void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src); void GDAPI godot_dictionary_destroy(godot_dictionary *p_self); +godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep); + godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self); godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self); |