Skip to content

Commit

Permalink
[GDNative] Refactoring: add const to has and join methods of po…
Browse files Browse the repository at this point in the history
…oled arrays
  • Loading branch information
kdiduk committed Jul 16, 2022
1 parent 82c3e62 commit 2cd87ef
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion core/pool_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ class PoolVector {
return OK;
}

String join(String delimiter) {
String join(String delimiter) const {
String rs = "";
int s = size();
Read r = read();
Expand Down
18 changes: 9 additions & 9 deletions modules/gdnative/gdnative/pool_arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self
return self->empty();
}

godot_bool GDAPI godot_pool_byte_array_has(godot_pool_byte_array *p_self, const uint8_t p_data) {
godot_bool GDAPI godot_pool_byte_array_has(const godot_pool_byte_array *p_self, const uint8_t p_data) {
const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self;
return self->has(p_data);
}
Expand Down Expand Up @@ -251,7 +251,7 @@ godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self)
return self->empty();
}

godot_bool GDAPI godot_pool_int_array_has(godot_pool_int_array *p_self, const godot_int p_data) {
godot_bool GDAPI godot_pool_int_array_has(const godot_pool_int_array *p_self, const godot_int p_data) {
const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self;
return self->has(p_data);
}
Expand Down Expand Up @@ -355,7 +355,7 @@ godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self
return self->empty();
}

godot_bool GDAPI godot_pool_real_array_has(godot_pool_real_array *p_self, const godot_real p_data) {
godot_bool GDAPI godot_pool_real_array_has(const godot_pool_real_array *p_self, const godot_real p_data) {
const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self;
return self->has(p_data);
}
Expand Down Expand Up @@ -411,8 +411,8 @@ void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self) {
self->invert();
}

godot_string GDAPI godot_pool_string_array_join(godot_pool_string_array *p_self, const godot_string *p_delimiter) {
PoolVector<String> *self = (PoolVector<String> *)p_self;
godot_string GDAPI godot_pool_string_array_join(const godot_pool_string_array *p_self, const godot_string *p_delimiter) {
const PoolVector<String> *self = (PoolVector<String> *)p_self;
String &delimiter = *(String *)p_delimiter;

godot_string str;
Expand Down Expand Up @@ -478,7 +478,7 @@ godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_
return self->empty();
}

godot_bool GDAPI godot_pool_string_array_has(godot_pool_string_array *p_self, const godot_string *p_data) {
godot_bool GDAPI godot_pool_string_array_has(const godot_pool_string_array *p_self, const godot_string *p_data) {
const PoolVector<String> *self = (const PoolVector<String> *)p_self;
String &s = *(String *)p_data;
return self->has(s);
Expand Down Expand Up @@ -590,7 +590,7 @@ godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *
return self->empty();
}

godot_bool GDAPI godot_pool_vector2_array_has(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) {
godot_bool GDAPI godot_pool_vector2_array_has(const godot_pool_vector2_array *p_self, const godot_vector2 *p_data) {
const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self;
Vector2 &s = *(Vector2 *)p_data;
return self->has(s);
Expand Down Expand Up @@ -702,7 +702,7 @@ godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *
return self->empty();
}

godot_bool GDAPI godot_pool_vector3_array_has(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) {
godot_bool GDAPI godot_pool_vector3_array_has(const godot_pool_vector3_array *p_self, const godot_vector3 *p_data) {
const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self;
Vector3 &s = *(Vector3 *)p_data;
return self->has(s);
Expand Down Expand Up @@ -814,7 +814,7 @@ godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_se
return self->empty();
}

godot_bool GDAPI godot_pool_color_array_has(godot_pool_color_array *p_self, const godot_color *p_data) {
godot_bool GDAPI godot_pool_color_array_has(const godot_pool_color_array *p_self, const godot_color *p_data) {
const PoolVector<Color> *self = (const PoolVector<Color> *)p_self;
Color &s = *(Color *)p_data;
return self->has(s);
Expand Down
16 changes: 8 additions & 8 deletions modules/gdnative/gdnative_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "godot_pool_byte_array_has",
"return_type": "godot_bool",
"arguments": [
["godot_pool_byte_array *", "p_self"],
["const godot_pool_byte_array *", "p_self"],
["const uint8_t", "p_data"]
]
},
Expand All @@ -44,7 +44,7 @@
"name": "godot_pool_int_array_has",
"return_type": "godot_bool",
"arguments": [
["godot_pool_int_array *", "p_self"],
["const godot_pool_int_array *", "p_self"],
["const godot_int", "p_data"]
]
},
Expand All @@ -59,7 +59,7 @@
"name": "godot_pool_real_array_has",
"return_type": "godot_bool",
"arguments": [
["godot_pool_real_array *", "p_self"],
["const godot_pool_real_array *", "p_self"],
["const godot_real", "p_data"]
]
},
Expand All @@ -74,15 +74,15 @@
"name": "godot_pool_string_array_has",
"return_type": "godot_bool",
"arguments": [
["godot_pool_string_array *", "p_self"],
["const godot_pool_string_array *", "p_self"],
["const godot_string *", "p_data"]
]
},
{
"name": "godot_pool_string_array_join",
"return_type": "godot_string",
"arguments": [
["godot_pool_string_array *", "p_self"],
["const godot_pool_string_array *", "p_self"],
["const godot_string *", "p_delimiter"]
]
},
Expand All @@ -97,7 +97,7 @@
"name": "godot_pool_vector2_array_has",
"return_type": "godot_bool",
"arguments": [
["godot_pool_vector2_array *", "p_self"],
["const godot_pool_vector2_array *", "p_self"],
["const godot_vector2 *", "p_data"]
]
},
Expand All @@ -112,7 +112,7 @@
"name": "godot_pool_vector3_array_has",
"return_type": "godot_bool",
"arguments": [
["godot_pool_vector3_array *", "p_self"],
["const godot_pool_vector3_array *", "p_self"],
["const godot_vector3 *", "p_data"]
]
},
Expand All @@ -127,7 +127,7 @@
"name": "godot_pool_color_array_has",
"return_type": "godot_bool",
"arguments": [
["godot_pool_color_array *", "p_self"],
["const godot_pool_color_array *", "p_self"],
["const godot_color *", "p_data"]
]
},
Expand Down
16 changes: 8 additions & 8 deletions modules/gdnative/include/gdnative/pool_arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self);

godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self);

godot_bool GDAPI godot_pool_byte_array_has(godot_pool_byte_array *p_self, const uint8_t p_data);
godot_bool GDAPI godot_pool_byte_array_has(const godot_pool_byte_array *p_self, const uint8_t p_data);

void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self);

Expand Down Expand Up @@ -232,7 +232,7 @@ godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self);

godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self);

godot_bool GDAPI godot_pool_int_array_has(godot_pool_int_array *p_self, const godot_int p_data);
godot_bool GDAPI godot_pool_int_array_has(const godot_pool_int_array *p_self, const godot_int p_data);

void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self);

Expand Down Expand Up @@ -269,7 +269,7 @@ godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self);

godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self);

godot_bool GDAPI godot_pool_real_array_has(godot_pool_real_array *p_self, const godot_real p_data);
godot_bool GDAPI godot_pool_real_array_has(const godot_pool_real_array *p_self, const godot_real p_data);

void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self);

Expand All @@ -287,7 +287,7 @@ godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self

void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self);

godot_string GDAPI godot_pool_string_array_join(godot_pool_string_array *p_self, const godot_string *p_delimiter);
godot_string GDAPI godot_pool_string_array_join(const godot_pool_string_array *p_self, const godot_string *p_delimiter);

void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data);

Expand All @@ -308,7 +308,7 @@ godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_se

godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self);

godot_bool GDAPI godot_pool_string_array_has(godot_pool_string_array *p_self, const godot_string *p_data);
godot_bool GDAPI godot_pool_string_array_has(const godot_pool_string_array *p_self, const godot_string *p_data);

void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self);

Expand Down Expand Up @@ -345,7 +345,7 @@ godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_

godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self);

godot_bool GDAPI godot_pool_vector2_array_has(godot_pool_vector2_array *p_self, const godot_vector2 *p_data);
godot_bool GDAPI godot_pool_vector2_array_has(const godot_pool_vector2_array *p_self, const godot_vector2 *p_data);

void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self);

Expand Down Expand Up @@ -382,7 +382,7 @@ godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_

godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self);

godot_bool GDAPI godot_pool_vector3_array_has(godot_pool_vector3_array *p_self, const godot_vector3 *p_data);
godot_bool GDAPI godot_pool_vector3_array_has(const godot_pool_vector3_array *p_self, const godot_vector3 *p_data);

void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self);

Expand Down Expand Up @@ -419,7 +419,7 @@ godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self

godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self);

godot_bool GDAPI godot_pool_color_array_has(godot_pool_color_array *p_self, const godot_color *p_data);
godot_bool GDAPI godot_pool_color_array_has(const godot_pool_color_array *p_self, const godot_color *p_data);

void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self);

Expand Down

0 comments on commit 2cd87ef

Please sign in to comment.