3template <
typename Derived>
6 const Derived* pDerived =
static_cast<const Derived*
>(
this);
7 return pDerived->GetData();
10template <
typename Derived>
13 const Derived* pDerived =
static_cast<const Derived*
>(
this);
14 return pDerived->GetData() + pDerived->GetElementCount();
17template <
typename Derived>
20 const Derived* pDerived =
static_cast<const Derived*
>(
this);
21 return pDerived->GetElementCount();
24template <
typename Derived>
30template <
typename Derived>
36template <
typename Derived>
42template <
typename Derived>
48template <
typename Derived>
54template <
typename Derived>
57 if (szStartSearchAt ==
nullptr)
58 szStartSearchAt = InternalGetData();
60 PL_ASSERT_DEV((szStartSearchAt >= InternalGetData()) && (szStartSearchAt <= InternalGetDataEnd()),
"The given pointer to start searching at is not inside this strings valid range.");
65template <
typename Derived>
68 if (szStartSearchAt ==
nullptr)
69 szStartSearchAt = InternalGetData();
71 PL_ASSERT_DEV((szStartSearchAt >= InternalGetData()) && (szStartSearchAt <= InternalGetDataEnd()),
"The given pointer to start searching at is not inside this strings valid range.");
76template <
typename Derived>
79 if (szStartSearchAt ==
nullptr)
80 szStartSearchAt = InternalGetDataEnd();
82 PL_ASSERT_DEV((szStartSearchAt >= InternalGetData()) && (szStartSearchAt <= InternalGetDataEnd()),
83 "The given pointer to start searching at is not inside this strings valid range.");
88template <
typename Derived>
91 if (szStartSearchAt ==
nullptr)
92 szStartSearchAt = InternalGetDataEnd();
94 PL_ASSERT_DEV((szStartSearchAt >= InternalGetData()) && (szStartSearchAt <= InternalGetDataEnd()),
95 "The given pointer to start searching at is not inside this strings valid range.");
100template <
typename Derived>
103 if (szStartSearchAt ==
nullptr)
104 szStartSearchAt = InternalGetData();
106 PL_ASSERT_DEV((szStartSearchAt >= InternalGetData()) && (szStartSearchAt <= InternalGetDataEnd()),
"The given pointer to start searching at is not inside this strings valid range.");
111template <
typename Derived>
114 if (szStartSearchAt ==
nullptr)
115 szStartSearchAt = InternalGetData();
117 PL_ASSERT_DEV((szStartSearchAt >= InternalGetData()) && (szStartSearchAt <= InternalGetDataEnd()),
"The given pointer to start searching at is not inside this strings valid range.");
122template <
typename Derived>
128template <
typename Derived>
134template <
typename Derived>
140template <
typename Derived>
146template <
typename Derived>
152template <
typename Derived>
158template <
typename Derived>
164template <
typename Derived>
170template <
typename Derived>
173 const char* pos = InternalGetData();
180template <
typename Derived>
186template <
typename Derived>
189 return rbegin(*
this);
192template <
typename DerivedLhs,
typename DerivedRhs>
198template <
typename DerivedRhs>
204template <
typename DerivedLhs>
210#if PL_DISABLED(PL_USE_CPP20_OPERATORS)
212template <
typename DerivedLhs,
typename DerivedRhs>
218template <
typename DerivedRhs>
224template <
typename DerivedLhs>
232#if PL_ENABLED(PL_USE_CPP20_OPERATORS)
234template <
typename DerivedLhs,
typename DerivedRhs>
240template <
typename DerivedLhs,
typename DerivedRhs>
248template <
typename DerivedLhs,
typename DerivedRhs>
254template <
typename DerivedRhs>
260template <
typename DerivedLhs>
266template <
typename DerivedLhs,
typename DerivedRhs>
272template <
typename DerivedRhs>
278template <
typename DerivedLhs>
284template <
typename DerivedLhs,
typename DerivedRhs>
287 return plStringUtils::Compare(lhs.InternalGetData(), rhs.InternalGetData(), lhs.InternalGetDataEnd(), rhs.InternalGetDataEnd()) <= 0;
290template <
typename DerivedRhs>
296template <
typename DerivedLhs>
302template <
typename DerivedLhs,
typename DerivedRhs>
305 return plStringUtils::Compare(lhs.InternalGetData(), rhs.InternalGetData(), lhs.InternalGetDataEnd(), rhs.InternalGetDataEnd()) >= 0;
308template <
typename DerivedRhs>
314template <
typename DerivedLhs>
322template <
typename DerivedLhs>
325 return plStringView(InternalGetData(), InternalGetElementCount());
328template <
typename Derived>
331 return plStringView(InternalGetData(), InternalGetElementCount());
334template <
typename Derived>
335template <
typename Container>
336void plStringBase<Derived>::Split(
bool bReturnEmptyStrings, Container& ref_output,
const char* szSeparator1,
const char* szSeparator2 ,
const char* szSeparator3 ,
const char* szSeparator4 ,
const char* szSeparator5 ,
const char* szSeparator6 )
const
338 GetView().Split(bReturnEmptyStrings, ref_output, szSeparator1, szSeparator2, szSeparator3, szSeparator4, szSeparator5, szSeparator6);
341template <
typename Derived>
347template <
typename Derived>
353template <
typename Derived>
356 return GetView().IsRelativePath();
359template <
typename Derived>
362 return GetView().IsAbsolutePath();
365template <
typename Derived>
371template <
typename Derived>
377template <
typename Derived>
383template <
typename Derived>
389template <
typename Derived>
395template <
typename Derived>
398 return GetView().HasAnyExtension();
static bool IsEqual(const char *pString1, const char *pString2, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true, if the two given strings are identical (bitwise).
Definition StringUtils_inl.h:125
static plInt32 Compare_NoCase(const char *pString1, const char *pString2, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Compares two strings for equality, case-insensitive.
Definition StringUtils.cpp:286
static plInt32 CompareN(const char *pString1, const char *pString2, plUInt32 uiCharsToCompare, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Compares the first uiCharsToCompare characters of the two strings for equality.
Definition StringUtils.cpp:247
static plInt32 CompareN_NoCase(const char *pString1, const char *pString2, plUInt32 uiCharsToCompare, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Compares the first uiCharsToCompare characters of the two strings for equality, case-insensitive.
Definition StringUtils.cpp:320
static bool IsEqual_NoCase(const char *pString1, const char *pString2, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true, if the two given strings are identical (case-insensitive).
Definition StringUtils_inl.h:136
static const char * FindSubString_NoCase(const char *szSource, const char *szStringToFind, const char *pSourceEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szStringToFindEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Searches for the first occurrence of szStringToFind in szSource. Ignores case.
Definition StringUtils.cpp:569
static bool EndsWith_NoCase(const char *szString, const char *szEndsWith, const char *pStringEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szEndsWithEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true if szString ends with the string given in szEndsWith. Ignores case.
Definition StringUtils.cpp:517
static const char * FindSubString(const char *szSource, const char *szStringToFind, const char *pSourceEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szStringToFindEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Searches for the first occurrence of szStringToFind in szSource.
Definition StringUtils.cpp:550
static const char * FindWholeWord_NoCase(const char *szString, const char *szSearchFor, PL_CHARACTER_FILTER isDelimiterCB, const char *pStringEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Searches szString for the word szSearchFor. If IsDelimiterCB returns true for both characters in fron...
Definition StringUtils.cpp:662
static plInt32 Compare(const char *pString1, const char *pString2, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Compares two strings for equality.
Definition StringUtils.cpp:218
static bool EndsWith(const char *szString, const char *szEndsWith, const char *pStringEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szEndsWithEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true if szString ends with the string given in szEndsWith.
Definition StringUtils.cpp:501
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
static bool StartsWith(const char *szString, const char *szStartsWith, const char *pStringEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szStartsWithEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true if szString starts with the string given in szStartsWith.
Definition StringUtils.cpp:453
static bool IsEqualN_NoCase(const char *pString1, const char *pString2, plUInt32 uiCharsToCompare, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true, if the two given strings are identical (case-insensitive) up to the n-th character.
Definition StringUtils_inl.h:141
static bool IsEqualN(const char *pString1, const char *pString2, plUInt32 uiCharsToCompare, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true, if the two given strings are identical (bitwise) up to the n-th character.
Definition StringUtils_inl.h:130
static const char * FindLastSubString_NoCase(const char *szSource, const char *szStringToFind, const char *szStartSearchAt=nullptr, const char *pSourceEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szStringToFindEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Searches for the last occurrence of szStringToFind in szSource before szStartSearchAt....
Definition StringUtils.cpp:611
static const char * FindLastSubString(const char *szSource, const char *szStringToFind, const char *szStartSearchAt=nullptr, const char *pSourceEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szStringToFindEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Searches for the last occurrence of szStringToFind in szSource before szStartSearchAt.
Definition StringUtils.cpp:589
static const char * FindWholeWord(const char *szString, const char *szSearchFor, PL_CHARACTER_FILTER isDelimiterCB, const char *pStringEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Searches szString for the word szSearchFor. If IsDelimiterCB returns true for both characters in fron...
Definition StringUtils.cpp:632
static bool StartsWith_NoCase(const char *szString, const char *szStartsWith, const char *pStringEnd=plUnicodeUtils::GetMaxStringEnd< char >(), const char *szStartsWithEnd=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true if szString starts with the string given in szStartsWith. Ignores case.
Definition StringUtils.cpp:477
static constexpr bool IsNullOrEmpty(const T *pString)
Returns true, if the given string is a nullptr pointer or a string that immediately terminates with a...
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
bool IsRootedPath() const
Returns true, if the given path represents a 'rooted' path. See plFileSystem for details.
Definition StringView.cpp:286
plStringView GetFileNameAndExtension() const
Returns the substring that represents the file name including the file extension.
Definition StringView.cpp:266
plStringView GetFileDirectory() const
Returns the directory of the given file, which is the substring up to the last path separator.
Definition StringView.cpp:271
const char * GetEndPointer() const
Returns the end of the view range. This will point to the byte AFTER the last character.
Definition StringView.h:108
plStringView GetFileExtension(bool bFullExtension=false) const
Returns the file extension of the given path. Will be empty, if the path does not end with a proper e...
Definition StringView.cpp:256
const char * GetStartPointer() const
Returns the start of the view range.
Definition StringView.h:102
plStringView GetRootedPathRootName() const
Extracts the root name from a rooted path.
Definition StringView.cpp:291
plStringView GetFileName() const
Returns the file name of a path, excluding the path and extension.
Definition StringView.cpp:261
bool HasExtension(plStringView sExtension) const
Checks whether the given path ends with the given extension. szExtension may start with a '....
Definition StringView.cpp:251
static plResult MoveToNextUtf8(const char *&ref_szUtf8, plUInt32 uiNumCharacters=1)
Moves the given string pointer ahead to the next Utf8 character sequence.
Definition UnicodeUtils_inl.h:201
Base class for strings, which implements all read-only string functions.
Definition StringBase.h:14
bool IsEqualN(plStringView sOther, plUInt32 uiCharsToCompare) const
Compares up to a given number of characters of this string with the other string for equality....
Definition StringBase_inl.h:153
bool IsAbsolutePath() const
Returns true, if the given path represents an absolute path on the current OS.
Definition StringBase_inl.h:360
const char * FindLastSubString(plStringView sStringToFind, const char *szStartSearchAt=nullptr) const
Definition StringBase_inl.h:77
bool IsRelativePath() const
Returns true, if the given path represents a relative path on the current OS.
Definition StringBase_inl.h:354
plInt32 CompareN_NoCase(plStringView sOther, plUInt32 uiCharsToCompare) const
Definition StringBase_inl.h:141
bool StartsWith_NoCase(plStringView sStartsWith) const
Returns true, if this string starts with the given string. Case insensitive.
Definition StringBase_inl.h:37
const char * FindLastSubString_NoCase(plStringView sStringToFind, const char *szStartSearchAt=nullptr) const
Definition StringBase_inl.h:89
plStringView GetFileNameAndExtension() const
Returns the substring that represents the file name including the file extension.
Definition StringBase_inl.h:372
bool IsEqualN_NoCase(plStringView sOther, plUInt32 uiCharsToCompare) const
Compares up to a given number of characters of this string with the other string for equality....
Definition StringBase_inl.h:165
bool StartsWith(plStringView sStartsWith) const
Returns true, if this string starts with the given string.
Definition StringBase_inl.h:31
plInt32 Compare(plStringView sOther) const
Compares this string with the other one. Returns 0 for equality, -1 if this string is 'smaller',...
Definition StringBase_inl.h:123
bool IsEmpty() const
Returns whether the string is an empty string.
Definition StringBase_inl.h:25
const char * FindSubString_NoCase(plStringView sStringToFind, const char *szStartSearchAt=nullptr) const
Definition StringBase_inl.h:66
bool EndsWith_NoCase(plStringView sEndsWith) const
Returns true, if this string ends with the given string. Case insensitive.
Definition StringBase_inl.h:49
plStringView GetFileName() const
Returns the file name of a path, excluding the path and extension.
Definition StringBase_inl.h:378
const char * FindWholeWord_NoCase(const char *szSearchFor, plStringUtils::PL_CHARACTER_FILTER isDelimiterCB, const char *szStartSearchAt=nullptr) const
Definition StringBase_inl.h:112
plInt32 Compare_NoCase(plStringView sOther) const
Compares this string with the other one. Returns 0 for equality, -1 if this string is 'smaller',...
Definition StringBase_inl.h:135
bool IsEqual(plStringView sOther) const
Compares this string with the other string for equality.
Definition StringBase_inl.h:147
plInt32 CompareN(plStringView sOther, plUInt32 uiCharsToCompare) const
Definition StringBase_inl.h:129
plStringView GetRootedPathRootName() const
Extracts the root name from a rooted path.
Definition StringBase_inl.h:342
reverse_iterator GetIteratorBack() const
Returns an iterator to this string, which points to the very last character (NOT the end).
Definition StringBase_inl.h:187
bool HasAnyExtension() const
Checks whether the given path has any file extension.
Definition StringBase_inl.h:396
void Split(bool bReturnEmptyStrings, Container &ref_output, const char *szSeparator1, const char *szSeparator2=nullptr, const char *szSeparator3=nullptr, const char *szSeparator4=nullptr, const char *szSeparator5=nullptr, const char *szSeparator6=nullptr) const
Fills the given container with plStringView's which represent each found substring....
Definition StringBase_inl.h:336
const char * ComputeCharacterPosition(plUInt32 uiCharacterIndex) const
Computes the pointer to the n-th character in the string. This is a linear search from the start.
Definition StringBase_inl.h:171
bool EndsWith(plStringView sEndsWith) const
Returns true, if this string ends with the given string.
Definition StringBase_inl.h:43
bool HasExtension(plStringView sExtension) const
Checks whether the given path ends with the given extension. szExtension should start with a '....
Definition StringBase_inl.h:390
iterator GetIteratorFront() const
Returns an iterator to this string, which points to the very first character.
Definition StringBase_inl.h:181
plStringView GetFileExtension() const
Returns the file extension of the given path. Will be empty, if the path does not end with a proper e...
Definition StringBase_inl.h:384
bool IsEqual_NoCase(plStringView sOther) const
Compares this string with the other string for equality.
Definition StringBase_inl.h:159
plStringView GetFileDirectory() const
Returns the directory of the given file, which is the substring up to the last path separator.
Definition StringBase_inl.h:366
plStringView GetView() const
Returns a string view to this string's data.
Definition StringBase_inl.h:329
bool IsRootedPath() const
Returns true, if the given path represents a 'rooted' path. See plFileSystem for details.
Definition StringBase_inl.h:348
const char * FindWholeWord(const char *szSearchFor, plStringUtils::PL_CHARACTER_FILTER isDelimiterCB, const char *szStartSearchAt=nullptr) const
Definition StringBase_inl.h:101
const char * FindSubString(plStringView sStringToFind, const char *szStartSearchAt=nullptr) const
Definition StringBase_inl.h:55
STL forward iterator used by all string classes. Iterates over unicode characters....
Definition StringIterator.h:10
STL reverse iterator used by all string classes. Iterates over unicode characters....
Definition StringIterator.h:163