Add missing String operators
parent
6c2f9196d7
commit
d04ce481c4
|
@ -570,22 +570,26 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
|||
|
||||
# Special cases.
|
||||
if class_name == "String":
|
||||
result.append("String &operator=(const char *p_str);")
|
||||
result.append("String &operator=(const wchar_t *p_str);")
|
||||
result.append("String &operator=(const char16_t *p_str);")
|
||||
result.append("String &operator=(const char32_t *p_str);")
|
||||
result.append("bool operator==(const char *p_str) const;")
|
||||
result.append("bool operator==(const wchar_t *p_str) const;")
|
||||
result.append("bool operator==(const char16_t *p_str) const;")
|
||||
result.append("bool operator==(const char32_t *p_str) const;")
|
||||
result.append("bool operator!=(const char *p_str) const;")
|
||||
result.append("bool operator!=(const wchar_t *p_str) const;")
|
||||
result.append("bool operator!=(const char16_t *p_str) const;")
|
||||
result.append("bool operator!=(const char32_t *p_str) const;")
|
||||
result.append(f"\tconst char32_t &operator[](int p_index) const;")
|
||||
result.append(f"\tchar32_t &operator[](int p_index);")
|
||||
result.append(f"\tconst char32_t *ptr() const;")
|
||||
result.append(f"\tchar32_t *ptrw();")
|
||||
result.append("\tString &operator=(const char *p_str);")
|
||||
result.append("\tString &operator=(const wchar_t *p_str);")
|
||||
result.append("\tString &operator=(const char16_t *p_str);")
|
||||
result.append("\tString &operator=(const char32_t *p_str);")
|
||||
result.append("\tbool operator==(const char *p_str) const;")
|
||||
result.append("\tbool operator==(const wchar_t *p_str) const;")
|
||||
result.append("\tbool operator==(const char16_t *p_str) const;")
|
||||
result.append("\tbool operator==(const char32_t *p_str) const;")
|
||||
result.append("\tbool operator!=(const char *p_str) const;")
|
||||
result.append("\tbool operator!=(const wchar_t *p_str) const;")
|
||||
result.append("\tbool operator!=(const char16_t *p_str) const;")
|
||||
result.append("\tbool operator!=(const char32_t *p_str) const;")
|
||||
result.append("\tString operator+(const char *p_chr);")
|
||||
result.append("\tString operator+(const wchar_t *p_chr);")
|
||||
result.append("\tString operator+(const char16_t *p_chr);")
|
||||
result.append("\tString operator+(const char32_t *p_chr);")
|
||||
result.append("\tconst char32_t &operator[](int p_index) const;")
|
||||
result.append("\tchar32_t &operator[](int p_index);")
|
||||
result.append("\tconst char32_t *ptr() const;")
|
||||
result.append("\tchar32_t *ptrw();")
|
||||
|
||||
if class_name == "Array":
|
||||
result.append("\ttemplate <class... Args>")
|
||||
|
|
|
@ -327,6 +327,22 @@ bool String::operator!=(const char32_t *p_str) const {
|
|||
return *this != String(p_str);
|
||||
}
|
||||
|
||||
String String::operator+(const char *p_chr) {
|
||||
return *this + String(p_chr);
|
||||
}
|
||||
|
||||
String String::operator+(const wchar_t *p_chr) {
|
||||
return *this + String(p_chr);
|
||||
}
|
||||
|
||||
String String::operator+(const char16_t *p_chr) {
|
||||
return *this + String(p_chr);
|
||||
}
|
||||
|
||||
String String::operator+(const char32_t *p_chr) {
|
||||
return *this + String(p_chr);
|
||||
}
|
||||
|
||||
const char32_t &String::operator[](int p_index) const {
|
||||
return *internal::gdn_interface->string_operator_index_const((GDNativeStringPtr)this, p_index);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue