4#include "../Strings/StringConverter.h"
5#include "../Strings/StringFormat.h"
48 template <
typename... Types>
49 [[nodiscard]]
bool format(
StringView fmt, Types&&... args);
67 template <
typename... Types>
68 [[nodiscard]]
bool append(
StringView fmt, Types&&... args);
134template <
typename... Types>
138 return append(fmt, forward<Types>(args)...);
141template <
typename... Types>
148 const bool hadNullTerminator = StringConverter::popNullTermIfNotEmpty(stringData, encoding);
158 if (hadNullTerminator)
161 (void)StringConverter::pushNullTerm(stringData, encoding);
#define SC_COMPILER_EXPORT
Macro for symbol visibility in non-MSVC compilers.
Definition: Compiler.h:78
StringEncoding
String Encoding (Ascii, Utf8, Utf16)
Definition: StringIterator.h:17
@ Utf16
Encoding is UTF16-LE.
View over a contiguous sequence of items (pointer + size in elements).
Definition: Span.h:21
Holds a search / replace pair for StringBuilder::appendReplaceMultiple.
Definition: StringBuilder.h:92
StringView replaceWith
StringView to be searched for in source string.
Definition: StringBuilder.h:94
Builds String out of a sequence of StringView or formatting through StringFormat.
Definition: StringBuilder.h:16
bool format(StringView fmt, Types &&... args)
Uses StringFormat to format the given StringView against args, replacing destination contents.
Definition: StringBuilder.h:135
Flags
Clearing flags used when initializing destination buffer.
Definition: StringBuilder.h:19
@ Clear
Destination buffer will be cleared before pushing to it.
Definition: StringBuilder.h:20
bool append(StringView str)
Appends StringView to destination buffer.
AppendHexCase
Option for StringBuilder::appendHex.
Definition: StringBuilder.h:108
bool appendHex(Span< const uint8_t > data, AppendHexCase casing)
Appends given binary data escaping it as hexadecimal ASCII characters.
bool appendReplaceAll(StringView source, StringView occurrencesOf, StringView with)
Appends source to destination buffer, replacing occurrencesOf StringView with StringView with
bool appendReplaceMultiple(StringView source, Span< const ReplacePair > substitutions)
Appends source to destination buffer, replacing multiple substitutions pairs.
bool format(StringView text)
Assigns StringView to destination buffer.
StringBuilder(String &str, Flags flags=DoNotClear)
Create a StringBuilder that will push to given String, with specific encoding.
StringBuilder(Vector< char > &stringData, StringEncoding encoding, Flags flags=DoNotClear)
Create a StringBuilder that will push to given Vector, with specific encoding.
bool append(StringView fmt, Types &&... args)
Uses StringFormat to format the given StringView against args, appending to destination contents.
Definition: StringBuilder.h:142
A non-modifiable owning string with associated encoding.
Definition: String.h:30
Non-owning view over a range of characters with UTF Encoding.
Definition: StringView.h:47
constexpr StringEncoding getEncoding() const
Get encoding of this StringView.
Definition: StringView.h:93
A contiguous sequence of heap allocated elements.
Definition: Vector.h:51