Browse Source

Extended String interface

Karroffel 8 years ago
parent
commit
3b6da9ca76
1 changed files with 34 additions and 0 deletions
  1. 34 0
      include/godot/core/String.h

+ 34 - 0
include/godot/core/String.h

@@ -23,6 +23,19 @@ public:
 		godot_string_new_data(&_godot_string, contents, strlen(contents));
 		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)
 	String(const String& other)
 	{
 	{
 		godot_string_new(&_godot_string);
 		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)
 	wchar_t &operator [](const int idx)
 	{
 	{
 		return *godot_string_operator_index(&_godot_string, 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 length() const
 	{
 	{
 		int len = 0;
 		int len = 0;
@@ -66,6 +89,17 @@ public:
 		return new_string;
 		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)
 	bool operator <(const String &s)
 	{
 	{
 		return godot_string_operator_less(&_godot_string, &s._godot_string);
 		return godot_string_operator_less(&_godot_string, &s._godot_string);