Merge pull request #930 from rune-scape/rune-missing-string-ops
Add missing String operatorspull/935/head
commit
4a4e2b0239
|
@ -570,22 +570,26 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
|
||||||
|
|
||||||
# Special cases.
|
# Special cases.
|
||||||
if class_name == "String":
|
if class_name == "String":
|
||||||
result.append("String &operator=(const char *p_str);")
|
result.append("\tString &operator=(const char *p_str);")
|
||||||
result.append("String &operator=(const wchar_t *p_str);")
|
result.append("\tString &operator=(const wchar_t *p_str);")
|
||||||
result.append("String &operator=(const char16_t *p_str);")
|
result.append("\tString &operator=(const char16_t *p_str);")
|
||||||
result.append("String &operator=(const char32_t *p_str);")
|
result.append("\tString &operator=(const char32_t *p_str);")
|
||||||
result.append("bool operator==(const char *p_str) const;")
|
result.append("\tbool operator==(const char *p_str) const;")
|
||||||
result.append("bool operator==(const wchar_t *p_str) const;")
|
result.append("\tbool operator==(const wchar_t *p_str) const;")
|
||||||
result.append("bool operator==(const char16_t *p_str) const;")
|
result.append("\tbool operator==(const char16_t *p_str) const;")
|
||||||
result.append("bool operator==(const char32_t *p_str) const;")
|
result.append("\tbool operator==(const char32_t *p_str) const;")
|
||||||
result.append("bool operator!=(const char *p_str) const;")
|
result.append("\tbool operator!=(const char *p_str) const;")
|
||||||
result.append("bool operator!=(const wchar_t *p_str) const;")
|
result.append("\tbool operator!=(const wchar_t *p_str) const;")
|
||||||
result.append("bool operator!=(const char16_t *p_str) const;")
|
result.append("\tbool operator!=(const char16_t *p_str) const;")
|
||||||
result.append("bool operator!=(const char32_t *p_str) const;")
|
result.append("\tbool operator!=(const char32_t *p_str) const;")
|
||||||
result.append(f"\tconst char32_t &operator[](int p_index) const;")
|
result.append("\tString operator+(const char *p_chr);")
|
||||||
result.append(f"\tchar32_t &operator[](int p_index);")
|
result.append("\tString operator+(const wchar_t *p_chr);")
|
||||||
result.append(f"\tconst char32_t *ptr() const;")
|
result.append("\tString operator+(const char16_t *p_chr);")
|
||||||
result.append(f"\tchar32_t *ptrw();")
|
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":
|
if class_name == "Array":
|
||||||
result.append("\ttemplate <class... Args>")
|
result.append("\ttemplate <class... Args>")
|
||||||
|
|
|
@ -327,6 +327,22 @@ bool String::operator!=(const char32_t *p_str) const {
|
||||||
return *this != String(p_str);
|
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 {
|
const char32_t &String::operator[](int p_index) const {
|
||||||
return *internal::gdn_interface->string_operator_index_const((GDNativeStringPtr)this, p_index);
|
return *internal::gdn_interface->string_operator_index_const((GDNativeStringPtr)this, p_index);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue