[ox/claw] Add Claw
This commit is contained in:
12
deps/ox/src/ox/std/string.cpp
vendored
12
deps/ox/src/ox/std/string.cpp
vendored
@@ -13,7 +13,7 @@ namespace ox {
|
||||
|
||||
String::String() noexcept {
|
||||
if (m_buff.size()) {
|
||||
m_buff[0] = 0;;
|
||||
m_buff[0] = 0;
|
||||
} else {
|
||||
m_buff.push_back(0);
|
||||
}
|
||||
@@ -21,18 +21,24 @@ String::String() noexcept {
|
||||
|
||||
String::String(std::size_t cap) noexcept {
|
||||
m_buff.resize(cap + 1);
|
||||
m_buff[0] = 0;;
|
||||
m_buff[0] = 0;
|
||||
}
|
||||
|
||||
String::String(const char *str) noexcept {
|
||||
if (m_buff.size()) {
|
||||
m_buff[0] = 0;;
|
||||
m_buff[0] = 0;
|
||||
} else {
|
||||
m_buff.push_back(0);
|
||||
}
|
||||
*this = str;
|
||||
}
|
||||
|
||||
String::String(const char *str, std::size_t size) noexcept {
|
||||
m_buff.resize(size + 1);
|
||||
memcpy(m_buff.data(), str, size);
|
||||
m_buff[size] = 0;
|
||||
}
|
||||
|
||||
String::String(String &other) noexcept {
|
||||
m_buff = other.m_buff;
|
||||
}
|
||||
|
2
deps/ox/src/ox/std/string.hpp
vendored
2
deps/ox/src/ox/std/string.hpp
vendored
@@ -27,6 +27,8 @@ class String {
|
||||
|
||||
String(const char *str) noexcept;
|
||||
|
||||
String(const char *str, std::size_t size) noexcept;
|
||||
|
||||
String(String&) noexcept;
|
||||
|
||||
String(String&&) noexcept;
|
||||
|
Reference in New Issue
Block a user