3#include <Foundation/ThirdParty/utf8/utf8.h>
5#include <Foundation/Containers/HybridArray.h>
6#include <Foundation/Memory/MemoryUtils.h>
7#include <Foundation/Strings/FormatString.h>
8#include <Foundation/Strings/Implementation/StringBase.h>
9#include <Foundation/Strings/PathUtils.h>
10#include <Foundation/Strings/StringUtils.h>
11#include <Foundation/Strings/StringView.h>
13template <plUInt16 Size>
16template <plUInt16 Size,
typename AllocatorWrapper>
47 template <plUInt16 Size>
54 template <plUInt16 Size,
typename A>
62 template <plUInt16 Size>
64 : m_Data(std::move(rhs.m_Data))
69 template <plUInt16 Size,
typename A>
71 : m_Data(std::move(rhs.m_Data))
95 void operator=(
const char* szUTF8);
98 void operator=(
const wchar_t* pWChar);
104 template <plUInt16 Size>
111 template <plUInt16 Size,
typename A>
118 template <plUInt16 Size>
121 m_Data = std::move(rhs.m_Data);
125 template <plUInt16 Size,
typename A>
128 m_Data = std::move(rhs.m_Data);
138 const char* GetData()
const;
141 plUInt32 GetElementCount()
const;
148 plUInt32 GetCharacterCount()
const;
166 void ChangeCharacter(iterator& ref_it, plUInt32 uiCharacter);
183 void SetSubString_FromTo(
const char* pStart,
const char* pEnd);
186 void SetSubString_ElementCount(
const char* pStart, plUInt32 uiElementCount);
189 void SetSubString_CharacterCount(
const char* pStart, plUInt32 uiCharacterCount);
192 void Append(plUInt32 uiChar);
195 void Append(
const wchar_t* pData1,
const wchar_t* pData2 =
nullptr,
const wchar_t* pData3 =
nullptr,
const wchar_t* pData4 =
nullptr,
const wchar_t* pData5 =
nullptr,
const wchar_t* pData6 =
nullptr);
209 void Prepend(plUInt32 uiChar);
212 void Prepend(
const wchar_t* pData1,
const wchar_t* pData2 =
nullptr,
const wchar_t* pData3 =
nullptr,
const wchar_t* pData4 =
nullptr,
213 const wchar_t* pData5 =
nullptr,
const wchar_t* pData6 =
nullptr);
220 void SetPrintf(
const char* szUtf8Format, ...);
223 void SetPrintfArgs(
const char* szUtf8Format, va_list szArgs);
229 template <
typename... ARGS>
239 template <
typename... ARGS>
249 template <
typename... ARGS>
260 void Shrink(plUInt32 uiShrinkCharsFront, plUInt32 uiShrinkCharsBack);
263 void Reserve(plUInt32 uiNumElements);
267 void ReplaceSubString(
const char* szStartPos,
const char* szEndPos,
plStringView sReplaceWith);
270 void Insert(
const char* szInsertAtPos,
plStringView sTextToInsert);
273 void Remove(
const char* szRemoveFromPos,
const char* szRemoveToPos);
279 const char* ReplaceFirst(
plStringView sSearchFor,
plStringView sReplacement,
const char* szStartSearchAt =
nullptr);
282 const char* ReplaceFirst_NoCase(
plStringView sSearchFor,
plStringView sReplacement,
const char* szStartSearchAt =
nullptr);
290 const char* ReplaceLast_NoCase(
plStringView sSearchFor,
plStringView sReplacement,
const char* szStartSearchAt =
nullptr);
334 void MakeCleanPath();
340 void PathParentDirectory(plUInt32 uiLevelsUp = 1);
358 void ChangeFileNameAndExtension(
plStringView sNewFileNameWithExtension);
369 void ChangeFileExtension(
plStringView sNewExtension,
bool bFullExtension =
false);
375 void RemoveFileExtension(
bool bFullExtension =
false);
386 void MakePathSeparatorsNative();
391 bool IsPathBelowFolder(
const char* szPathToFolder);
399 void Trim(
const char* szTrimChars =
" \f\n\r\t\v");
402 void Trim(
const char* szTrimCharsStart,
const char* szTrimCharsEnd);
407 void TrimLeft(
const char* szTrimChars =
" \f\n\r\t\v");
412 void TrimRight(
const char* szTrimChars =
" \f\n\r\t\v");
420#if PL_ENABLED(PL_INTEROP_STL_STRINGS)
428 void operator=(
const std::string_view& rhs);
431 void operator=(
const std::string& rhs);
437 void RemoveDoubleSlashesInPath();
439 void ChangeCharacterNonASCII(iterator& it, plUInt32 uiCharacter);
440 void AppendTerminator();
443 template <plUInt16 T>
451#include <Foundation/Strings/Implementation/StringBuilder_inl.h>
Base class for all memory allocators.
Definition Allocator.h:23
static PL_ALWAYS_INLINE plAllocator * GetDefaultAllocator()
The default allocator can be used for any kind of allocation if no alignment is required.
Definition Basics.h:82
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Interface for binary in (read) streams.
Definition Stream.h:22
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
void operator=(plHybridStringBase< Size > &&rhs)
Moves the given string into this one.
Definition StringBuilder.h:119
plStringBuilder(plHybridString< Size, A > &&rhs)
Moves the given string into this one.
Definition StringBuilder.h:70
void PrependFormat(const char *szFormat, ARGS &&... args)
Prepends a formatted string. Uses '{}' formatting placeholders, see plFormatString for details.
Definition StringBuilder.h:250
plStringBuilder(const plHybridStringBase< Size > &rhs)
Copies the given string into this one.
Definition StringBuilder.h:48
void SetFormat(const char *szFormat, ARGS &&... args)
Replaces this with a formatted string. Uses '{}' formatting placeholders, see plFormatString for deta...
Definition StringBuilder.h:230
plUInt64 GetHeapMemoryUsage() const
Returns the amount of bytes that are currently allocated on the heap.
Definition StringBuilder.h:394
void operator=(const plHybridString< Size, A > &rhs)
Copies the given string into this one.
Definition StringBuilder.h:112
void operator=(plHybridString< Size, A > &&rhs) noexcept
Moves the given string into this one.
Definition StringBuilder.h:126
plStringBuilder(plHybridStringBase< Size > &&rhs)
Moves the given string into this one.
Definition StringBuilder.h:63
plStringBuilder(const plHybridString< Size, A > &rhs)
Copies the given string into this one.
Definition StringBuilder.h:55
void operator=(const plHybridStringBase< Size > &rhs)
Copies the given string into this one.
Definition StringBuilder.h:105
void AppendFormat(const char *szFormat, ARGS &&... args)
Appends a formatted string. Uses '{}' formatting placeholders, see plFormatString for details.
Definition StringBuilder.h:240
bool(*)(plUInt32 uiChar) PL_CHARACTER_FILTER
Function Definition for a function that determines whether a (Utf32) character belongs to a certain c...
Definition StringUtils.h:209
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
A string class for storing and passing around strings.
Definition String.h:28
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Base class for strings, which implements all read-only string functions.
Definition StringBase.h:14