From 3b6da9ca761945b444107cb77d3f0418db20b4b0 Mon Sep 17 00:00:00 2001 From: Karroffel Date: Fri, 3 Mar 2017 04:35:40 +0100 Subject: [PATCH] Extended String interface --- include/godot/core/String.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/godot/core/String.h b/include/godot/core/String.h index 081788e0..c644deca 100644 --- a/include/godot/core/String.h +++ b/include/godot/core/String.h @@ -23,6 +23,19 @@ public: godot_string_new_data(&_godot_string, contents, strlen(contents)); } + String(const wchar_t *contents) + { + // @Todo + // godot_string_new_data(&_godot_string, contents, strlen(contents)); + godot_string_new(&_godot_string); + } + + String(const wchar_t c) + { + // @Todo + godot_string_new(&_godot_string); + } + String(const String& other) { godot_string_new(&_godot_string); @@ -35,12 +48,22 @@ public: } + String substr(int p_from,int p_chars) const + { + return String(); // @Todo + } + wchar_t &operator [](const int idx) { return *godot_string_operator_index(&_godot_string, idx); } + wchar_t operator [](const int idx) const + { + return *godot_string_operator_index((godot_string *) &_godot_string, idx); + } + int length() const { int len = 0; @@ -66,6 +89,17 @@ public: return new_string; } + void operator +=(const String &s) + { + // @Todo + godot_string_operator_plus(&_godot_string, &_godot_string, &s._godot_string); + } + + void operator +=(const wchar_t c) + { + // @Todo + } + bool operator <(const String &s) { return godot_string_operator_less(&_godot_string, &s._godot_string);