summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-07-07 08:26:55 -0500
committerDavid Snopek <dsnopek@gmail.com>2023-07-31 15:14:10 -0500
commit8bc1c1dbeb0342ae593c46c97e7032bbc664194c (patch)
treeb8e2d273b4bdd17429adf91b88a6c16ac227f639 /src
parentc5d8447861fad7e5c812008420c3ec0ca7531590 (diff)
downloadredot-cpp-8bc1c1dbeb0342ae593c46c97e7032bbc664194c.tar.gz
Implement `String::resize()`
Diffstat (limited to 'src')
-rw-r--r--src/godot.cpp2
-rw-r--r--src/variant/char_string.cpp4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/godot.cpp b/src/godot.cpp
index c85667f..4a92fad 100644
--- a/src/godot.cpp
+++ b/src/godot.cpp
@@ -128,6 +128,7 @@ GDExtensionInterfaceStringOperatorPlusEqChar gdextension_interface_string_operat
GDExtensionInterfaceStringOperatorPlusEqCstr gdextension_interface_string_operator_plus_eq_cstr = nullptr;
GDExtensionInterfaceStringOperatorPlusEqWcstr gdextension_interface_string_operator_plus_eq_wcstr = nullptr;
GDExtensionInterfaceStringOperatorPlusEqC32str gdextension_interface_string_operator_plus_eq_c32str = nullptr;
+GDExtensionInterfaceStringResize gdextension_interface_string_resize = nullptr;
GDExtensionInterfaceXmlParserOpenBuffer gdextension_interface_xml_parser_open_buffer = nullptr;
GDExtensionInterfaceFileAccessStoreBuffer gdextension_interface_file_access_store_buffer = nullptr;
GDExtensionInterfaceFileAccessGetBuffer gdextension_interface_file_access_get_buffer = nullptr;
@@ -311,6 +312,7 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
LOAD_PROC_ADDRESS(string_operator_plus_eq_cstr, GDExtensionInterfaceStringOperatorPlusEqCstr);
LOAD_PROC_ADDRESS(string_operator_plus_eq_wcstr, GDExtensionInterfaceStringOperatorPlusEqWcstr);
LOAD_PROC_ADDRESS(string_operator_plus_eq_c32str, GDExtensionInterfaceStringOperatorPlusEqC32str);
+ LOAD_PROC_ADDRESS(string_resize, GDExtensionInterfaceStringResize);
LOAD_PROC_ADDRESS(xml_parser_open_buffer, GDExtensionInterfaceXmlParserOpenBuffer);
LOAD_PROC_ADDRESS(file_access_store_buffer, GDExtensionInterfaceFileAccessStoreBuffer);
LOAD_PROC_ADDRESS(file_access_get_buffer, GDExtensionInterfaceFileAccessGetBuffer);
diff --git a/src/variant/char_string.cpp b/src/variant/char_string.cpp
index 856037c..fc8845e 100644
--- a/src/variant/char_string.cpp
+++ b/src/variant/char_string.cpp
@@ -289,6 +289,10 @@ CharWideString String::wide_string() const {
return str;
}
+Error String::resize(int p_size) {
+ return (Error)internal::gdextension_interface_string_resize(_native_ptr(), p_size);
+}
+
String &String::operator=(const char *p_str) {
*this = String(p_str);
return *this;