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

This commit is contained in:
Gary Talent 2020-03-15 14:31:43 -05:00
parent 1313b562bd
commit e0a2676d54
2 changed files with 12 additions and 6 deletions

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();

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;