[ox/std] Add String::operator=(const String&)
This commit is contained in:
parent
1313b562bd
commit
e0a2676d54
16
deps/ox/src/ox/std/string.cpp
vendored
16
deps/ox/src/ox/std/string.cpp
vendored
@ -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
deps/ox/src/ox/std/string.hpp
vendored
2
deps/ox/src/ox/std/string.hpp
vendored
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user