12 #include <initializer_list>
13 #include "boost/algorithm/string/replace.hpp"
14 #include "Arp/System/Core/BasicFormatter.hxx"
15 #include "Arp/System/Core/Impl/BasicStringFormatExceptionHandler.hpp"
17 #ifndef ARP_INSIDE_ARP_H
18 #error Never include 'BasicString.hxx' directly, just include 'Arp.h'
31 template<
class C,
class Alloc = std::allocator<C>>
36 using AllocatorTraits = std::allocator_traits<Alloc>;
40 using Tokens = std::vector<SelfType>;
49 using pointer =
typename AllocatorTraits::pointer;
51 using iterator =
typename BaseString::iterator;
71 : baseString(arg.baseString, alloc)
87 : baseString(arg.baseString, offset, count)
97 : baseString(arg.baseString, offset, count, alloc)
105 : baseString(pChars, count)
114 : baseString(pChars, count, alloc)
129 : baseString(pChars, alloc)
137 : baseString(count, c)
146 : baseString(count, c, alloc)
158 : baseString(
std::move(arg.baseString), alloc)
166 : baseString(arg, alloc)
175 : baseString(first, last, alloc)
184 : baseString(first, last, alloc)
198 : baseString(
std::move(arg))
231 this->baseString = right;
245 this->baseString = right;
254 this->baseString = c;
264 this->baseString += right;
273 this->baseString += right.baseString;
282 this->baseString += right;
291 this->baseString += c;
302 this->baseString = std::move(arg.baseString);
311 this->baseString.assign(arg);
320 this->baseString.assign(arg.baseString);
330 this->baseString.assign(arg.baseString, offset, count);
339 this->baseString.assign(arg);
348 this->baseString.assign(std::move(arg));
357 this->baseString.assign(pChars, count);
365 this->baseString.assign(pChars);
374 this->baseString.assign(count, c);
383 this->baseString.assign(first, last);
392 this->baseString.assign(first, last);
401 this->baseString.assign(first, last);
412 this->baseString.append(arg);
421 this->baseString.append(arg.baseString);
431 this->baseString.append(arg.baseString, offset, count);
440 this->baseString.append(pChars, count);
448 this->baseString.append(pChars);
457 this->baseString.append(count, c);
466 this->baseString.append(first, last);
475 this->baseString.append(first, last);
484 this->baseString.append(first, last);
496 return this->baseString.insert(where, arg);
505 this->baseString.insert(offset, arg.baseString);
517 this->baseString.insert(offset, arg.baseString, argOffset, count);
528 this->baseString.insert(offset, pChars, count);
538 this->baseString.insert(offset, pChars);
549 this->baseString.insert(offset, count, c);
559 return this->baseString.insert(where, c);
569 return this->baseString.insert(where, count, c);
579 return this->baseString.insert(where, first, last);
589 return this->baseString.insert(where, first, last);
599 return this->baseString.insert(where, first, last);
609 this->baseString.erase(offset);
619 this->baseString.erase(offset, count);
628 return this->baseString.erase(where);
637 return this->baseString.erase(first, last);
649 this->baseString.replace(first, last, chars);
660 this->baseString.replace(offset, length, arg.baseString);
673 this->baseString.replace(offset, length, arg.baseString, offsetArg, count);
685 this->baseString.replace(offset, length, pChars, offset, count);
696 this->baseString.replace(offset, length, pChars);
708 this->baseString.replace(offset, length, count, c);
719 this->baseString.replace(first, last, arg.baseString);
731 this->baseString.replace(first, last, pChars, count);
742 this->baseString.replace(first, last, pChars);
754 this->baseString.replace(first, last, count, c);
766 this->baseString.replace(first, last, first2, last2);
778 this->baseString.replace(first, last, first2, last2);
790 this->baseString.replace(first, last, first2, last2);
802 this->baseString.replace(first, last, first2, last2);
815 boost::replace_all(this->baseString, pattern.baseString, replacement.baseString);
826 return this->baseString.begin();
834 return this->baseString.begin();
842 return this->baseString.end();
850 return this->baseString.end();
859 return this->baseString.begin();
866 return this->baseString.begin();
873 return this->baseString.end();
880 return this->baseString.end();
887 return this->baseString.rbegin();
894 return this->baseString.rbegin();
901 return this->baseString.rend();
908 return this->baseString.rend();
915 return this->baseString.cbegin();
922 return this->baseString.cend();
929 return this->baseString.crbegin();
936 return this->baseString.crend();
942 this->baseString.shrink_to_fit();
949 this->baseString.push_back(c);
958 this->baseString.pop_back();
967 return this->baseString.front();
975 return this->baseString.front();
983 return this->baseString.back();
991 return this->baseString.back();
1000 return this->baseString.at(offset);
1009 return this->baseString.at(offset);
1018 return this->baseString[offset];
1027 return this->baseString[offset];
1041 return this->baseString.length();
1053 return this->baseString.size();
1059 return this->baseString.max_size();
1071 return this->baseString.capacity();
1078 return this->baseString.empty();
1089 this->baseString.resize(newSize);
1101 this->baseString.resize(newSize, c);
1113 this->baseString.reserve(newCapacity);
1119 this->baseString.clear();
1130 return this->baseString.find(pattern.baseString, offset);
1140 return this->baseString.find(pChars, offset, count);
1149 return this->baseString.find(pChars, offset);
1158 return this->baseString.find(c, offset);
1167 return this->baseString.rfind(pattern.baseString, offset);
1177 return this->baseString.rfind(pChars, offset, count);
1186 return this->baseString.rfind(pChars, offset);
1195 return this->baseString.rfind(c, offset);
1204 return this->baseString.find_first_of(chars.baseString, offset);
1214 return this->baseString.find_first_of(pChars, offset, count);
1223 return this->baseString.find_first_of(pChars, offset);
1233 return this->baseString.find_first_of(c, offset);
1242 return this->baseString.find_last_of(chars.baseString, offset);
1252 return this->baseString.find_last_of(pChars, offset, count);
1261 return this->baseString.find_last_of(pChars, offset);
1271 return this->baseString.find_last_of(c, offset);
1280 return this->baseString.find_first_not_of(chars.baseString, offset);
1290 return this->baseString.find_first_not_of(pChars, offset, count);
1299 return this->baseString.find_first_not_of(pChars, offset);
1309 return this->baseString.find_first_not_of(c, offset);
1318 return this->baseString.find_last_not_of(chars.baseString, offset);
1328 return this->baseString.find_last_not_of(pChars, offset, count);
1337 return this->baseString.find_last_not_of(pChars, offset);
1347 return this->baseString.find_last_not_of(c, offset);
1361 return this->baseString.compare(other.baseString);
1375 return this->baseString.compare(offset, count, other.baseString);
1391 return this->baseString.compare(offset, count, other.baseString, offsetOther, countOther);
1403 return this->baseString.compare(pOther);
1417 return this->baseString.compare(offset, count, pOther);
1432 return this->baseString.compare(offset, count, pOther, countOther);
1442 return this->
Find(pChars) == 0;
1450 return this->
Find(pattern) == 0;
1466 size_t thisLength = this->baseString.length();
1467 size_t patternLength = pattern.baseString.length();
1469 if (thisLength < patternLength)
1474 return (this->baseString.compare(thisLength - patternLength, patternLength, pattern.baseString) == 0);
1482 template<
typename... Args>
1492 template<
typename... Args>
1503 return this->baseString;
1510 return this->baseString.c_str();
1517 return this->baseString.data();
1524 return this->baseString;
1533 return SelfType(this->baseString.substr(offset, count));
1540 return this->baseString.get_allocator();
1547 this->baseString.swap(other.baseString);
1552 auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
1554 return !std::isspace<char>(c, std::locale::classic());
1556 return SelfType(left, this->baseString.end());
1561 auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
1563 return !std::isspace<char>(c, std::locale::classic());
1565 return SelfType(this->baseString.begin(), right.base());
1570 auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
1572 return !std::isspace<char>(c, std::locale::classic());
1576 if (left == this->baseString.end())
1581 auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
1583 return !std::isspace<char>(c, std::locale::classic());
1585 return SelfType(left, right.base());
1593 Tokens Split(
char delimiter,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const
1595 char delimiters[] = { delimiter };
1596 return this->
Split(delimiters, 1, trimTokens, removeEmptyTokens);
1605 Tokens Split(
const char delimiters[],
size_t delimitersCount,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const
1610 size_t length = this->
Length();
1612 for (
size_t first = 0; first < length; first = last + 1)
1614 size_t position = this->
FindFirstOf(delimiters, first, delimitersCount);
1615 last = (position !=
NPos) ? position : this->
Length();
1620 token = token.Trim();
1622 if (!removeEmptyTokens || !token.
IsEmpty())
1624 tokens.push_back(token);
1628 if (!removeEmptyTokens && (this->
FindLastOf(delimiters,
NPos, delimitersCount) == (length - 1)))
1630 tokens.push_back(
Empty);
1646 size_t length = this->
Length();
1647 size_t delimiterLength = delimiter.
Length();
1649 for (
size_t first = 0; first < length; first = last + delimiterLength)
1651 size_t position = this->
Find(delimiter, first);
1652 last = (position !=
NPos) ? position : length;
1657 token = token.Trim();
1659 if (!token.
IsEmpty() || !removeEmptyTokens)
1661 tokens.push_back(token);
1665 if (!removeEmptyTokens && this->
EndWith(delimiter))
1667 tokens.push_back(
Empty);
1685 template <
class CharType,
class Alloc>
1688 template <
class CharType,
class Alloc>
1697 template<
class CharType,
class Alloc>
1707 template<
class CharType,
class Alloc>
1718 template<
class CharType,
class Alloc>
1721 std::basic_string<CharType, std::char_traits<CharType>, Alloc> baseString;
1723 right.
Assign(baseString);
1731 template<
class CharType,
class Alloc>
1743 template<
class CharType,
class Alloc>
1745 const CharType* left,
1755 template<
class CharType,
class Alloc>
1757 const CharType left,
1767 template<
class CharType,
class Alloc>
1770 const CharType* right)
1779 template<
class CharType,
class Alloc>
1782 const CharType right)
1791 template<
class CharType,
class Alloc>
1803 template<
class CharType,
class Alloc>
1808 return (std::move(left.Append(right)));
1815 template<
class CharType,
class Alloc>
1820 return left.GetBaseString() + right.GetBaseString();
1827 template<
class CharType,
class Alloc>
1829 const CharType* left,
1832 return left + right.GetBaseString();
1839 template<
class CharType,
class Alloc>
1841 const CharType left,
1844 return left + right.GetBaseString();
1851 template<
class CharType,
class Alloc>
1854 const CharType* right)
1856 return left.GetBaseString() + right;
1863 template<
class CharType,
class Alloc>
1866 const CharType right)
1868 return left.GetBaseString() + right;
1875 template<
class CharType,
class Alloc>
1887 template<
class CharType,
class Alloc>
1889 const CharType* left,
1899 template<
class CharType,
class Alloc>
1902 const CharType* right)
1911 template<
class CharType,
class Alloc>
1916 return (!(left == right));
1923 template<
class CharType,
class Alloc>
1925 const CharType *left,
1928 return (!(left == right));
1935 template<
class CharType,
class Alloc>
1938 const CharType* right)
1940 return (!(left == right));
1947 template<
class CharType,
class Alloc>
1959 template<
class CharType,
class Alloc>
1961 const CharType* left,
1971 template<
class CharType,
class Alloc>
1974 const CharType* right)
1983 template<
class CharType,
class Alloc>
1988 return (right < left);
1995 template<
class CharType,
class Alloc>
1997 const CharType* left,
2000 return (right < left);
2007 template<
class CharType,
class Alloc>
2010 const CharType* right)
2012 return (right < left);
2019 template<
class CharType,
class Alloc>
2024 return (!(right < left));
2031 template<
class CharType,
class Alloc>
2033 const CharType* left,
2036 return (!(right < left));
2043 template<
class CharType,
class Alloc>
2046 const CharType* right)
2048 return (!(right < left));
2055 template<
class CharType,
class Alloc>
2060 return (!(left < right));
2067 template<
class CharType,
class Alloc>
2069 const CharType* left,
2072 return (!(left < right));
2079 template<
class CharType,
class Alloc>
2082 const CharType* right)
2084 return (!(left < right));
2097 template<
class C,
class Alloc>
2098 struct hash<
Arp::BasicString<C, Alloc>>
Definition: BasicString.hxx:33
SelfType & Insert(size_type offset, size_type count, CharType c)
Inserts count consecutive copies of character c at position offset .
Definition: BasicString.hxx:547
SelfType & Replace(size_type offset, size_type length, const CharType *pChars, size_type count)
Replaces a range of chars.
Definition: BasicString.hxx:683
SelfType & Insert(size_type offset, const CharType *pChars, size_type count)
This operation inserts the as argument passed string partially.
Definition: BasicString.hxx:526
typename AllocatorTraits::pointer pointer
The pointer type of this type.
Definition: BasicString.hxx:49
const_reverse_iterator ConstReverseBegin() const
Returns the begin iterator of this const string for reverse iterating.
Definition: BasicString.hxx:927
typename BaseString::const_iterator const_iterator
The const iterator type of this type.
Definition: BasicString.hxx:52
size_type FindLastNotOf(const CharType *pChars, size_type offset=NPos) const
Finds the last occurence of any character which is not in pChars .
Definition: BasicString.hxx:1335
SelfType & Assign(const CharType *pChars, size_type count)
This operation copies the as argument passed C-string partially.
Definition: BasicString.hxx:355
size_type FindFirstNotOf(const SelfType &chars, size_type offset=0) const
Finds the first occurence of any character which is not in chars .
Definition: BasicString.hxx:1278
static SelfType Format(const SelfType &format, const Args &... args)
Formats the format string using the .NET/Python syntax with the given variadic arguments.
Definition: BasicString.hxx:1483
typename AllocatorTraits::const_pointer const_pointer
The const pointer type of this type.
Definition: BasicString.hxx:50
typename BaseString::size_type size_type
The size type of this type.
Definition: BasicString.hxx:45
size_type FindFirstOf(const CharType *pChars, size_type offset=0) const
Finds the first occurence of any character in pChars .
Definition: BasicString.hxx:1221
std::ostream & operator<<(std::ostream &os, const BasicString< CharType, Alloc > &right)
Streams the right string to the outstream os .
Definition: BasicString.hxx:1708
BasicString(const CharType *pChars, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:128
const CharType * CStr() const
Gets the character data of this string.
Definition: BasicString.hxx:1508
BasicString< CharType, Allocator > SelfType
The self type.
Definition: BasicString.hxx:38
SelfType & Replace(const_iterator first, const_iterator last, iterator first2, iterator last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:764
SelfType & Replace(const_iterator first, const_iterator last, size_type count, CharType c)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:752
BasicString< CharType, Alloc > operator+(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Concatenates the right string to the left string.
Definition: BasicString.hxx:1732
const_reference At(size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1007
C CharType
The character type.
Definition: BasicString.hxx:37
Tokens Split(char delimiter, bool trimTokens=true, bool removeEmptyTokens=true) const
Splits this string into tokens using the specified delimiter characters (multiple).
Definition: BasicString.hxx:1593
bool IsEmpty() const
Determines if this string is empty.
Definition: BasicString.hxx:1076
size_type ReverseFind(CharType c, size_type offset=NPos) const
Finds the last char which equal to c .
Definition: BasicString.hxx:1193
iterator Erase(const_iterator where)
This operation erases chars from this string.
Definition: BasicString.hxx:626
BasicString(iterator first, iterator last, const Allocator &alloc=Allocator())
Copies the sequence of characters in the range [first,last), in the same order..
Definition: BasicString.hxx:174
SelfType & operator+=(const CharType *right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:280
SelfType & operator+=(const SelfType &right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:271
SelfType & Replace(const_iterator first, const_iterator last, std::initializer_list< CharType > chars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:647
SelfType & Assign(std::initializer_list< CharType > arg)
This operation copies each of the characters in the argument to this string, in the same order.
Definition: BasicString.hxx:309
BasicString(const BaseString &arg)
This copy constructor copies the as argument passed std::string to this string.
Definition: BasicString.hxx:190
const_reverse_iterator ConstReverseEnd() const
Returns the end iterator of this const string for reverse iterating.
Definition: BasicString.hxx:934
size_type FindLastOf(const SelfType &chars, size_type offset=NPos) const
Finds the last occurence of any character in chars .
Definition: BasicString.hxx:1240
iterator Insert(const_iterator where, const_iterator first, const_iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:587
SelfType & Assign(SelfType &&arg)
This operation moves the as argument passed string to this string.
Definition: BasicString.hxx:300
const_iterator ConstBegin() const
Returns the begin iterator of this const string.
Definition: BasicString.hxx:913
SelfType & operator+=(CharType c)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:289
size_type Find(CharType c, size_type offset=0) const
Finds the first char which equal to c .
Definition: BasicString.hxx:1156
typename BaseString::const_reverse_iterator const_reverse_iterator
The const reverse iterator type of this type.
Definition: BasicString.hxx:54
SelfType & operator=(std::initializer_list< CharType > right)
This assignment operator copies each of the characters in the right-hand-side operand to this string,...
Definition: BasicString.hxx:229
iterator Insert(const_iterator where, std::initializer_list< CharType > arg)
This operation inserts each of the characters in the argument to this string, in the same order.
Definition: BasicString.hxx:494
const BaseString & GetBaseString() const
Gets the basic std string.
Definition: BasicString.hxx:1501
SelfType & Append(size_type count, CharType c)
Appends to this string count consecutive copies of character c .
Definition: BasicString.hxx:455
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:740
SelfType & Append(const SelfType &arg)
This operation appends the the argument to this string.
Definition: BasicString.hxx:419
bool EndWith(const CharType *pChars) const
Determines if this string ends with the pChars C-string.
Definition: BasicString.hxx:1456
Allocator GetAllocator() const
Gets the allocator of this string.
Definition: BasicString.hxx:1538
SelfType & operator=(const CharType *right)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:243
void Reserve(size_type newCapacity=0)
Reserves memory upto the specified newCapacity .
Definition: BasicString.hxx:1111
SelfType Substr(size_type offset=0, size_type count=NPos) const
Gets a substring of this string.
Definition: BasicString.hxx:1531
typename BaseString::difference_type difference_type
The difference type of this type.
Definition: BasicString.hxx:46
reference operator[](size_type offset)
Returns a reference to the character at position offset .
Definition: BasicString.hxx:1016
SelfType & Append(const SelfType &arg, size_type offset, size_type count=NPos)
This operation appends the as argument passed string partially.
Definition: BasicString.hxx:429
static SelfType Format(const char *format, const Args &... args)
Formats the format C-string using the .NET/Python syntax with the given variadic arguments.
Definition: BasicString.hxx:1493
SelfType & Erase(size_type offset, size_type count)
This operation erases chars from this string.
Definition: BasicString.hxx:617
int Compare(const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1359
void swap(BasicString< CharType, Alloc > &left, BasicString< CharType, Alloc > &right) noexcept
Swaps the content of the left string with the content of the right string.
Definition: BasicString.hxx:1698
const_iterator Begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:864
bool operator<=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2020
const_reverse_iterator ReverseBegin() const
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:892
bool operator>(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1984
void PushBack(CharType c)
Appends the character c to this string.
Definition: BasicString.hxx:947
SelfType & Replace(const_iterator first, const_iterator last, const_iterator first2, const_iterator last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:776
BasicString(BaseString &&arg)
This move constructor moves the as argument passed std::string to this string.
Definition: BasicString.hxx:197
void Clear()
Clears the content of this string, but does not modify the capacity.
Definition: BasicString.hxx:1117
size_type FindFirstNotOf(const CharType *pChars, size_type offset=0) const
Finds the first occurence of any character which is not in pChars .
Definition: BasicString.hxx:1297
size_type MaxSize() const
Returns the number maximum size any string might have.
Definition: BasicString.hxx:1057
int Compare(const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1401
void Swap(SelfType &other)
Swaps the content of this string with the content of the other string.
Definition: BasicString.hxx:1545
SelfType & Assign(BaseString &&arg)
This operation moves the argument to this string.
Definition: BasicString.hxx:346
iterator Insert(const_iterator where, iterator first, iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:577
iterator begin()
Returns the begin iterator of this string.
Definition: BasicString.hxx:824
BasicString(const SelfType &arg, size_type offset, size_type count=NPos)
This constructor copies the as argument passed string partially.
Definition: BasicString.hxx:86
iterator Begin()
Returns the begin iterator of this string.
Definition: BasicString.hxx:857
SelfType & Replace(size_type offset, size_type length, const CharType *pChars)
Replaces a range of chars.
Definition: BasicString.hxx:694
static const size_type NPos
This position value is returned when find operations do not match, or is used as default value for an...
Definition: BasicString.hxx:210
reverse_iterator ReverseEnd()
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:899
const_iterator end() const
Returns the end iterator of this string.
Definition: BasicString.hxx:848
SelfType & Append(const_pointer first, const_pointer last)
Appends the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:482
size_type Find(const SelfType &pattern, size_type offset=0) const
Finds the first substring which equal to pattern .
Definition: BasicString.hxx:1128
BasicString(const CharType *pChars, size_type count)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:104
bool operator<(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1948
size_type ReverseFind(const CharType *pChars, size_type offset=NPos) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1184
typename BaseString::reference reference
The reference type of this type.
Definition: BasicString.hxx:47
size_type FindFirstOf(const CharType *pChars, size_type offset, size_type count) const
Finds the first occurence of any character in pChars .
Definition: BasicString.hxx:1212
SelfType & Insert(size_type offset, const CharType *pChars)
This operation inserts the as argument passed string.
Definition: BasicString.hxx:536
size_type FindLastOf(const CharType *pChars, size_type offset=NPos) const
Finds the last occurence of any character in pChars .
Definition: BasicString.hxx:1259
reverse_iterator ReverseBegin()
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:885
SelfType & operator+=(std::initializer_list< CharType > right)
This assignment operator appends each of the characters in the right-hand-side operand to this string...
Definition: BasicString.hxx:262
SelfType & operator=(SelfType &&right) noexcept=default
This move assignment operator moves the right-hand-side operand to this string.
BasicString(const SelfType &arg)=default
The copy constructor copies the as argument passed string deeply.
SelfType & Replace(const_iterator first, const_iterator last, const_pointer first2, const_pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:788
int Compare(size_type offset, size_type count, const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1415
iterator Insert(const_iterator where, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:557
reference Front()
Returns a reference to the first character in the string.
Definition: BasicString.hxx:965
BasicString(const CharType *pChars, size_type count, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:113
size_type FindLastOf(CharType c, size_type offset=NPos) const
Finds the last occurence of character c .
Definition: BasicString.hxx:1269
SelfType & Erase(size_type offset=0)
This operation erases chars from this string.
Definition: BasicString.hxx:607
SelfType & Replace(size_type offset, size_type length, size_type count, CharType c)
Replaces a range of chars by a character.
Definition: BasicString.hxx:706
void Resize(size_type newSize, CharType c)
Resizes this string to the specified new size.
Definition: BasicString.hxx:1099
const_reference Back() const
Returns a const reference to the last character in the string.
Definition: BasicString.hxx:989
bool operator>=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2056
Tokens Split(const char delimiters[], size_t delimitersCount, bool trimTokens=true, bool removeEmptyTokens=true) const
Splits this string into tokens using the specified delimiter characters (multiple).
Definition: BasicString.hxx:1605
size_type FindLastNotOf(const SelfType &chars, size_type offset=NPos) const
Finds the last occurence of any character which is not in chars .
Definition: BasicString.hxx:1316
BasicString(std::initializer_list< CharType > arg, const Allocator &alloc=Allocator())
Copies each of the characters in initList , in the same order.
Definition: BasicString.hxx:165
typename BaseString::iterator iterator
The iterator type of this type.
Definition: BasicString.hxx:51
size_type Find(const CharType *pChars, size_type offset=0) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1147
reference At(size_type offset)
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:998
void PopBack()
Removes the character at the end of this string.
Definition: BasicString.hxx:954
BasicString(const CharType *pChars)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:120
size_type FindFirstNotOf(CharType c, size_type offset=0) const
Finds the first occurence of any character which is not equal to c .
Definition: BasicString.hxx:1307
SelfType & Append(const CharType *pChars)
This operation appends the as argument passed C-string.
Definition: BasicString.hxx:446
const_reference operator[](size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1025
size_type FindLastNotOf(CharType c, size_type offset=NPos) const
Finds the last occurence of any character which is not equal to c .
Definition: BasicString.hxx:1345
std::vector< SelfType > Tokens
Used by Split() operation.
Definition: BasicString.hxx:40
iterator Insert(const_iterator where, const_pointer first, const_pointer last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:597
BasicString(const Allocator &alloc)
This constructor creates an empty string instance.
Definition: BasicString.hxx:77
BasicString(SelfType &&arg) noexcept=default
This move constructor moves the as argument passed string to this string.
bool StartWith(const SelfType &pattern) const
Determines if this string starts with the pattern string.
Definition: BasicString.hxx:1448
size_type Length() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1039
SelfType & Assign(iterator first, iterator last)
Copies the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:381
int Compare(size_type offset, size_type count, const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1373
SelfType & Append(std::initializer_list< CharType > arg)
This operation appends each of the characters in the argument to this string, in the same order.
Definition: BasicString.hxx:410
typename BaseString::const_reference const_reference
The const reference type of this type.
Definition: BasicString.hxx:48
bool operator!=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on inequality.
Definition: BasicString.hxx:1912
SelfType & Insert(size_type offset, const SelfType &arg)
This operation inserts the the argument at the given position.
Definition: BasicString.hxx:503
bool EndWith(const SelfType &pattern) const
Determines if this string starts with the pattern string.
Definition: BasicString.hxx:1464
SelfType & Replace(size_type offset, size_type length, const SelfType &arg)
Replaces a range of chars.
Definition: BasicString.hxx:658
SelfType & operator=(CharType c)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:252
size_type FindFirstNotOf(const CharType *pChars, size_type offset, size_type count) const
Finds the first occurence of any character which is not in pChars .
Definition: BasicString.hxx:1288
const_reference Front() const
Returns a const reference to the first character in the string.
Definition: BasicString.hxx:973
SelfType & Append(const CharType *pChars, size_type count)
This operation appends the as argument passed C-string partially.
Definition: BasicString.hxx:438
Alloc Allocator
The characters allocator type.
Definition: BasicString.hxx:35
size_type ReverseFind(const CharType *pChars, size_type offset, size_type count) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1175
SelfType & Append(const_iterator first, const_iterator last)
Appends the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:473
size_type FindLastNotOf(const CharType *pChars, size_type offset, size_type count) const
Finds the last occurence of any character which is not in pChars .
Definition: BasicString.hxx:1326
iterator Erase(const_iterator first, const_iterator last)
Erases a range of chars [first;last).
Definition: BasicString.hxx:635
BasicString(const_iterator first, const_iterator last, const Allocator &alloc=Allocator())
Copies the sequence of characters in the range [first,last), in the same order..
Definition: BasicString.hxx:183
std::istream & operator>>(std::istream &is, BasicString< CharType, Alloc > &right)
Streams the instream is into the right string.
Definition: BasicString.hxx:1719
iterator End()
Returns the end iterator of this string.
Definition: BasicString.hxx:871
const_iterator ConstEnd() const
Returns the end iterator of this const string.
Definition: BasicString.hxx:920
BasicString(const SelfType &arg, size_type offset, size_type count, const Allocator &alloc)
This constructor copies the as argument passed string partially.
Definition: BasicString.hxx:96
const_reverse_iterator ReverseEnd() const
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:906
Tokens SplitByWord(const SelfType &delimiter, bool trimTokens=true, bool removeEmptyTokens=true) const
Splits this string into tokens using the specified (single) delimiter string.
Definition: BasicString.hxx:1641
SelfType & Assign(const BaseString &arg)
This operation copies the argument to this string.
Definition: BasicString.hxx:337
SelfType & Assign(const_iterator first, const_iterator last)
Copies the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:390
int Compare(size_type offset, size_type count, const SelfType &other, size_type offsetOther, size_type countOther=NPos) const
Compares a substring of this string to a substring of the other string lexicographical.
Definition: BasicString.hxx:1389
size_type FindLastOf(const CharType *pChars, size_type offset, size_type count) const
Finds the last occurence of any character in pChars .
Definition: BasicString.hxx:1250
SelfType & Assign(const SelfType &arg, size_type offset, size_type count=NPos)
This operation copies the as argument passed string partially.
Definition: BasicString.hxx:328
BasicString(size_type count, CharType c)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:136
BasicString()=default
The default constructor constructs an empty string instance.
~BasicString()=default
The destructor deallocates all memory of this instance.
SelfType & operator=(const SelfType &right)=default
This assignment operator copies the the right-hand-side operand to this string.
static const SelfType NewLine
This static string instance represents the (platform specific) new line string.
Definition: BasicString.hxx:218
void ShrinkToFit()
Reduces the capacity of this string to its size.
Definition: BasicString.hxx:940
iterator end()
Returns the end iterator of this string.
Definition: BasicString.hxx:840
bool StartWith(const CharType *pChars) const
Determines if this string starts with the pChars C-string.
Definition: BasicString.hxx:1440
size_type Find(const CharType *pChars, size_type offset, size_type count) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1138
static const SelfType Empty
An emtpy static string instance.
Definition: BasicString.hxx:214
size_type Capacity() const
Rceturns the capacity of this string.
Definition: BasicString.hxx:1069
SelfType & Insert(size_type offset, const SelfType &arg, size_type argOffset, size_type count=NPos)
This operation inserts the as argument passed string partially.
Definition: BasicString.hxx:515
size_type ReverseFind(const SelfType &pattern, size_type offset=NPos) const
Finds the last substring which equal to pattern .
Definition: BasicString.hxx:1165
reference Back()
Returns a reference to the last character in the string.
Definition: BasicString.hxx:981
int Compare(size_type offset, size_type count, const CharType *pOther, size_type countOther) const
Compares a substring of this string to a substring of the pOther string lexicographical.
Definition: BasicString.hxx:1430
size_type Size() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1051
CharType value_type
The char type of this type.
Definition: BasicString.hxx:44
SelfType & Replace(const_iterator first, const_iterator last, const SelfType &arg)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:717
size_type FindFirstOf(CharType c, size_type offset=0) const
Finds the first occurence of character c .
Definition: BasicString.hxx:1231
Allocator allocator_type
The allocator type of this type.
Definition: BasicString.hxx:43
SelfType & ReplaceAll(const SelfType &pattern, const SelfType &replacement)
Replaces a given pattern by a replacement string.
Definition: BasicString.hxx:813
typename BaseString::reverse_iterator reverse_iterator
The reverse iterator type of this type.
Definition: BasicString.hxx:53
bool operator==(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on equality.
Definition: BasicString.hxx:1876
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars, size_type count)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:729
std::basic_string< CharType, std::char_traits< CharType >, Allocator > BaseString
The type of the basic std string.
Definition: BasicString.hxx:39
SelfType & Assign(const CharType *pChars)
This operation copies the as argument passed C-string.
Definition: BasicString.hxx:363
void Resize(size_type newSize)
Resizes this string to the specified new size.
Definition: BasicString.hxx:1087
const_iterator End() const
Returns the end iterator of this string.
Definition: BasicString.hxx:878
SelfType & Assign(const SelfType &arg)
This operation copies the the argument to this string.
Definition: BasicString.hxx:318
BasicString(const SelfType &arg, const Allocator &alloc)
This constructor copies the as argument passed string deeply.
Definition: BasicString.hxx:70
SelfType & Replace(size_type offset, size_type length, const SelfType &arg, size_type offsetArg, size_type count=NPos)
Replaces a range of chars.
Definition: BasicString.hxx:671
SelfType & Append(iterator first, iterator last)
Appends the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:464
BasicString(size_type count, CharType c, const Allocator &alloc)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:145
BasicString(SelfType &&arg, const Allocator &alloc)
This move constructor moves the as argument passed string to this string.
Definition: BasicString.hxx:157
const_iterator begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:832
SelfType & Replace(const_iterator first, const_iterator last, pointer first2, pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:800
SelfType & Assign(size_type count, CharType c)
Fills this string with count consecutive copies of character c .
Definition: BasicString.hxx:372
SelfType & Assign(const_pointer first, const_pointer last)
Copies the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:399
size_type FindFirstOf(const SelfType &chars, size_type offset=0) const
Finds the first occurence of any character in chars .
Definition: BasicString.hxx:1202
iterator Insert(const_iterator where, size_type count, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:567
Root namespace for the PLCnext API
Namespace of the C++ standard library
result_type operator()(const argument_type &key) const
This functor operator returns the hash value of the as argument passed string.
Definition: BasicString.hxx:2113
size_t result_type
The result type of this functor class (stl policy type)
Definition: BasicString.hxx:2107
Arp::BasicString< C, Alloc > argument_type
The argument type of this functor class (stl policy type)
Definition: BasicString.hxx:2105