summaryrefslogtreecommitdiff
path: root/modules/gdnative/include
diff options
context:
space:
mode:
authorkarroffel <therzog@mail.de>2018-01-10 21:12:04 +0100
committerkarroffel <therzog@mail.de>2018-01-11 00:17:43 +0100
commit9ece961abe12cfcb5e27cdb1d23f61d50124b7b7 (patch)
tree8012ab04800f1bbd6fc87df16c37bde8038166d4 /modules/gdnative/include
parentc791c1d48ec7dc4df30f4778eb007ad05b3686bf (diff)
[GDNative] updates to string API and const fixes
Diffstat (limited to 'modules/gdnative/include')
-rw-r--r--modules/gdnative/include/gdnative/string.h32
-rw-r--r--modules/gdnative/include/gdnative/transform.h4
2 files changed, 26 insertions, 10 deletions
diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h
index 080c0aa171..73245160c1 100644
--- a/modules/gdnative/include/gdnative/string.h
+++ b/modules/gdnative/include/gdnative/string.h
@@ -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);
diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h
index 10a242b205..a646da146a 100644
--- a/modules/gdnative/include/gdnative/transform.h
+++ b/modules/gdnative/include/gdnative/transform.h
@@ -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);