[GDNative] Expose `String::join()` to GDNative Core API v1.3
This commit is contained in:
parent
dc1a3554e0
commit
910c67b268
|
@ -1005,7 +1005,7 @@ Vector<int> String::split_ints_mk(const Vector<String> &p_splitters, bool p_allo
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
String String::join(Vector<String> parts) {
|
String String::join(const Vector<String> &parts) const {
|
||||||
String ret;
|
String ret;
|
||||||
for (int i = 0; i < parts.size(); ++i) {
|
for (int i = 0; i < parts.size(); ++i) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
|
|
@ -274,7 +274,7 @@ public:
|
||||||
Vector<int> split_ints(const String &p_splitter, bool p_allow_empty = true) const;
|
Vector<int> split_ints(const String &p_splitter, bool p_allow_empty = true) const;
|
||||||
Vector<int> split_ints_mk(const Vector<String> &p_splitters, bool p_allow_empty = true) const;
|
Vector<int> split_ints_mk(const Vector<String> &p_splitters, bool p_allow_empty = true) const;
|
||||||
|
|
||||||
String join(Vector<String> parts);
|
String join(const Vector<String> &parts) const;
|
||||||
|
|
||||||
static CharType char_uppercase(CharType p_char);
|
static CharType char_uppercase(CharType p_char);
|
||||||
static CharType char_lowercase(CharType p_char);
|
static CharType char_lowercase(CharType p_char);
|
||||||
|
|
|
@ -846,6 +846,23 @@ godot_array GDAPI godot_string_split_spaces(const godot_string *p_self) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
godot_string GDAPI godot_string_join(const godot_string *p_self, const godot_array *p_parts) {
|
||||||
|
const String *self = (const String *)p_self;
|
||||||
|
|
||||||
|
const Array *parts_proxy = (const Array *)p_parts;
|
||||||
|
Vector<String> parts;
|
||||||
|
parts.resize(parts_proxy->size());
|
||||||
|
for (int i = 0; i < parts_proxy->size(); i++) {
|
||||||
|
parts.write[i] = (*parts_proxy)[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
godot_string str;
|
||||||
|
String *s = (String *)&str;
|
||||||
|
memnew_placement(s, String);
|
||||||
|
*s = self->join(parts);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter) {
|
godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter) {
|
||||||
const String *self = (const String *)p_self;
|
const String *self = (const String *)p_self;
|
||||||
String *splitter = (String *)&p_splitter;
|
String *splitter = (String *)&p_splitter;
|
||||||
|
|
|
@ -137,6 +137,14 @@
|
||||||
"arguments": [
|
"arguments": [
|
||||||
["godot_pool_color_array *", "p_self"]
|
["godot_pool_color_array *", "p_self"]
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "godot_string_join",
|
||||||
|
"return_type": "godot_string",
|
||||||
|
"arguments": [
|
||||||
|
["const godot_string *", "p_self"],
|
||||||
|
["const godot_array *", "p_parts"]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -179,6 +179,8 @@ godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const g
|
||||||
godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters);
|
godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters);
|
||||||
godot_array GDAPI godot_string_split_spaces(const godot_string *p_self);
|
godot_array GDAPI godot_string_split_spaces(const godot_string *p_self);
|
||||||
|
|
||||||
|
godot_string GDAPI godot_string_join(const godot_string *p_self, const godot_array *p_parts);
|
||||||
|
|
||||||
wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char);
|
wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char);
|
||||||
wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char);
|
wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char);
|
||||||
godot_string GDAPI godot_string_to_lower(const godot_string *p_self);
|
godot_string GDAPI godot_string_to_lower(const godot_string *p_self);
|
||||||
|
|
Loading…
Reference in New Issue