From a3937e122094bfb70fb6124fabb261173ecca243 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Thu, 18 Jan 2018 02:44:37 +0100 Subject: [PATCH] Added GDNative copy constructor for PoolVectors Read and Write --- modules/gdnative/gdnative/pool_arrays.cpp | 56 +++++++++++ modules/gdnative/gdnative_api.json | 98 +++++++++++++++++++ .../gdnative/include/gdnative/pool_arrays.h | 14 +++ 3 files changed, 168 insertions(+) diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index 6e014905a3f..6688be1a0d8 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -700,6 +700,10 @@ void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) { // read accessor functions // +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read_access_copy(const godot_pool_byte_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_byte_array_read_access *)memnew(PoolVector::Read(*other)); +} const uint8_t GDAPI *godot_pool_byte_array_read_access_ptr(const godot_pool_byte_array_read_access *p_read) { const PoolVector::Read *read = (const PoolVector::Read *)p_read; return read->ptr(); @@ -713,6 +717,10 @@ void GDAPI godot_pool_byte_array_read_access_destroy(godot_pool_byte_array_read_ memdelete((PoolVector::Read *)p_read); } +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read_access_copy(const godot_pool_int_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_int_array_read_access *)memnew(PoolVector::Read(*other)); +} const godot_int GDAPI *godot_pool_int_array_read_access_ptr(const godot_pool_int_array_read_access *p_read) { const PoolVector::Read *read = (const PoolVector::Read *)p_read; return read->ptr(); @@ -726,6 +734,10 @@ void GDAPI godot_pool_int_array_read_access_destroy(godot_pool_int_array_read_ac memdelete((PoolVector::Read *)p_read); } +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read_access_copy(const godot_pool_real_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_real_array_read_access *)memnew(PoolVector::Read(*other)); +} const godot_real GDAPI *godot_pool_real_array_read_access_ptr(const godot_pool_real_array_read_access *p_read) { const PoolVector::Read *read = (const PoolVector::Read *)p_read; return read->ptr(); @@ -739,6 +751,10 @@ void GDAPI godot_pool_real_array_read_access_destroy(godot_pool_real_array_read_ memdelete((PoolVector::Read *)p_read); } +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read_access_copy(const godot_pool_string_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_string_array_read_access *)memnew(PoolVector::Read(*other)); +} const godot_string GDAPI *godot_pool_string_array_read_access_ptr(const godot_pool_string_array_read_access *p_read) { const PoolVector::Read *read = (const PoolVector::Read *)p_read; return (const godot_string *)read->ptr(); @@ -752,6 +768,10 @@ void GDAPI godot_pool_string_array_read_access_destroy(godot_pool_string_array_r memdelete((PoolVector::Read *)p_read); } +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read_access_copy(const godot_pool_vector2_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_vector2_array_read_access *)memnew(PoolVector::Read(*other)); +} const godot_vector2 GDAPI *godot_pool_vector2_array_read_access_ptr(const godot_pool_vector2_array_read_access *p_read) { const PoolVector::Read *read = (const PoolVector::Read *)p_read; return (const godot_vector2 *)read->ptr(); @@ -765,6 +785,10 @@ void GDAPI godot_pool_vector2_array_read_access_destroy(godot_pool_vector2_array memdelete((PoolVector::Read *)p_read); } +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read_access_copy(const godot_pool_vector3_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_vector3_array_read_access *)memnew(PoolVector::Read(*other)); +} const godot_vector3 GDAPI *godot_pool_vector3_array_read_access_ptr(const godot_pool_vector3_array_read_access *p_read) { const PoolVector::Read *read = (const PoolVector::Read *)p_read; return (const godot_vector3 *)read->ptr(); @@ -778,6 +802,10 @@ void GDAPI godot_pool_vector3_array_read_access_destroy(godot_pool_vector3_array memdelete((PoolVector::Read *)p_read); } +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read_access_copy(const godot_pool_color_array_read_access *p_other) { + PoolVector::Read *other = (PoolVector::Read *)p_other; + return (godot_pool_color_array_read_access *)memnew(PoolVector::Read(*other)); +} const godot_color GDAPI *godot_pool_color_array_read_access_ptr(const godot_pool_color_array_read_access *p_read) { const PoolVector::Read *read = (const PoolVector::Read *)p_read; return (const godot_color *)read->ptr(); @@ -795,6 +823,10 @@ void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_rea // write accessor functions // +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write_access_copy(const godot_pool_byte_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_byte_array_write_access *)memnew(PoolVector::Write(*other)); +} uint8_t GDAPI *godot_pool_byte_array_write_access_ptr(const godot_pool_byte_array_write_access *p_write) { PoolVector::Write *write = (PoolVector::Write *)p_write; return write->ptr(); @@ -808,6 +840,10 @@ void GDAPI godot_pool_byte_array_write_access_destroy(godot_pool_byte_array_writ memdelete((PoolVector::Write *)p_write); } +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write_access_copy(const godot_pool_int_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_int_array_write_access *)memnew(PoolVector::Write(*other)); +} godot_int GDAPI *godot_pool_int_array_write_access_ptr(const godot_pool_int_array_write_access *p_write) { PoolVector::Write *write = (PoolVector::Write *)p_write; return write->ptr(); @@ -821,6 +857,10 @@ void GDAPI godot_pool_int_array_write_access_destroy(godot_pool_int_array_write_ memdelete((PoolVector::Write *)p_write); } +godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write_access_copy(const godot_pool_real_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_real_array_write_access *)memnew(PoolVector::Write(*other)); +} godot_real GDAPI *godot_pool_real_array_write_access_ptr(const godot_pool_real_array_write_access *p_write) { PoolVector::Write *write = (PoolVector::Write *)p_write; return write->ptr(); @@ -834,6 +874,10 @@ void GDAPI godot_pool_real_array_write_access_destroy(godot_pool_real_array_writ memdelete((PoolVector::Write *)p_write); } +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write_access_copy(const godot_pool_string_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_string_array_write_access *)memnew(PoolVector::Write(*other)); +} godot_string GDAPI *godot_pool_string_array_write_access_ptr(const godot_pool_string_array_write_access *p_write) { PoolVector::Write *write = (PoolVector::Write *)p_write; return (godot_string *)write->ptr(); @@ -847,6 +891,10 @@ void GDAPI godot_pool_string_array_write_access_destroy(godot_pool_string_array_ memdelete((PoolVector::Write *)p_write); } +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write_access_copy(const godot_pool_vector2_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_vector2_array_write_access *)memnew(PoolVector::Write(*other)); +} godot_vector2 GDAPI *godot_pool_vector2_array_write_access_ptr(const godot_pool_vector2_array_write_access *p_write) { PoolVector::Write *write = (PoolVector::Write *)p_write; return (godot_vector2 *)write->ptr(); @@ -860,6 +908,10 @@ void GDAPI godot_pool_vector2_array_write_access_destroy(godot_pool_vector2_arra memdelete((PoolVector::Write *)p_write); } +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write_access_copy(const godot_pool_vector3_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_vector3_array_write_access *)memnew(PoolVector::Write(*other)); +} godot_vector3 GDAPI *godot_pool_vector3_array_write_access_ptr(const godot_pool_vector3_array_write_access *p_write) { PoolVector::Write *write = (PoolVector::Write *)p_write; return (godot_vector3 *)write->ptr(); @@ -873,6 +925,10 @@ void GDAPI godot_pool_vector3_array_write_access_destroy(godot_pool_vector3_arra memdelete((PoolVector::Write *)p_write); } +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write_access_copy(const godot_pool_color_array_write_access *p_other) { + PoolVector::Write *other = (PoolVector::Write *)p_other; + return (godot_pool_color_array_write_access *)memnew(PoolVector::Write(*other)); +} godot_color GDAPI *godot_pool_color_array_write_access_ptr(const godot_pool_color_array_write_access *p_write) { PoolVector::Write *write = (PoolVector::Write *)p_write; return (godot_color *)write->ptr(); diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 6e3cf167580..59a9c0b090f 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -2089,6 +2089,13 @@ ["godot_pool_color_array *", "p_self"] ] }, + { + "name": "godot_pool_byte_array_read_access_copy", + "return_type": "godot_pool_byte_array_read_access *", + "arguments": [ + ["const godot_pool_byte_array_read_access *", "p_read"] + ] + }, { "name": "godot_pool_byte_array_read_access_ptr", "return_type": "const uint8_t *", @@ -2111,6 +2118,13 @@ ["godot_pool_byte_array_read_access *", "p_read"] ] }, + { + "name": "godot_pool_int_array_read_access_copy", + "return_type": "godot_pool_int_array_read_access *", + "arguments": [ + ["const godot_pool_int_array_read_access *", "p_read"] + ] + }, { "name": "godot_pool_int_array_read_access_ptr", "return_type": "const godot_int *", @@ -2133,6 +2147,13 @@ ["godot_pool_int_array_read_access *", "p_read"] ] }, + { + "name": "godot_pool_real_array_read_access_copy", + "return_type": "godot_pool_real_array_read_access *", + "arguments": [ + ["const godot_pool_real_array_read_access *", "p_read"] + ] + }, { "name": "godot_pool_real_array_read_access_ptr", "return_type": "const godot_real *", @@ -2155,6 +2176,13 @@ ["godot_pool_real_array_read_access *", "p_read"] ] }, + { + "name": "godot_pool_string_array_read_access_copy", + "return_type": "godot_pool_string_array_read_access *", + "arguments": [ + ["const godot_pool_string_array_read_access *", "p_read"] + ] + }, { "name": "godot_pool_string_array_read_access_ptr", "return_type": "const godot_string *", @@ -2177,6 +2205,13 @@ ["godot_pool_string_array_read_access *", "p_read"] ] }, + { + "name": "godot_pool_vector2_array_read_access_copy", + "return_type": "godot_pool_vector2_array_read_access *", + "arguments": [ + ["const godot_pool_vector2_array_read_access *", "p_read"] + ] + }, { "name": "godot_pool_vector2_array_read_access_ptr", "return_type": "const godot_vector2 *", @@ -2199,6 +2234,13 @@ ["godot_pool_vector2_array_read_access *", "p_read"] ] }, + { + "name": "godot_pool_vector3_array_read_access_copy", + "return_type": "godot_pool_vector3_array_read_access *", + "arguments": [ + ["const godot_pool_vector3_array_read_access *", "p_read"] + ] + }, { "name": "godot_pool_vector3_array_read_access_ptr", "return_type": "const godot_vector3 *", @@ -2221,6 +2263,13 @@ ["godot_pool_vector3_array_read_access *", "p_read"] ] }, + { + "name": "godot_pool_color_array_read_access_copy", + "return_type": "godot_pool_color_array_read_access *", + "arguments": [ + ["const godot_pool_color_array_read_access *", "p_read"] + ] + }, { "name": "godot_pool_color_array_read_access_ptr", "return_type": "const godot_color *", @@ -2243,6 +2292,13 @@ ["godot_pool_color_array_read_access *", "p_read"] ] }, + { + "name": "godot_pool_byte_array_write_access_copy", + "return_type": "godot_pool_byte_array_write_access *", + "arguments": [ + ["const godot_pool_byte_array_write_access *", "p_write"] + ] + }, { "name": "godot_pool_byte_array_write_access_ptr", "return_type": "uint8_t *", @@ -2265,6 +2321,13 @@ ["godot_pool_byte_array_write_access *", "p_write"] ] }, + { + "name": "godot_pool_int_array_write_access_copy", + "return_type": "godot_pool_int_array_write_access *", + "arguments": [ + ["const godot_pool_int_array_write_access *", "p_write"] + ] + }, { "name": "godot_pool_int_array_write_access_ptr", "return_type": "godot_int *", @@ -2287,6 +2350,13 @@ ["godot_pool_int_array_write_access *", "p_write"] ] }, + { + "name": "godot_pool_real_array_write_access_copy", + "return_type": "godot_pool_real_array_write_access *", + "arguments": [ + ["const godot_pool_real_array_write_access *", "p_write"] + ] + }, { "name": "godot_pool_real_array_write_access_ptr", "return_type": "godot_real *", @@ -2309,6 +2379,13 @@ ["godot_pool_real_array_write_access *", "p_write"] ] }, + { + "name": "godot_pool_string_array_write_access_copy", + "return_type": "godot_pool_string_array_write_access *", + "arguments": [ + ["const godot_pool_string_array_write_access *", "p_write"] + ] + }, { "name": "godot_pool_string_array_write_access_ptr", "return_type": "godot_string *", @@ -2331,6 +2408,13 @@ ["godot_pool_string_array_write_access *", "p_write"] ] }, + { + "name": "godot_pool_vector2_array_write_access_copy", + "return_type": "godot_pool_vector2_array_write_access *", + "arguments": [ + ["const godot_pool_vector2_array_write_access *", "p_write"] + ] + }, { "name": "godot_pool_vector2_array_write_access_ptr", "return_type": "godot_vector2 *", @@ -2353,6 +2437,13 @@ ["godot_pool_vector2_array_write_access *", "p_write"] ] }, + { + "name": "godot_pool_vector3_array_write_access_copy", + "return_type": "godot_pool_vector3_array_write_access *", + "arguments": [ + ["const godot_pool_vector3_array_write_access *", "p_write"] + ] + }, { "name": "godot_pool_vector3_array_write_access_ptr", "return_type": "godot_vector3 *", @@ -2375,6 +2466,13 @@ ["godot_pool_vector3_array_write_access *", "p_write"] ] }, + { + "name": "godot_pool_color_array_write_access_copy", + "return_type": "godot_pool_color_array_write_access *", + "arguments": [ + ["const godot_pool_color_array_write_access *", "p_write"] + ] + }, { "name": "godot_pool_color_array_write_access_ptr", "return_type": "godot_color *", diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index 69a93725a8e..1210039e344 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -383,30 +383,37 @@ void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); // read accessor functions // +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read_access_copy(const godot_pool_byte_array_read_access *p_other); const uint8_t GDAPI *godot_pool_byte_array_read_access_ptr(const godot_pool_byte_array_read_access *p_read); void GDAPI godot_pool_byte_array_read_access_operator_assign(godot_pool_byte_array_read_access *p_read, godot_pool_byte_array_read_access *p_other); void GDAPI godot_pool_byte_array_read_access_destroy(godot_pool_byte_array_read_access *p_read); +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read_access_copy(const godot_pool_int_array_read_access *p_other); const godot_int GDAPI *godot_pool_int_array_read_access_ptr(const godot_pool_int_array_read_access *p_read); void GDAPI godot_pool_int_array_read_access_operator_assign(godot_pool_int_array_read_access *p_read, godot_pool_int_array_read_access *p_other); void GDAPI godot_pool_int_array_read_access_destroy(godot_pool_int_array_read_access *p_read); +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read_access_copy(const godot_pool_real_array_read_access *p_other); const godot_real GDAPI *godot_pool_real_array_read_access_ptr(const godot_pool_real_array_read_access *p_read); void GDAPI godot_pool_real_array_read_access_operator_assign(godot_pool_real_array_read_access *p_read, godot_pool_real_array_read_access *p_other); void GDAPI godot_pool_real_array_read_access_destroy(godot_pool_real_array_read_access *p_read); +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read_access_copy(const godot_pool_string_array_read_access *p_other); const godot_string GDAPI *godot_pool_string_array_read_access_ptr(const godot_pool_string_array_read_access *p_read); void GDAPI godot_pool_string_array_read_access_operator_assign(godot_pool_string_array_read_access *p_read, godot_pool_string_array_read_access *p_other); void GDAPI godot_pool_string_array_read_access_destroy(godot_pool_string_array_read_access *p_read); +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read_access_copy(const godot_pool_vector2_array_read_access *p_other); const godot_vector2 GDAPI *godot_pool_vector2_array_read_access_ptr(const godot_pool_vector2_array_read_access *p_read); void GDAPI godot_pool_vector2_array_read_access_operator_assign(godot_pool_vector2_array_read_access *p_read, godot_pool_vector2_array_read_access *p_other); void GDAPI godot_pool_vector2_array_read_access_destroy(godot_pool_vector2_array_read_access *p_read); +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read_access_copy(const godot_pool_vector3_array_read_access *p_other); const godot_vector3 GDAPI *godot_pool_vector3_array_read_access_ptr(const godot_pool_vector3_array_read_access *p_read); void GDAPI godot_pool_vector3_array_read_access_operator_assign(godot_pool_vector3_array_read_access *p_read, godot_pool_vector3_array_read_access *p_other); void GDAPI godot_pool_vector3_array_read_access_destroy(godot_pool_vector3_array_read_access *p_read); +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read_access_copy(const godot_pool_color_array_read_access *p_other); const godot_color GDAPI *godot_pool_color_array_read_access_ptr(const godot_pool_color_array_read_access *p_read); void GDAPI godot_pool_color_array_read_access_operator_assign(godot_pool_color_array_read_access *p_read, godot_pool_color_array_read_access *p_other); void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_read_access *p_read); @@ -415,30 +422,37 @@ void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_rea // write accessor functions // +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write_access_copy(const godot_pool_byte_array_write_access *p_other); uint8_t GDAPI *godot_pool_byte_array_write_access_ptr(const godot_pool_byte_array_write_access *p_write); void GDAPI godot_pool_byte_array_write_access_operator_assign(godot_pool_byte_array_write_access *p_write, godot_pool_byte_array_write_access *p_other); void GDAPI godot_pool_byte_array_write_access_destroy(godot_pool_byte_array_write_access *p_write); +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write_access_copy(const godot_pool_int_array_write_access *p_other); godot_int GDAPI *godot_pool_int_array_write_access_ptr(const godot_pool_int_array_write_access *p_write); void GDAPI godot_pool_int_array_write_access_operator_assign(godot_pool_int_array_write_access *p_write, godot_pool_int_array_write_access *p_other); void GDAPI godot_pool_int_array_write_access_destroy(godot_pool_int_array_write_access *p_write); +godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write_access_copy(const godot_pool_real_array_write_access *p_other); godot_real GDAPI *godot_pool_real_array_write_access_ptr(const godot_pool_real_array_write_access *p_write); void GDAPI godot_pool_real_array_write_access_operator_assign(godot_pool_real_array_write_access *p_write, godot_pool_real_array_write_access *p_other); void GDAPI godot_pool_real_array_write_access_destroy(godot_pool_real_array_write_access *p_write); +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write_access_copy(const godot_pool_string_array_write_access *p_other); godot_string GDAPI *godot_pool_string_array_write_access_ptr(const godot_pool_string_array_write_access *p_write); void GDAPI godot_pool_string_array_write_access_operator_assign(godot_pool_string_array_write_access *p_write, godot_pool_string_array_write_access *p_other); void GDAPI godot_pool_string_array_write_access_destroy(godot_pool_string_array_write_access *p_write); +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write_access_copy(const godot_pool_vector2_array_write_access *p_other); godot_vector2 GDAPI *godot_pool_vector2_array_write_access_ptr(const godot_pool_vector2_array_write_access *p_write); void GDAPI godot_pool_vector2_array_write_access_operator_assign(godot_pool_vector2_array_write_access *p_write, godot_pool_vector2_array_write_access *p_other); void GDAPI godot_pool_vector2_array_write_access_destroy(godot_pool_vector2_array_write_access *p_write); +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write_access_copy(const godot_pool_vector3_array_write_access *p_other); godot_vector3 GDAPI *godot_pool_vector3_array_write_access_ptr(const godot_pool_vector3_array_write_access *p_write); void GDAPI godot_pool_vector3_array_write_access_operator_assign(godot_pool_vector3_array_write_access *p_write, godot_pool_vector3_array_write_access *p_other); void GDAPI godot_pool_vector3_array_write_access_destroy(godot_pool_vector3_array_write_access *p_write); +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write_access_copy(const godot_pool_color_array_write_access *p_other); godot_color GDAPI *godot_pool_color_array_write_access_ptr(const godot_pool_color_array_write_access *p_write); void GDAPI godot_pool_color_array_write_access_operator_assign(godot_pool_color_array_write_access *p_write, godot_pool_color_array_write_access *p_other); void GDAPI godot_pool_color_array_write_access_destroy(godot_pool_color_array_write_access *p_write);