4#include "../Foundation/StringSpan.h"
13struct StringNativeFixed
18 [[nodiscard]] StringSpan view()
const {
return StringSpan({buffer, length},
true, StringEncoding::Native); }
20 [[nodiscard]] Span<native_char_t> writableSpan() {
return {buffer, N}; }
22 [[nodiscard]]
bool assign(StringSpan str)
28 [[nodiscard]]
bool append(StringSpan str)
30 StringSpan::NativeWritable
string = {{buffer, N}, length};
31 if (not str.appendNullTerminatedTo(
string))
33 length =
string.length;
43#if SC_PLATFORM_WINDOWS
44 static constexpr size_t MaxPath = 260;
45#elif SC_PLATFORM_APPLE
46 static constexpr size_t MaxPath = 1024;
48 static constexpr size_t MaxPath = 4096;
50 [[nodiscard]]
StringSpan view()
const {
return path.view(); }
52 [[nodiscard]]
bool append(
StringSpan str) {
return path.append(str); }
53 [[nodiscard]]
bool assign(StringSpan str) {
return path.assign(str); }
54 [[nodiscard]]
bool resize(
size_t newSize)
56 if (newSize < MaxPath)
58 path.length = newSize;
60 return newSize < MaxPath;
63 [[nodiscard]] Span<native_char_t> writableSpan() {
return path.writableSpan(); }
66 detail::StringNativeFixed<MaxPath> path;
char native_char_t
The native char for the platform (wchar_t (4 bytes) on Windows, char (1 byte) everywhere else )
Definition PrimitiveTypes.h:34
Pre-sized char array holding enough space to represent a file system path.
Definition StringPath.h:41
An read-only view over a string (to avoid including Strings library when parsing is not needed).
Definition StringSpan.h:37