Extended String interface

pull/7/head
Karroffel 2017-03-03 04:35:40 +01:00
parent 1d61c9df93
commit 3b6da9ca76
1 changed files with 34 additions and 0 deletions

View File

@ -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);