[ox/std] Add String::operator=(const String&)

(synced from e0a2676d54)
This commit is contained in:
2020-03-15 14:31:43 -05:00
parent c10724912b
commit cad156add5
2 changed files with 12 additions and 6 deletions
+10 -6
View File
@@ -24,12 +24,6 @@ String::String(const char *str) noexcept {
*this = str;
}
const String &String::operator=(int64_t i) noexcept {
char str[65] = {};
ox_itoa(i, str);
return this->operator=(str);
}
const String &String::operator=(const char *str) noexcept {
std::size_t strLen = ox_strlen(str) + 1;
m_buff.resize(strLen + 1);
@@ -43,6 +37,16 @@ const String &String::operator=(char *str) noexcept {
return *this = static_cast<const char*>(str);
}
const String &String::operator=(int64_t i) noexcept {
char str[65] = {};
ox_itoa(i, str);
return this->operator=(str);
}
const String &String::operator=(const String &src) noexcept {
return *this = src.c_str();
}
const String &String::operator+=(const char *str) noexcept {
std::size_t strLen = ox_strlen(str);
auto currentLen = len();
+2
View File
@@ -33,6 +33,8 @@ class String {
const String &operator=(int64_t i) noexcept;
const String &operator=(const String &src) noexcept;
const String &operator+=(const char *str) noexcept;
const String &operator+=(char *str) noexcept;