From af5c6be0741ea3216c70741e99a7303bc285224e Mon Sep 17 00:00:00 2001 From: Karroffel Date: Fri, 3 Nov 2017 18:17:58 +0100 Subject: [PATCH] [GDNative] added Read and Write accessors to pool arrays --- modules/gdnative/gdnative/pool_arrays.cpp | 262 ++++++++++- modules/gdnative/gdnative_api.json | 406 ++++++++++++++++++ .../gdnative/include/gdnative/pool_arrays.h | 124 ++++++ 3 files changed, 791 insertions(+), 1 deletion(-) diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index 1393374da20..731e9309082 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -106,6 +106,16 @@ void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const god self->resize(p_size); } +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_byte_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write(godot_pool_byte_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_byte_array_write_access *)memnew(PoolVector::Write(self->write())); +} + void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { PoolVector *self = (PoolVector *)p_self; self->set(p_idx, p_data); @@ -185,6 +195,16 @@ void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot self->resize(p_size); } +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_int_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write(godot_pool_int_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_int_array_write_access *)memnew(PoolVector::Write(self->write())); +} + void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) { PoolVector *self = (PoolVector *)p_self; self->set(p_idx, p_data); @@ -260,10 +280,20 @@ void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const god } void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size) { - PoolVector *self = (PoolVector *)p_self; + PoolVector *self = (PoolVector *)p_self; self->resize(p_size); } +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_real_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_int_array_write_access GDAPI *godot_pool_real_array_write(godot_pool_real_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_real_array_write_access *)memnew(PoolVector::Write(self->write())); +} + void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) { PoolVector *self = (PoolVector *)p_self; self->set(p_idx, p_data); @@ -346,6 +376,16 @@ void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const self->resize(p_size); } +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_string_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write(godot_pool_string_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_string_array_write_access *)memnew(PoolVector::Write(self->write())); +} + void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { PoolVector *self = (PoolVector *)p_self; String &s = *(String *)p_data; @@ -433,6 +473,16 @@ void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, con self->resize(p_size); } +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_vector2_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write(godot_pool_vector2_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_vector2_array_write_access *)memnew(PoolVector::Write(self->write())); +} + void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { PoolVector *self = (PoolVector *)p_self; Vector2 &s = *(Vector2 *)p_data; @@ -519,6 +569,16 @@ void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, con self->resize(p_size); } +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_vector3_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write(godot_pool_vector3_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_vector3_array_write_access *)memnew(PoolVector::Write(self->write())); +} + void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { PoolVector *self = (PoolVector *)p_self; Vector3 &s = *(Vector3 *)p_data; @@ -605,6 +665,16 @@ void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const g self->resize(p_size); } +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self) { + const PoolVector *self = (const PoolVector *)p_self; + return (godot_pool_color_array_read_access *)memnew(PoolVector::Read(self->read())); +} + +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write(godot_pool_color_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + return (godot_pool_color_array_write_access *)memnew(PoolVector::Write(self->write())); +} + void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { PoolVector *self = (PoolVector *)p_self; Color &s = *(Color *)p_data; @@ -628,6 +698,196 @@ void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } +// +// read accessor functions +// + +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(); +} +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) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_byte_array_read_access_destroy(godot_pool_byte_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +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(); +} +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) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_int_array_read_access_destroy(godot_pool_int_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +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(); +} +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) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_real_array_read_access_destroy(godot_pool_real_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +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(); +} +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) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_string_array_read_access_destroy(godot_pool_string_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +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(); +} +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) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_vector2_array_read_access_destroy(godot_pool_vector2_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +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(); +} +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) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_vector3_array_read_access_destroy(godot_pool_vector3_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +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(); +} +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) { + PoolVector::Read *read = (PoolVector::Read *)p_read; + PoolVector::Read *other = (PoolVector::Read *)p_other; + read->operator=(*other); +} +void GDAPI godot_pool_color_array_read_access_destroy(godot_pool_color_array_read_access *p_read) { + memdelete((PoolVector::Read *)p_read); +} + +// +// write accessor functions +// + +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(); +} +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) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_byte_array_write_access_destroy(godot_pool_byte_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +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(); +} +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) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_int_array_write_access_destroy(godot_pool_int_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +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(); +} +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) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_real_array_write_access_destroy(godot_pool_real_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +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(); +} +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) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_string_array_write_access_destroy(godot_pool_string_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +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(); +} +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) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_vector2_array_write_access_destroy(godot_pool_vector2_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +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(); +} +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) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_vector3_array_write_access_destroy(godot_pool_vector3_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + +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(); +} +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) { + PoolVector::Write *write = (PoolVector::Write *)p_write; + PoolVector::Write *other = (PoolVector::Write *)p_other; + write->operator=(*other); +} +void GDAPI godot_pool_color_array_write_access_destroy(godot_pool_color_array_write_access *p_write) { + memdelete((PoolVector::Write *)p_write); +} + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 31b021b7510..eba165594bb 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -1295,6 +1295,20 @@ ["const godot_int", "p_size"] ] }, + { + "name": "godot_pool_byte_array_read", + "return_type": "godot_pool_byte_array_read_access *", + "arguments": [ + ["const godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_byte_array_write", + "return_type": "godot_pool_byte_array_write_access *", + "arguments": [ + ["godot_pool_byte_array *", "p_self"] + ] + }, { "name": "godot_pool_byte_array_set", "return_type": "void", @@ -1405,6 +1419,20 @@ ["const godot_int", "p_size"] ] }, + { + "name": "godot_pool_int_array_read", + "return_type": "godot_pool_int_array_read_access *", + "arguments": [ + ["const godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_write", + "return_type": "godot_pool_int_array_write_access *", + "arguments": [ + ["godot_pool_int_array *", "p_self"] + ] + }, { "name": "godot_pool_int_array_set", "return_type": "void", @@ -1515,6 +1543,20 @@ ["const godot_int", "p_size"] ] }, + { + "name": "godot_pool_real_array_read", + "return_type": "godot_pool_real_array_read_access *", + "arguments": [ + ["const godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_write", + "return_type": "godot_pool_real_array_write_access *", + "arguments": [ + ["godot_pool_real_array *", "p_self"] + ] + }, { "name": "godot_pool_real_array_set", "return_type": "void", @@ -1625,6 +1667,20 @@ ["const godot_int", "p_size"] ] }, + { + "name": "godot_pool_string_array_read", + "return_type": "godot_pool_string_array_read_access *", + "arguments": [ + ["const godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_write", + "return_type": "godot_pool_string_array_write_access *", + "arguments": [ + ["godot_pool_string_array *", "p_self"] + ] + }, { "name": "godot_pool_string_array_set", "return_type": "void", @@ -1735,6 +1791,20 @@ ["const godot_int", "p_size"] ] }, + { + "name": "godot_pool_vector2_array_read", + "return_type": "godot_pool_vector2_array_read_access *", + "arguments": [ + ["const godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_write", + "return_type": "godot_pool_vector2_array_write_access *", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"] + ] + }, { "name": "godot_pool_vector2_array_set", "return_type": "void", @@ -1845,6 +1915,20 @@ ["const godot_int", "p_size"] ] }, + { + "name": "godot_pool_vector3_array_read", + "return_type": "godot_pool_vector3_array_read_access *", + "arguments": [ + ["const godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_write", + "return_type": "godot_pool_vector3_array_write_access *", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"] + ] + }, { "name": "godot_pool_vector3_array_set", "return_type": "void", @@ -1955,6 +2039,20 @@ ["const godot_int", "p_size"] ] }, + { + "name": "godot_pool_color_array_read", + "return_type": "godot_pool_color_array_read_access *", + "arguments": [ + ["const godot_pool_color_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_write", + "return_type": "godot_pool_color_array_write_access *", + "arguments": [ + ["godot_pool_color_array *", "p_self"] + ] + }, { "name": "godot_pool_color_array_set", "return_type": "void", @@ -1986,6 +2084,314 @@ ["godot_pool_color_array *", "p_self"] ] }, + { + "name": "godot_pool_byte_array_read_access_ptr", + "return_type": "const uint8_t *", + "arguments": [ + ["const godot_pool_byte_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_byte_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_read_access *", "p_read"], + ["godot_pool_byte_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_byte_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_int_array_read_access_ptr", + "return_type": "const godot_int *", + "arguments": [ + ["const godot_pool_int_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_int_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_read_access *", "p_read"], + ["godot_pool_int_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_int_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_real_array_read_access_ptr", + "return_type": "const godot_real *", + "arguments": [ + ["const godot_pool_real_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_real_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_read_access *", "p_read"], + ["godot_pool_real_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_real_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_string_array_read_access_ptr", + "return_type": "const godot_string *", + "arguments": [ + ["const godot_pool_string_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_string_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_read_access *", "p_read"], + ["godot_pool_string_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_string_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector2_array_read_access_ptr", + "return_type": "const godot_vector2 *", + "arguments": [ + ["const godot_pool_vector2_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector2_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_read_access *", "p_read"], + ["godot_pool_vector2_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector2_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector3_array_read_access_ptr", + "return_type": "const godot_vector3 *", + "arguments": [ + ["const godot_pool_vector3_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_vector3_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_read_access *", "p_read"], + ["godot_pool_vector3_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector3_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_color_array_read_access_ptr", + "return_type": "const godot_color *", + "arguments": [ + ["const godot_pool_color_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_color_array_read_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_read_access *", "p_read"], + ["godot_pool_color_array_read_access *", "p_other"] + ] + }, + { + "name": "godot_pool_color_array_read_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_read_access *", "p_read"] + ] + }, + { + "name": "godot_pool_byte_array_write_access_ptr", + "return_type": "uint8_t *", + "arguments": [ + ["const godot_pool_byte_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_byte_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_write_access *", "p_write"], + ["godot_pool_byte_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_byte_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_int_array_write_access_ptr", + "return_type": "godot_int *", + "arguments": [ + ["const godot_pool_int_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_int_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_write_access *", "p_write"], + ["godot_pool_int_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_int_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_real_array_write_access_ptr", + "return_type": "godot_real *", + "arguments": [ + ["const godot_pool_real_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_real_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_write_access *", "p_write"], + ["godot_pool_real_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_real_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_string_array_write_access_ptr", + "return_type": "godot_string *", + "arguments": [ + ["const godot_pool_string_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_string_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_write_access *", "p_write"], + ["godot_pool_string_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_string_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector2_array_write_access_ptr", + "return_type": "godot_vector2 *", + "arguments": [ + ["const godot_pool_vector2_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector2_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_write_access *", "p_write"], + ["godot_pool_vector2_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector2_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector3_array_write_access_ptr", + "return_type": "godot_vector3 *", + "arguments": [ + ["const godot_pool_vector3_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_vector3_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_write_access *", "p_write"], + ["godot_pool_vector3_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_vector3_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_color_array_write_access_ptr", + "return_type": "godot_color *", + "arguments": [ + ["const godot_pool_color_array_write_access *", "p_write"] + ] + }, + { + "name": "godot_pool_color_array_write_access_operator_assign", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_write_access *", "p_write"], + ["godot_pool_color_array_write_access *", "p_other"] + ] + }, + { + "name": "godot_pool_color_array_write_access_destroy", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array_write_access *", "p_write"] + ] + }, { "name": "godot_array_new", "return_type": "void", diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index 93181f2a6b4..81500c9186f 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -36,6 +36,38 @@ extern "C" { #include +/////// Read Access + +#define GODOT_POOL_ARRAY_READ_ACCESS_SIZE 1 + +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_ARRAY_READ_ACCESS_SIZE]; +} godot_pool_array_read_access; + +typedef godot_pool_array_read_access godot_pool_byte_array_read_access; +typedef godot_pool_array_read_access godot_pool_int_array_read_access; +typedef godot_pool_array_read_access godot_pool_real_array_read_access; +typedef godot_pool_array_read_access godot_pool_string_array_read_access; +typedef godot_pool_array_read_access godot_pool_vector2_array_read_access; +typedef godot_pool_array_read_access godot_pool_vector3_array_read_access; +typedef godot_pool_array_read_access godot_pool_color_array_read_access; + +/////// Write Access + +#define GODOT_POOL_ARRAY_WRITE_ACCESS_SIZE 1 + +typedef struct { + uint8_t _dont_touch_that[GODOT_POOL_ARRAY_WRITE_ACCESS_SIZE]; +} godot_pool_array_write_access; + +typedef godot_pool_array_write_access godot_pool_byte_array_write_access; +typedef godot_pool_array_write_access godot_pool_int_array_write_access; +typedef godot_pool_array_write_access godot_pool_real_array_write_access; +typedef godot_pool_array_write_access godot_pool_string_array_write_access; +typedef godot_pool_array_write_access godot_pool_vector2_array_write_access; +typedef godot_pool_array_write_access godot_pool_vector3_array_write_access; +typedef godot_pool_array_write_access godot_pool_color_array_write_access; + /////// PoolByteArray #define GODOT_POOL_BYTE_ARRAY_SIZE sizeof(void *) @@ -149,6 +181,10 @@ void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const god void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size); +godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self); + +godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write(godot_pool_byte_array *p_self); + void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx); @@ -176,6 +212,10 @@ void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size); +godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self); + +godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write(godot_pool_int_array *p_self); + void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx); @@ -203,6 +243,10 @@ void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const god void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size); +godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self); + +godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write(godot_pool_real_array *p_self); + void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx); @@ -230,6 +274,10 @@ void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size); +godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self); + +godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write(godot_pool_string_array *p_self); + void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx); @@ -257,6 +305,10 @@ void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, con void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size); +godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self); + +godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write(godot_pool_vector2_array *p_self); + void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx); @@ -284,6 +336,10 @@ void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, con void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size); +godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self); + +godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write(godot_pool_vector3_array *p_self); + void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx); @@ -311,6 +367,10 @@ void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const g void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size); +godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self); + +godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write(godot_pool_color_array *p_self); + void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx); @@ -318,6 +378,70 @@ godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); +// +// read accessor functions +// + +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); + +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); + +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); + +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); + +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); + +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); + +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); + +// +// write accessor functions +// + +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_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_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_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_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_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_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); + #ifdef __cplusplus } #endif