4#include "../Strings/StringView.h"
97 [[nodiscard]]
static bool popNullTermIfNotEmpty(
Buffer& stringData, StringEncoding encoding);
103 [[nodiscard]]
static bool pushNullTerm(
Buffer& stringData, StringEncoding encoding);
108 static void ensureZeroTermination(
Buffer& data, StringEncoding encoding);
110 void internalClear();
119 [[nodiscard]]
bool setTextLengthInBytesIncludingTerminator(
size_t newDataSize);
122 static void eventuallyNullTerminate(
Buffer& buffer, StringEncoding destinationEncoding,
StringSpan* encodedText,
125 StringEncoding encoding;
131 [[nodiscard]]
static bool convertUTF16LE_to_UTF8(
const StringSpan sourceUtf16,
Buffer& destination,
132 int& writtenCodeUnits);
133 [[nodiscard]]
static bool convertUTF8_to_UTF16LE(
const StringSpan sourceUtf8,
Buffer& destination,
134 int& writtenCodeUnits);
#define SC_COMPILER_EXPORT
Macro for symbol visibility in non-MSVC compilers.
Definition Compiler.h:78
An heap allocated byte buffer that can optionally use an inline buffer.
Definition Buffer.h:29
Iterates files and directories inside a given path without allocating any memory.
Definition FileSystemIterator.h:34
String with compile time configurable inline storage (small string optimization)
Definition StringFormat.h:12
Builds String out of a sequence of StringView or formatting through StringFormat.
Definition StringBuilder.h:16
Converts String to a different encoding (UTF8, UTF16).
Definition StringConverter.h:24
static bool convertEncodingToUTF16(StringSpan text, Buffer &buffer, StringSpan *encodedText=nullptr, NullTermination nullTerminate=AddZeroTerminator)
Converts text to (eventually null terminated) UTF16 encoding.
StringConverter(Buffer &text, StringEncoding encoding)
Create a StringBuilder that will push to given Vector, with specific encoding.
bool convertNullTerminateFastPath(StringSpan input, StringSpan &encodedText)
Converts a given input StringSpan to null-terminated version.
NullTermination
Specifies if to add a null terminator.
Definition StringConverter.h:27
@ DoNotAddZeroTerminator
A null terminator will NOT be added at the end of the String.
Definition StringConverter.h:29
@ AddZeroTerminator
A null terminator will be added at the end of the String.
Definition StringConverter.h:28
Flags
Clearing flags used when initializing destination buffer.
Definition StringConverter.h:63
@ Clear
Destination buffer will be cleared before pushing to it.
Definition StringConverter.h:64
@ DoNotClear
Destination buffer will not be cleared before pushing to it.
Definition StringConverter.h:65
static bool convertEncodingToUTF8(StringSpan text, Buffer &buffer, StringSpan *encodedText=nullptr, NullTermination nullTerminate=AddZeroTerminator)
Converts text to (eventually null terminated) UTF8 encoding.
static bool convertEncodingTo(StringEncoding encoding, StringSpan text, Buffer &buffer, StringSpan *encodedText=nullptr, NullTermination nullTerminate=AddZeroTerminator)
Converts text to (eventually null terminated) requested encoding.
bool appendNullTerminated(StringSpan input, bool popExistingNullTerminator=true)
Appends the given StringSpan and adds null-terminator.
StringConverter(String &text, Flags flags=DoNotClear)
Create a StringBuilder that will push to given String.
An read-only view over a string (to avoid including Strings library when parsing is not needed).
Definition StringSpan.h:31
A non-modifiable owning string with associated encoding.
Definition String.h:29