|
| | TStringBuilderBase ()=default |
| |
| CORE_API | ~TStringBuilderBase () |
| |
| | TStringBuilderBase (const TStringBuilderBase &)=delete |
| |
| | TStringBuilderBase (TStringBuilderBase &&)=delete |
| |
| TStringBuilderBase & | operator= (const TStringBuilderBase &)=delete |
| |
| TStringBuilderBase & | operator= (TStringBuilderBase &&)=delete |
| |
| TStringBuilderBase & | operator= (ViewType Str) |
| |
| TStringBuilderBase & | operator= (const CharType *Str) |
| |
| | TStringBuilderBase (CharType *BufferPointer, int32 BufferCapacity) |
| |
| int32 | Len () const |
| |
| CharType * | GetData () UE_LIFETIMEBOUND |
| |
| const CharType * | GetData () const UE_LIFETIMEBOUND |
| |
| const CharType * | ToString () UE_LIFETIMEBOUND |
| |
| const CharType * | ToString () const UE_LIFETIMEBOUND |
| |
| const CharType * | operator* () UE_LIFETIMEBOUND |
| |
| const CharType * | operator* () const UE_LIFETIMEBOUND |
| |
| ViewType | ToView () const UE_LIFETIMEBOUND |
| |
| CharType | LastChar () const |
| |
| SIZE_T | GetAllocatedSize () const |
| |
| void | Reset () |
| |
| int32 | AddUninitialized (int32 InCount) |
| |
| void | Reserve (int32 InNewCapacity) |
| |
| void | RemoveSuffix (int32 InCount) |
| |
| template<typename OtherCharType , std::enable_if_t< TIsCharType< OtherCharType >::Value > * = nullptr> |
| BuilderType & | Append (const OtherCharType *const String, const int32 Length) |
| |
| template<typename CharRangeType > |
| auto | Append (CharRangeType &&Range) -> decltype(Append(MakeStringView(Forward< CharRangeType >(Range)).GetData(), int32(0))) |
| |
| template<typename AppendedCharType , std::enable_if_t< TIsCharType< AppendedCharType >::Value > * = nullptr> |
| BuilderType & | AppendChar (AppendedCharType Char) |
| |
| void | ReplaceAt (int32 Pos, int32 RemoveLen, ViewType Str) |
| |
| void | InsertAt (int32 Pos, ViewType Str) |
| |
| void | RemoveAt (int32 Pos, int32 RemoveLen) |
| |
| void | Prepend (ViewType Str) |
| |
| template<typename AppendedCharType > |
| auto | Add (AppendedCharType Char) -> decltype(AppendChar(Char),(void) 0) |
| |
template<typename RangeType , typename DelimiterType >
requires requires (BuilderType& Builder, RangeType&& Range, const DelimiterType& Delimiter) { Builder << *std::begin(Range); Builder << Delimiter; } |
| BuilderType & | Join (RangeType &&InRange, const DelimiterType &InDelimiter) |
| |
template<typename RangeType , typename DelimiterType , typename QuoteType >
requires requires (BuilderType& Builder, RangeType&& Range, const DelimiterType& Delimiter, const QuoteType& Quote) { Builder << Quote << *std::begin(Range) << Quote; Builder << Delimiter; } |
| BuilderType & | JoinQuoted (RangeType &&InRange, const DelimiterType &InDelimiter, const QuoteType &InQuote) |
| |
| template<typename FmtType , typename... Types UE_REQUIRES> |
| BuilderType & | Appendf (const FmtType &Fmt, Types... Args) |
| |
| CORE_API BuilderType & | AppendV (const CharType *Fmt, va_list Args) |
| |
template<
typename CharType>
class TStringBuilderBase< CharType >
String Builder
This class helps with the common task of constructing new strings.
It does this by allocating buffer space which is used to hold the constructed string. The intent is that the builder is allocated on the stack as a function local variable to avoid heap allocations.
The buffer is always contiguous and the class is not intended to be used to construct extremely large strings.
This is not intended to be used as a mechanism for holding on to strings for a long time. The use case is explicitly to aid in constructing strings on the stack and subsequently passing the string into a function call or a more permanent string storage mechanism like FString et al.
The amount of buffer space to allocate is specified via a template parameter and if the constructed string should overflow this initial buffer, a new buffer will be allocated using regular dynamic memory allocations.
Overflow allocation should be the exceptional case however – always try to size the buffer so that it can hold the vast majority of strings you expect to construct.
Be mindful that stack is a limited resource, so if you are writing a highly recursive function you may want to use some other mechanism to build your strings.