summaryrefslogtreecommitdiff
path: root/source/fud_string.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-01-04 12:02:45 -0600
committerDominick Allen <djallen@librehumanitas.org>2025-01-04 12:02:45 -0600
commit1d357adfa19725ee69fb267a363f1fd217b1272f (patch)
tree8d8710ba8ba7dff0b3da6b073fbb94f1a7b03ec5 /source/fud_string.cpp
parent0b400af9519444deef4cc6ad2c43c30e2092ab4f (diff)
Various style fixes.HEADmaster
Diffstat (limited to 'source/fud_string.cpp')
-rw-r--r--source/fud_string.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/fud_string.cpp b/source/fud_string.cpp
index 37a2a4b..a2a62f4 100644
--- a/source/fud_string.cpp
+++ b/source/fud_string.cpp
@@ -21,6 +21,19 @@
namespace fud {
+StringResult String::withAllocator(Allocator& allocator)
+{
+ if (!String::allocatorValid(&allocator))
+ {
+ return Error{FudStatus::ArgumentInvalid};
+ }
+
+ String output{};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+ output.m_allocator = reinterpret_cast<uintptr_t>(&allocator);
+ return Okay{std::move(output)};
+}
+
StringResult String::makeFromCString(const char8_t* cString)
{
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)