summaryrefslogtreecommitdiffstats
path: root/src/core/String.cpp
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2017-11-25 00:26:36 +0100
committerGitHub <noreply@github.com>2017-11-25 00:26:36 +0100
commitee4729cc07b904f92501d55d985ee2d325ba6e89 (patch)
treebd388b6570402fdde2732dd92217ee53981209cf /src/core/String.cpp
parente72f4beec1b091edf6f16a0fe27d5ed13ca450c2 (diff)
parentd8faa4ec76bc73ca17b8e5dd72220d16996423c3 (diff)
downloadredot-cpp-ee4729cc07b904f92501d55d985ee2d325ba6e89.tar.gz
Merge pull request #52 from BastiaanOlij/change_to_new_extensions
Update bindings to use new Api extensions and rename Rect3->AABB
Diffstat (limited to 'src/core/String.cpp')
-rw-r--r--src/core/String.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/core/String.cpp b/src/core/String.cpp
index 0a1d455..494d976 100644
--- a/src/core/String.cpp
+++ b/src/core/String.cpp
@@ -103,14 +103,38 @@ String::operator NodePath() const {
return NodePath(*this);
}
-const char *String::c_string() const {
- return godot::api->godot_string_c_str(&_godot_string);
+const wchar_t *String::unicode_str() const {
+ return godot::api->godot_string_unicode_str(&_godot_string);
+}
+
+char *String::alloc_c_string() const {
+ int len;
+
+ // figure out the lenght of our string
+ get_c_string(NULL, &len);
+
+ // allocate our buffer
+ char * result = (char *)godot::api->godot_alloc(len + 1);
+ if (result != NULL) {
+ get_c_string(result, &len);
+ result[len] = '\0';
+ }
+
+ return result;
+}
+
+void String::get_c_string(char *p_dest, int *p_size) const {
+ godot::api->godot_string_get_data(&_godot_string, p_dest, p_size);
}
String operator+(const char *a, const String &b) {
return String(a) + b;
}
+String operator+(const wchar_t *a, const String &b) {
+ return String(a) + b;
+}
+
bool String::begins_with(String &p_string) const {
return godot::api->godot_string_begins_with(&_godot_string, &p_string._godot_string);
}