From 1d357adfa19725ee69fb267a363f1fd217b1272f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sat, 4 Jan 2025 12:02:45 -0600 Subject: Various style fixes. --- source/fud_string.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/fud_string.cpp') 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(&allocator); + return Okay{std::move(output)}; +} + StringResult String::makeFromCString(const char8_t* cString) { // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) -- cgit v1.2.3