summaryrefslogtreecommitdiff
path: root/include/fud_string.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-27 09:04:05 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-27 09:04:05 -0500
commitb8345246dcc2121bcb6d1515a9341789de20199f (patch)
tree4a25857512a90ff38e8a40166c54694b74920216 /include/fud_string.hpp
parentf84b8259f6e980fed647d8e1ec0634f89ee59c06 (diff)
First crack at file objects.
Diffstat (limited to 'include/fud_string.hpp')
-rw-r--r--include/fud_string.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/fud_string.hpp b/include/fud_string.hpp
index 0213524..df03ad9 100644
--- a/include/fud_string.hpp
+++ b/include/fud_string.hpp
@@ -90,7 +90,6 @@ class String {
}
String output{};
- auto* data = output.m_buffer.data();
output.m_length = totalLength;
output.m_allocator = allocator;
if (output.m_length >= output.m_capacity) {
@@ -103,10 +102,11 @@ class String {
output.m_data = static_cast<utf8*>(dataResult.getOkay());
}
+ auto* data = output.data();
size_t cumulativeLength = 0;
for (size_t idx = 0; idx < strPointers.size(); ++idx) {
const auto* cString = strPointers[idx];
- auto copyStatus = copyMem(data, output.m_capacity - cumulativeLength, cString, lengths[idx]);
+ auto copyStatus = copyMem(data + cumulativeLength, output.m_capacity - cumulativeLength, cString, lengths[idx]);
fudAssert(copyStatus == FudStatus::Success);
cumulativeLength += lengths[idx];
}
@@ -131,6 +131,8 @@ class String {
static StringResult from(const String& rhs);
+ static StringResult from(StringView view, Allocator* allocator = &globalFudAllocator);
+
FudStatus copy(const String& rhs);
[[nodiscard]] constexpr size_t length() const