4#include "../Foundation/Internal/IGrowableBuffer.h"
5#include "../Foundation/StringSpan.h"
14struct StringNativeFixed
19 [[nodiscard]]
auto view()
const {
return StringSpan({buffer, length},
true, StringEncoding::Native); }
20 [[nodiscard]]
bool isEmpty()
const {
return length == 0; }
21 [[nodiscard]]
auto writableSpan() {
return Span<native_char_t>{buffer, N}; }
22 [[nodiscard]]
bool operator==(StringSpan other)
const {
return view() == other; }
23 [[nodiscard]]
bool assign(StringSpan str)
29 [[nodiscard]]
bool append(StringSpan str)
31 StringSpan::NativeWritable
string = {{buffer, N}, length};
32 if (not str.appendNullTerminatedTo(
string))
34 length =
string.length;
44#if SC_PLATFORM_WINDOWS
45 static constexpr size_t MaxPath = 260;
46#elif SC_PLATFORM_APPLE
47 static constexpr size_t MaxPath = 1024;
49 static constexpr size_t MaxPath = 4096;
51 [[nodiscard]]
StringSpan view()
const {
return path.view(); }
52 [[nodiscard]] StringEncoding getEncoding()
const {
return StringEncoding::Native; }
54 [[nodiscard]]
bool isEmpty()
const {
return path.view().
isEmpty(); }
55 [[nodiscard]]
bool append(StringSpan str) {
return path.append(str); }
56 [[nodiscard]]
bool assign(StringSpan str) {
return path.assign(str); }
57 [[nodiscard]]
bool resize(
size_t newSize);
59 [[nodiscard]] Span<native_char_t> writableSpan() {
return path.writableSpan(); }
62 detail::StringNativeFixed<MaxPath> path;
66struct SC_COMPILER_EXPORT GrowableBuffer<
StringPath> final :
public IGrowableBuffer
70 virtual ~GrowableBuffer()
override;
71 virtual bool tryGrowTo(
size_t newSize)
override;
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:42
An read-only view over a string (to avoid including Strings library when parsing is not needed).
Definition StringSpan.h:37
constexpr bool isEmpty() const
Return true if StringView is empty.
Definition StringSpan.h:85