[GDNative] updates to string API and const fixes
This commit is contained in:
parent
c791c1d48e
commit
9ece961abe
|
@ -40,6 +40,24 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs) {
|
||||
const CharString *cs = (const CharString *)p_cs;
|
||||
|
||||
return cs->length();
|
||||
}
|
||||
|
||||
const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs) {
|
||||
const CharString *cs = (const CharString *)p_cs;
|
||||
|
||||
return cs->get_data();
|
||||
}
|
||||
|
||||
void GDAPI godot_char_string_destroy(godot_char_string *p_cs) {
|
||||
CharString *cs = (CharString *)p_cs;
|
||||
|
||||
cs->~CharString();
|
||||
}
|
||||
|
||||
void GDAPI godot_string_new(godot_string *r_dest) {
|
||||
String *dest = (String *)r_dest;
|
||||
memnew_placement(dest, String);
|
||||
|
@ -51,35 +69,11 @@ void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src
|
|||
memnew_placement(dest, String(*src));
|
||||
}
|
||||
|
||||
void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size) {
|
||||
String *dest = (String *)r_dest;
|
||||
memnew_placement(dest, String(String::utf8(p_contents, p_size)));
|
||||
}
|
||||
|
||||
void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size) {
|
||||
void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t *p_contents, const int p_size) {
|
||||
String *dest = (String *)r_dest;
|
||||
memnew_placement(dest, String(p_contents, p_size));
|
||||
}
|
||||
|
||||
void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size) {
|
||||
String *self = (String *)p_self;
|
||||
|
||||
if (p_size) {
|
||||
// we have a length pointer, that means we either want to know
|
||||
// the length or want to write *p_size bytes into a buffer
|
||||
|
||||
CharString utf8_string = self->utf8();
|
||||
|
||||
int len = utf8_string.length();
|
||||
|
||||
if (p_dest) {
|
||||
memcpy(p_dest, utf8_string.get_data(), *p_size);
|
||||
} else {
|
||||
*p_size = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) {
|
||||
String *self = (String *)p_self;
|
||||
return &(self->operator[](p_idx));
|
||||
|
@ -90,7 +84,7 @@ wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, cons
|
|||
return self->operator[](p_idx);
|
||||
}
|
||||
|
||||
const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self) {
|
||||
const wchar_t GDAPI *godot_string_wide_str(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
return self->c_str();
|
||||
}
|
||||
|
@ -130,6 +124,26 @@ godot_int GDAPI godot_string_length(const godot_string *p_self) {
|
|||
|
||||
/* Helpers */
|
||||
|
||||
signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str) {
|
||||
const String *self = (const String *)p_self;
|
||||
const String *str = (const String *)p_str;
|
||||
|
||||
return self->casecmp_to(*str);
|
||||
}
|
||||
|
||||
signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str) {
|
||||
const String *self = (const String *)p_self;
|
||||
const String *str = (const String *)p_str;
|
||||
|
||||
return self->nocasecmp_to(*str);
|
||||
}
|
||||
signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str) {
|
||||
const String *self = (const String *)p_self;
|
||||
const String *str = (const String *)p_str;
|
||||
|
||||
return self->naturalnocasecmp_to(*str);
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string) {
|
||||
const String *self = (const String *)p_self;
|
||||
const String *string = (const String *)p_string;
|
||||
|
@ -534,7 +548,7 @@ godot_string GDAPI godot_string_capitalize(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->capitalize()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -542,7 +556,7 @@ godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_se
|
|||
memnew_placement(&result, String(self->camelcase_to_underscore(false)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -550,45 +564,45 @@ godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_s
|
|||
memnew_placement(&result, String(self->camelcase_to_underscore()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
double GDAPI godot_string_char_to_double(const char *p_what) {
|
||||
return String::to_double(p_what);
|
||||
};
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_string_char_to_int(const char *p_what) {
|
||||
return String::to_int(p_what);
|
||||
};
|
||||
}
|
||||
|
||||
int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str) {
|
||||
return String::to_int(p_str);
|
||||
};
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len) {
|
||||
return String::to_int(p_what, p_len);
|
||||
};
|
||||
}
|
||||
|
||||
int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_len) {
|
||||
return String::to_int(p_str, p_len);
|
||||
};
|
||||
}
|
||||
|
||||
int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->hex_to_int64(false);
|
||||
};
|
||||
}
|
||||
|
||||
int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->hex_to_int64();
|
||||
};
|
||||
}
|
||||
|
||||
int64_t GDAPI godot_string_to_int64(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->to_int64();
|
||||
};
|
||||
}
|
||||
|
||||
double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end) {
|
||||
return String::to_double(p_str, r_end);
|
||||
|
@ -601,7 +615,7 @@ godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_stri
|
|||
memnew_placement(&result, String(self->get_slice(*splitter, p_slice)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -609,7 +623,7 @@ godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p
|
|||
memnew_placement(&result, String(self->get_slicec(p_splitter, p_slice)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -625,7 +639,7 @@ godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_str
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -641,7 +655,7 @@ godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, con
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -657,7 +671,7 @@ godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const go
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_self, const godot_string *p_splitter) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -673,7 +687,7 @@ godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_s
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_array *p_splitters) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -696,7 +710,7 @@ godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -719,7 +733,7 @@ godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -735,7 +749,7 @@ godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godo
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_self, const godot_string *p_splitter) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -751,7 +765,7 @@ godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_sel
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_array *p_splitters) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -774,7 +788,7 @@ godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const g
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -797,7 +811,7 @@ godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_string_split_spaces(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -812,22 +826,22 @@ godot_array GDAPI godot_string_split_spaces(const godot_string *p_self) {
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter) {
|
||||
const String *self = (const String *)p_self;
|
||||
String *splitter = (String *)&p_splitter;
|
||||
|
||||
return self->get_slice_count(*splitter);
|
||||
};
|
||||
}
|
||||
|
||||
wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char) {
|
||||
return String::char_lowercase(p_char);
|
||||
};
|
||||
}
|
||||
|
||||
wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char) {
|
||||
return String::char_uppercase(p_char);
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_to_lower(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -835,7 +849,7 @@ godot_string GDAPI godot_string_to_lower(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->to_lower()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_to_upper(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -843,7 +857,7 @@ godot_string GDAPI godot_string_to_upper(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->to_upper()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_get_basename(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -851,7 +865,7 @@ godot_string GDAPI godot_string_get_basename(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->get_basename()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_get_extension(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -859,7 +873,7 @@ godot_string GDAPI godot_string_get_extension(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->get_extension()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -867,13 +881,13 @@ godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos
|
|||
memnew_placement(&result, String(self->left(p_pos)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
wchar_t GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->ord_at(p_idx);
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -882,7 +896,7 @@ godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godo
|
|||
memnew_placement(&result, String(self->plus_file(*file)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -890,7 +904,7 @@ godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_po
|
|||
memnew_placement(&result, String(self->right(p_pos)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -898,7 +912,7 @@ godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bo
|
|||
memnew_placement(&result, String(self->strip_edges(p_left, p_right)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -906,94 +920,96 @@ godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->strip_escapes()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars) {
|
||||
String *self = (String *)p_self;
|
||||
|
||||
return self->erase(p_pos, p_chars);
|
||||
};
|
||||
|
||||
void GDAPI godot_string_ascii(godot_string *p_self, char *result) {
|
||||
String *self = (String *)p_self;
|
||||
Vector<char> return_value = self->ascii();
|
||||
|
||||
for (int i = 0; i < return_value.size(); i++) {
|
||||
result[i] = return_value[i];
|
||||
}
|
||||
}
|
||||
|
||||
void GDAPI godot_string_ascii_extended(godot_string *p_self, char *result) {
|
||||
String *self = (String *)p_self;
|
||||
Vector<char> return_value = self->ascii(true);
|
||||
godot_char_string GDAPI godot_string_ascii(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
godot_char_string result;
|
||||
|
||||
for (int i = 0; i < return_value.size(); i++) {
|
||||
result[i] = return_value[i];
|
||||
}
|
||||
memnew_placement(&result, String(self->ascii()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void GDAPI godot_string_utf8(godot_string *p_self, char *result) {
|
||||
String *self = (String *)p_self;
|
||||
Vector<char> return_value = self->utf8();
|
||||
godot_char_string GDAPI godot_string_ascii_extended(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
for (int i = 0; i < return_value.size(); i++) {
|
||||
result[i] = return_value[i];
|
||||
}
|
||||
godot_char_string result;
|
||||
|
||||
memnew_placement(&result, String(self->ascii(true)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
godot_char_string GDAPI godot_string_utf8(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
godot_char_string result;
|
||||
|
||||
memnew_placement(&result, String(self->utf8()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8) {
|
||||
String *self = (String *)p_self;
|
||||
|
||||
return self->parse_utf8(p_utf8);
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len) {
|
||||
String *self = (String *)p_self;
|
||||
|
||||
return self->parse_utf8(p_utf8, p_len);
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8) {
|
||||
godot_string result;
|
||||
memnew_placement(&result, String(String::utf8(p_utf8)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len) {
|
||||
godot_string result;
|
||||
memnew_placement(&result, String(String::utf8(p_utf8, p_len)));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
uint32_t GDAPI godot_string_hash(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->hash();
|
||||
};
|
||||
}
|
||||
|
||||
uint64_t GDAPI godot_string_hash64(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->hash64();
|
||||
};
|
||||
}
|
||||
|
||||
uint32_t GDAPI godot_string_hash_chars(const char *p_cstr) {
|
||||
return String::hash(p_cstr);
|
||||
};
|
||||
}
|
||||
|
||||
uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len) {
|
||||
return String::hash(p_cstr, p_len);
|
||||
};
|
||||
}
|
||||
|
||||
uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str) {
|
||||
return String::hash(p_str);
|
||||
};
|
||||
}
|
||||
|
||||
uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len) {
|
||||
return String::hash(p_str, p_len);
|
||||
};
|
||||
}
|
||||
|
||||
godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1010,7 +1026,7 @@ godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self)
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_md5_text(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1018,7 +1034,7 @@ godot_string GDAPI godot_string_md5_text(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->md5_text()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1035,7 +1051,7 @@ godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_sel
|
|||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_sha256_text(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1043,13 +1059,13 @@ godot_string GDAPI godot_string_sha256_text(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(self->sha256_text()));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool godot_string_empty(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->empty();
|
||||
};
|
||||
}
|
||||
|
||||
// path functions
|
||||
godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self) {
|
||||
|
@ -1059,7 +1075,7 @@ godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_get_file(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1068,7 +1084,7 @@ godot_string GDAPI godot_string_get_file(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_humanize_size(size_t p_size) {
|
||||
godot_string result;
|
||||
|
@ -1076,25 +1092,25 @@ godot_string GDAPI godot_string_humanize_size(size_t p_size) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_abs_path();
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_rel_path();
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_resource_file();
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1104,7 +1120,7 @@ godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1114,7 +1130,7 @@ godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const g
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_simplify_path(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1123,7 +1139,7 @@ godot_string GDAPI godot_string_simplify_path(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_c_escape(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1132,7 +1148,7 @@ godot_string GDAPI godot_string_c_escape(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1141,7 +1157,7 @@ godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_c_unescape(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1150,7 +1166,7 @@ godot_string GDAPI godot_string_c_unescape(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_http_escape(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1159,7 +1175,7 @@ godot_string GDAPI godot_string_http_escape(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_http_unescape(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1168,7 +1184,7 @@ godot_string GDAPI godot_string_http_unescape(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_json_escape(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1177,7 +1193,7 @@ godot_string GDAPI godot_string_json_escape(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int p_chars_per_line) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1186,7 +1202,7 @@ godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_xml_escape(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1195,7 +1211,7 @@ godot_string GDAPI godot_string_xml_escape(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1204,7 +1220,7 @@ godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_sel
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1213,7 +1229,7 @@ godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_percent_decode(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1222,7 +1238,7 @@ godot_string GDAPI godot_string_percent_decode(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_string GDAPI godot_string_percent_encode(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
@ -1231,43 +1247,43 @@ godot_string GDAPI godot_string_percent_encode(const godot_string *p_self) {
|
|||
memnew_placement(&result, String(return_value));
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_valid_float();
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_valid_hex_number(p_with_prefix);
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_valid_html_color();
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_valid_identifier();
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_valid_integer();
|
||||
};
|
||||
}
|
||||
|
||||
godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self) {
|
||||
const String *self = (const String *)p_self;
|
||||
|
||||
return self->is_valid_ip_address();
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self) {
|
|||
return dest;
|
||||
}
|
||||
|
||||
void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v) {
|
||||
void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v) {
|
||||
Transform *self = (Transform *)p_self;
|
||||
const Basis *v = (const Basis *)p_v;
|
||||
self->basis = *v;
|
||||
|
@ -76,7 +76,7 @@ godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self) {
|
|||
return dest;
|
||||
}
|
||||
|
||||
void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v) {
|
||||
void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v) {
|
||||
Transform *self = (Transform *)p_self;
|
||||
const Vector3 *v = (const Vector3 *)p_v;
|
||||
self->origin = *v;
|
||||
|
|
|
@ -3516,7 +3516,7 @@
|
|||
"return_type": "void",
|
||||
"arguments": [
|
||||
["godot_transform *", "p_self"],
|
||||
["godot_basis *", "p_v"]
|
||||
["const godot_basis *", "p_v"]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -3531,7 +3531,7 @@
|
|||
"return_type": "void",
|
||||
"arguments": [
|
||||
["godot_transform *", "p_self"],
|
||||
["godot_vector3 *", "p_v"]
|
||||
["const godot_vector3 *", "p_v"]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -4323,6 +4323,27 @@
|
|||
["godot_variant *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_char_string_length",
|
||||
"return_type": "godot_int",
|
||||
"arguments": [
|
||||
["const godot_char_string *", "p_cs"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_char_string_get_data",
|
||||
"return_type": "const char *",
|
||||
"arguments": [
|
||||
["const godot_char_string *", "p_cs"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_char_string_destroy",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["godot_char_string *", "p_cs"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_new",
|
||||
"return_type": "void",
|
||||
|
@ -4339,16 +4360,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_new_data",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["godot_string *", "r_dest"],
|
||||
["const char *", "p_contents"],
|
||||
["const int", "p_size"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_new_unicode_data",
|
||||
"name": "godot_string_new_with_wide_string",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["godot_string *", "r_dest"],
|
||||
|
@ -4356,15 +4368,6 @@
|
|||
["const int", "p_size"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_get_data",
|
||||
"return_type": "void",
|
||||
"arguments": [
|
||||
["const godot_string *", "p_self"],
|
||||
["char *", "p_dest"],
|
||||
["int *", "p_size"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_operator_index",
|
||||
"return_type": "wchar_t *",
|
||||
|
@ -4382,7 +4385,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_unicode_str",
|
||||
"name": "godot_string_wide_str",
|
||||
"return_type": "const wchar_t *",
|
||||
"arguments": [
|
||||
["const godot_string *", "p_self"]
|
||||
|
@ -4419,6 +4422,30 @@
|
|||
["const godot_string *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_casecmp_to",
|
||||
"return_type": "signed char",
|
||||
"arguments": [
|
||||
["const godot_string *", "p_self"],
|
||||
["const godot_string *", "p_str"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_nocasecmp_to",
|
||||
"return_type": "signed char",
|
||||
"arguments": [
|
||||
["const godot_string *", "p_self"],
|
||||
["const godot_string *", "p_str"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_naturalnocasecmp_to",
|
||||
"return_type": "signed char",
|
||||
"arguments": [
|
||||
["const godot_string *", "p_self"],
|
||||
["const godot_string *", "p_str"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_begins_with",
|
||||
"return_type": "godot_bool",
|
||||
|
@ -5125,26 +5152,23 @@
|
|||
},
|
||||
{
|
||||
"name": "godot_string_ascii",
|
||||
"return_type": "void",
|
||||
"return_type": "godot_char_string",
|
||||
"arguments": [
|
||||
["godot_string *", "p_self"],
|
||||
["char *", "result"]
|
||||
["const godot_string *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_ascii_extended",
|
||||
"return_type": "void",
|
||||
"return_type": "godot_char_string",
|
||||
"arguments": [
|
||||
["godot_string *", "p_self"],
|
||||
["char *", "result"]
|
||||
["const godot_string *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_string_utf8",
|
||||
"return_type": "void",
|
||||
"return_type": "godot_char_string",
|
||||
"arguments": [
|
||||
["godot_string *", "p_self"],
|
||||
["char *", "result"]
|
||||
["const godot_string *", "p_self"]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -38,13 +38,24 @@ extern "C" {
|
|||
#include <stdint.h>
|
||||
#include <wchar.h>
|
||||
|
||||
typedef wchar_t godot_char_type;
|
||||
|
||||
#define GODOT_STRING_SIZE sizeof(void *)
|
||||
#define GODOT_CHAR_STRING_SIZE sizeof(void *)
|
||||
|
||||
#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
|
||||
#define GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
|
||||
typedef struct {
|
||||
uint8_t _dont_touch_that[GODOT_STRING_SIZE];
|
||||
} godot_string;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED
|
||||
#define GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED
|
||||
typedef struct {
|
||||
uint8_t _dont_touch_that[GODOT_CHAR_STRING_SIZE];
|
||||
} godot_char_string;
|
||||
#endif
|
||||
|
||||
// reduce extern "C" nesting for VS2013
|
||||
|
@ -60,16 +71,17 @@ typedef struct {
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs);
|
||||
const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs);
|
||||
void GDAPI godot_char_string_destroy(godot_char_string *p_cs);
|
||||
|
||||
void GDAPI godot_string_new(godot_string *r_dest);
|
||||
void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src);
|
||||
void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size);
|
||||
void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size);
|
||||
|
||||
void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size);
|
||||
void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t *p_contents, const int p_size);
|
||||
|
||||
wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx);
|
||||
wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx);
|
||||
const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self);
|
||||
const wchar_t GDAPI *godot_string_wide_str(const godot_string *p_self);
|
||||
|
||||
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b);
|
||||
godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b);
|
||||
|
@ -81,6 +93,10 @@ godot_int GDAPI godot_string_length(const godot_string *p_self);
|
|||
|
||||
/* Helpers */
|
||||
|
||||
signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str);
|
||||
signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str);
|
||||
signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str);
|
||||
|
||||
godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string);
|
||||
godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array);
|
||||
godot_array GDAPI godot_string_bigrams(const godot_string *p_self);
|
||||
|
@ -177,9 +193,9 @@ godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self);
|
|||
|
||||
void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars);
|
||||
|
||||
void GDAPI godot_string_ascii(godot_string *p_self, char *result);
|
||||
void GDAPI godot_string_ascii_extended(godot_string *p_self, char *result);
|
||||
void GDAPI godot_string_utf8(godot_string *p_self, char *result);
|
||||
godot_char_string GDAPI godot_string_ascii(const godot_string *p_self);
|
||||
godot_char_string GDAPI godot_string_ascii_extended(const godot_string *p_self);
|
||||
godot_char_string GDAPI godot_string_utf8(const godot_string *p_self);
|
||||
godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8);
|
||||
godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len);
|
||||
godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8);
|
||||
|
|
|
@ -64,10 +64,10 @@ void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const g
|
|||
void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin);
|
||||
|
||||
godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self);
|
||||
void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v);
|
||||
void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v);
|
||||
|
||||
godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self);
|
||||
void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v);
|
||||
void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v);
|
||||
|
||||
godot_string GDAPI godot_transform_as_string(const godot_transform *p_self);
|
||||
|
||||
|
|
Loading…
Reference in New Issue