13#include <initializer_list>
14#include "boost/algorithm/string/replace.hpp"
15#include "Arp/System/Core/BasicFormatter.hxx"
16#include "Arp/System/Core/Impl/BasicStringFormatExceptionHandler.hpp"
18#ifndef ARP_INSIDE_ARP_H
19 #error Never include 'BasicString.hxx' directly, just include 'Arp.h'
32template<
class C,
class Alloc = std::allocator<C>>
37 using AllocatorTraits = std::allocator_traits<Alloc>;
41 using Tokens = std::vector<SelfType>;
42 using Bytes = std::vector<byte>;
51 using pointer =
typename AllocatorTraits::pointer;
53 using iterator =
typename BaseString::iterator;
73 : baseString(arg.baseString, alloc)
89 : baseString(arg.baseString, offset, count)
99 : baseString(arg.baseString, offset, count, alloc)
107 : baseString(pChars, count)
116 : baseString(pChars, count, alloc)
131 : baseString(pChars, alloc)
139 : baseString(count, c)
148 : baseString(count, c, alloc)
160 : baseString(
std::move(arg.baseString), alloc)
168 : baseString(arg, alloc)
177 : baseString(first, last, alloc)
186 : baseString(first, last, alloc)
194 : baseString(reinterpret_cast<const char*>(bytes.data()), reinterpret_cast<const char*>(bytes.data() + bytes.size()), alloc)
208 : baseString(
std::move(arg))
241 this->baseString = right;
255 this->baseString = right;
264 this->baseString = c;
274 this->baseString += right;
283 this->baseString += right.baseString;
292 this->baseString += right;
301 this->baseString += c;
312 this->baseString = std::move(arg.baseString);
321 this->baseString.assign(arg);
330 this->baseString.assign(arg.baseString);
340 this->baseString.assign(arg.baseString, offset, count);
349 this->baseString.assign(arg);
358 this->baseString.assign(std::move(arg));
367 this->baseString.assign(pChars, count);
375 this->baseString.assign(pChars);
384 this->baseString.assign(count, c);
393 this->baseString.assign(first, last);
402 this->baseString.assign(first, last);
411 this->baseString.assign(first, last);
422 this->baseString.append(arg);
431 this->baseString.append(arg.baseString);
441 this->baseString.append(arg.baseString, offset, count);
450 this->baseString.append(pChars, count);
458 this->baseString.append(pChars);
467 this->baseString.append(count, c);
476 this->baseString.append(first, last);
485 this->baseString.append(first, last);
494 this->baseString.append(first, last);
506 return this->baseString.insert(where, arg);
515 this->baseString.insert(offset, arg.baseString);
527 this->baseString.insert(offset, arg.baseString, argOffset, count);
538 this->baseString.insert(offset, pChars, count);
548 this->baseString.insert(offset, pChars);
559 this->baseString.insert(offset, count, c);
569 return this->baseString.insert(where, c);
579 return this->baseString.insert(where, count, c);
589 return this->baseString.insert(where, first, last);
599 return this->baseString.insert(where, first, last);
609 return this->baseString.insert(where, first, last);
619 this->baseString.erase(offset);
629 this->baseString.erase(offset, count);
638 return this->baseString.erase(where);
647 return this->baseString.erase(first, last);
659 this->baseString.replace(first, last, chars);
670 this->baseString.replace(offset, length, arg.baseString);
683 this->baseString.replace(offset, length, arg.baseString, offsetArg, count);
695 this->baseString.replace(offset, length, pChars, offset, count);
706 this->baseString.replace(offset, length, pChars);
718 this->baseString.replace(offset, length, count, c);
729 this->baseString.replace(first, last, arg.baseString);
741 this->baseString.replace(first, last, pChars, count);
752 this->baseString.replace(first, last, pChars);
764 this->baseString.replace(first, last, count, c);
776 this->baseString.replace(first, last, first2, last2);
788 this->baseString.replace(first, last, first2, last2);
800 this->baseString.replace(first, last, first2, last2);
812 this->baseString.replace(first, last, first2, last2);
825 boost::replace_all(this->baseString, pattern.baseString, replacement.baseString);
836 return this->baseString.begin();
844 return this->baseString.begin();
852 return this->baseString.end();
860 return this->baseString.end();
869 return this->baseString.begin();
876 return this->baseString.begin();
883 return this->baseString.end();
890 return this->baseString.end();
897 return this->baseString.rbegin();
904 return this->baseString.rbegin();
911 return this->baseString.rend();
918 return this->baseString.rend();
925 return this->baseString.cbegin();
932 return this->baseString.cend();
939 return this->baseString.crbegin();
946 return this->baseString.crend();
952 this->baseString.shrink_to_fit();
959 this->baseString.push_back(c);
968 this->baseString.pop_back();
977 return this->baseString.front();
985 return this->baseString.front();
993 return this->baseString.back();
1001 return this->baseString.back();
1010 return this->baseString.at(offset);
1019 return this->baseString.at(offset);
1028 return this->baseString[offset];
1037 return this->baseString[offset];
1051 return this->baseString.length();
1063 return this->baseString.size();
1069 return this->baseString.max_size();
1081 return this->baseString.capacity();
1088 return this->baseString.empty();
1099 this->baseString.resize(newSize);
1111 this->baseString.resize(newSize, c);
1123 this->baseString.reserve(newCapacity);
1129 this->baseString.clear();
1140 return this->baseString.find(pattern.baseString, offset);
1150 return this->baseString.find(pChars, offset, count);
1159 return this->baseString.find(pChars, offset);
1168 return this->baseString.find(c, offset);
1177 return this->baseString.rfind(pattern.baseString, offset);
1187 return this->baseString.rfind(pChars, offset, count);
1196 return this->baseString.rfind(pChars, offset);
1205 return this->baseString.rfind(c, offset);
1214 return this->baseString.find_first_of(chars.baseString, offset);
1224 return this->baseString.find_first_of(pChars, offset, count);
1233 return this->baseString.find_first_of(pChars, offset);
1243 return this->baseString.find_first_of(c, offset);
1252 return this->baseString.find_last_of(chars.baseString, pos);
1262 return this->baseString.find_last_of(pChars, pos, count);
1271 return this->baseString.find_last_of(pChars, pos);
1281 return this->baseString.find_last_of(c, pos);
1290 return this->baseString.find_first_not_of(chars.baseString, offset);
1300 return this->baseString.find_first_not_of(pChars, offset, count);
1309 return this->baseString.find_first_not_of(pChars, offset);
1319 return this->baseString.find_first_not_of(c, offset);
1328 return this->baseString.find_last_not_of(chars.baseString, pos);
1338 return this->baseString.find_last_not_of(pChars, pos, count);
1347 return this->baseString.find_last_not_of(pChars, pos);
1357 return this->baseString.find_last_not_of(c, pos);
1371 return this->baseString.compare(other.baseString);
1385 return this->baseString.compare(offset, count, other.baseString);
1401 return this->baseString.compare(offset, count, other.baseString, offsetOther, countOther);
1413 return this->baseString.compare(pOther);
1427 return this->baseString.compare(offset, count, pOther);
1442 return this->baseString.compare(offset, count, pOther, countOther);
1452 return this->
Find(pChars) == 0;
1460 return this->
Find(pattern) == 0;
1476 size_t thisLength = this->baseString.length();
1477 size_t patternLength = pattern.baseString.length();
1479 if (thisLength < patternLength)
1484 return (this->baseString.compare(thisLength - patternLength, patternLength, pattern.baseString) == 0);
1492 template<
typename... Args>
1502 template<
typename... Args>
1513 return this->baseString;
1520 return this->baseString.c_str();
1527 return this->baseString.data();
1534 return this->baseString;
1543 return SelfType(this->baseString.substr(offset, count));
1550 return this->baseString.get_allocator();
1557 this->baseString.swap(other.baseString);
1564 return Bytes(
reinterpret_cast<const byte*
>(this->
CStr()),
reinterpret_cast<const byte*
>(this->
CStr() + this->
Size()));
1571 auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
1573 return !std::isspace<char>(c, std::locale::classic());
1575 return SelfType(left, this->baseString.end());
1582 auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
1584 return !std::isspace<char>(c, std::locale::classic());
1586 return SelfType(this->baseString.begin(), right.base());
1593 auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
1595 return !std::isspace<char>(c, std::locale::classic());
1599 if (left == this->baseString.end())
1604 auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
1606 return !std::isspace<char>(c, std::locale::classic());
1608 return SelfType(left, right.base());
1616 Tokens Split(
char delimiter,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const
1618 char delimiters[] = { delimiter };
1619 return this->
Split(delimiters, 1, trimTokens, removeEmptyTokens);
1628 Tokens Split(
const char delimiters[],
size_t delimitersCount,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const
1633 size_t length = this->
Length();
1635 for (
size_t first = 0; first < length; first = last + 1)
1637 size_t position = this->
FindFirstOf(delimiters, first, delimitersCount);
1638 last = (position !=
NPos) ? position : this->
Length();
1643 token = token.
Trim();
1645 if (!removeEmptyTokens || !token.
IsEmpty())
1647 tokens.push_back(token);
1651 if (!removeEmptyTokens && (this->
FindLastOf(delimiters,
NPos, delimitersCount) == (length - 1)))
1653 tokens.push_back(
Empty);
1669 size_t length = this->
Length();
1670 size_t delimiterLength = delimiter.
Length();
1672 for (
size_t first = 0; first < length; first = last + delimiterLength)
1674 size_t position = this->
Find(delimiter, first);
1675 last = (position !=
NPos) ? position : length;
1680 token = token.
Trim();
1682 if (!token.
IsEmpty() || !removeEmptyTokens)
1684 tokens.push_back(token);
1688 if (!removeEmptyTokens && this->
EndWith(delimiter))
1690 tokens.push_back(
Empty);
1708template <
class CharType,
class Alloc>
1711template <
class CharType,
class Alloc>
1720template<
class CharType,
class Alloc>
1730template<
class CharType,
class Alloc>
1741template<
class CharType,
class Alloc>
1744 std::basic_string<CharType, std::char_traits<CharType>, Alloc> baseString;
1746 right.
Assign(baseString);
1754template<
class CharType,
class Alloc>
1766template<
class CharType,
class Alloc>
1768 const CharType* left,
1778template<
class CharType,
class Alloc>
1780 const CharType left,
1790template<
class CharType,
class Alloc>
1793 const CharType* right)
1802template<
class CharType,
class Alloc>
1805 const CharType right)
1814template<
class CharType,
class Alloc>
1826template<
class CharType,
class Alloc>
1831 return (std::move(left.Append(right)));
1838template<
class CharType,
class Alloc>
1843 return left.GetBaseString() + right.GetBaseString();
1850template<
class CharType,
class Alloc>
1852 const CharType* left,
1855 return left + right.GetBaseString();
1862template<
class CharType,
class Alloc>
1864 const CharType left,
1867 return left + right.GetBaseString();
1874template<
class CharType,
class Alloc>
1877 const CharType* right)
1879 return left.GetBaseString() + right;
1886template<
class CharType,
class Alloc>
1889 const CharType right)
1891 return left.GetBaseString() + right;
1898template<
class CharType,
class Alloc>
1910template<
class CharType,
class Alloc>
1912 const CharType* left,
1922template<
class CharType,
class Alloc>
1925 const CharType* right)
1934template<
class CharType,
class Alloc>
1939 return (!(left == right));
1946template<
class CharType,
class Alloc>
1948 const CharType *left,
1951 return (!(left == right));
1958template<
class CharType,
class Alloc>
1961 const CharType* right)
1963 return (!(left == right));
1970template<
class CharType,
class Alloc>
1982template<
class CharType,
class Alloc>
1984 const CharType* left,
1994template<
class CharType,
class Alloc>
1997 const CharType* right)
2006template<
class CharType,
class Alloc>
2011 return (right < left);
2018template<
class CharType,
class Alloc>
2020 const CharType* left,
2023 return (right < left);
2030template<
class CharType,
class Alloc>
2033 const CharType* right)
2035 return (right < left);
2042template<
class CharType,
class Alloc>
2047 return (!(right < left));
2054template<
class CharType,
class Alloc>
2056 const CharType* left,
2059 return (!(right < left));
2066template<
class CharType,
class Alloc>
2069 const CharType* right)
2071 return (!(right < left));
2078template<
class CharType,
class Alloc>
2083 return (!(left < right));
2090template<
class CharType,
class Alloc>
2092 const CharType* left,
2095 return (!(left < right));
2102template<
class CharType,
class Alloc>
2105 const CharType* right)
2107 return (!(left < right));
2120template<
class C,
class Alloc>
2121struct hash<
Arp::BasicString<C, Alloc>>
Definition: BasicString.hxx:34
size_type FindLastOf(const CharType *pChars, size_type pos, size_type count) const
Finds the last occurence of any character in pChars .
Definition: BasicString.hxx:1260
SelfType & Assign(const CharType *pChars, size_type count)
This operation copies the as argument passed C-string partially.
Definition: BasicString.hxx:365
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:239
typename AllocatorTraits::pointer pointer
The pointer type of this type.
Definition: BasicString.hxx:51
const_reverse_iterator ConstReverseBegin() const
Returns the begin iterator of this const string for reverse iterating.
Definition: BasicString.hxx:937
typename BaseString::const_iterator const_iterator
The const iterator type of this type.
Definition: BasicString.hxx:54
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:1288
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:1493
SelfType & Insert(size_type offset, const SelfType &arg)
This operation inserts the the argument at the given position.
Definition: BasicString.hxx:513
typename AllocatorTraits::const_pointer const_pointer
The const pointer type of this type.
Definition: BasicString.hxx:52
typename BaseString::size_type size_type
The size type of this type.
Definition: BasicString.hxx:47
size_type FindFirstOf(const CharType *pChars, size_type offset=0) const
Finds the first occurence of any character in pChars .
Definition: BasicString.hxx:1231
BasicString(const CharType *pChars, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:130
BasicString< CharType, Allocator > SelfType
The self type.
Definition: BasicString.hxx:39
SelfType TrimLeft() const
Removes left appended white-spaces from this string
Definition: BasicString.hxx:1569
SelfType & operator+=(const CharType *right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:290
const_reference At(size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1017
C CharType
The character type.
Definition: BasicString.hxx:38
SelfType & Insert(size_type offset, const CharType *pChars, size_type count)
This operation inserts the as argument passed string partially.
Definition: BasicString.hxx:536
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:1616
bool IsEmpty() const
Determines if this string is empty.
Definition: BasicString.hxx:1086
size_type ReverseFind(CharType c, size_type offset=NPos) const
Finds the last char which equal to c .
Definition: BasicString.hxx:1203
iterator Erase(const_iterator where)
This operation erases a char from a string.
Definition: BasicString.hxx:636
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:176
BasicString(const BaseString &arg)
This copy constructor copies the as argument passed std::string to this string.
Definition: BasicString.hxx:200
const_reverse_iterator ConstReverseEnd() const
Returns the end iterator of this const string for reverse iterating.
Definition: BasicString.hxx:944
iterator Insert(const_iterator where, const_iterator first, const_iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:597
SelfType & Assign(size_type count, CharType c)
Fills this string with count consecutive copies of character c .
Definition: BasicString.hxx:382
SelfType & Assign(const SelfType &arg, size_type offset, size_type count=NPos)
This operation copies the as argument passed string partially.
Definition: BasicString.hxx:338
SelfType & operator=(SelfType &&right) noexcept=default
This move assignment operator moves the right-hand-side operand to this string.
SelfType & Replace(size_type offset, size_type length, const SelfType &arg)
Replaces a range of chars.
Definition: BasicString.hxx:668
SelfType & operator=(CharType c)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:262
SelfType & Replace(size_type offset, size_type length, size_type count, CharType c)
Replaces a range of chars by a character.
Definition: BasicString.hxx:716
const_iterator ConstBegin() const
Returns the begin iterator of this const string.
Definition: BasicString.hxx:923
size_type Find(CharType c, size_type offset=0) const
Finds the first char which equal to c .
Definition: BasicString.hxx:1166
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:1755
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:750
typename BaseString::const_reverse_iterator const_reverse_iterator
The const reverse iterator type of this type.
Definition: BasicString.hxx:56
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:504
size_type FindLastOf(const SelfType &chars, size_type pos=NPos) const
Finds the last occurence of any character in chars .
Definition: BasicString.hxx:1250
bool EndWith(const CharType *pChars) const
Determines if this string ends with the pChars C-string.
Definition: BasicString.hxx:1466
Allocator GetAllocator() const
Gets the allocator of this string.
Definition: BasicString.hxx:1548
SelfType & Replace(size_type offset, size_type length, const CharType *pChars)
Replaces a range of chars.
Definition: BasicString.hxx:704
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:420
void Reserve(size_type newCapacity=0)
Reserves memory upto the specified newCapacity .
Definition: BasicString.hxx:1121
SelfType Substr(size_type offset=0, size_type count=NPos) const
Gets a substring of this string.
Definition: BasicString.hxx:1541
typename BaseString::difference_type difference_type
The difference type of this type.
Definition: BasicString.hxx:48
SelfType & Erase(size_type offset=0)
This operation erases chars from this string.
Definition: BasicString.hxx:617
SelfType & Erase(size_type offset, size_type count)
This operation erases chars from this string.
Definition: BasicString.hxx:627
SelfType & Append(iterator first, iterator last)
Appends the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:474
reference operator[](size_type offset)
Returns a reference to the character at position offset .
Definition: BasicString.hxx:1026
SelfType & Replace(const_iterator first, const_iterator last, std::initializer_list< CharType > chars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:657
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:1503
SelfType & Replace(const_iterator first, const_iterator last, const_iterator first2, const_iterator last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:786
int Compare(const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1369
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:1721
const_iterator Begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:874
bool operator<=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2043
const_reverse_iterator ReverseBegin() const
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:902
bool operator>(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2007
void PushBack(CharType c)
Appends the character c to this string.
Definition: BasicString.hxx:957
BasicString(BaseString &&arg)
This move constructor moves the as argument passed std::string to this string.
Definition: BasicString.hxx:207
void Clear()
Clears the content of this string, but does not modify the capacity.
Definition: BasicString.hxx:1127
SelfType & Assign(const CharType *pChars)
This operation copies the as argument passed C-string.
Definition: BasicString.hxx:373
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:1307
size_type MaxSize() const
Returns the number maximum size any string might have.
Definition: BasicString.hxx:1067
SelfType Trim() const
Removes left and rigth appended white-spaces from this string
Definition: BasicString.hxx:1591
int Compare(const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1411
void Swap(SelfType &other)
Swaps the content of this string with the content of the other string.
Definition: BasicString.hxx:1555
SelfType & Assign(const SelfType &arg)
This operation copies the the argument to this string.
Definition: BasicString.hxx:328
iterator Insert(const_iterator where, iterator first, iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:587
SelfType & Replace(const_iterator first, const_iterator last, size_type count, CharType c)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:762
iterator begin()
Returns the begin iterator of this string.
Definition: BasicString.hxx:834
BasicString(const SelfType &arg, size_type offset, size_type count=NPos)
This constructor copies the as argument passed string partially.
Definition: BasicString.hxx:88
SelfType & Append(const SelfType &arg, size_type offset, size_type count=NPos)
This operation appends the as argument passed string partially.
Definition: BasicString.hxx:439
SelfType & operator=(const SelfType &right)=default
This assignment operator copies the the right-hand-side operand to this string.
iterator Begin()
Returns the begin iterator of this string.
Definition: BasicString.hxx:867
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:220
reverse_iterator ReverseEnd()
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:909
const_iterator end() const
Returns the end iterator of this string.
Definition: BasicString.hxx:858
SelfType & Assign(const BaseString &arg)
This operation copies the argument to this string.
Definition: BasicString.hxx:347
size_type Find(const SelfType &pattern, size_type offset=0) const
Finds the first substring which equal to pattern .
Definition: BasicString.hxx:1138
size_type FindLastNotOf(const CharType *pChars, size_type pos, size_type count) const
Finds the last occurence of any character which is not in pChars .
Definition: BasicString.hxx:1336
size_type FindLastNotOf(const SelfType &chars, size_type pos=NPos) const
Finds the last occurence of any character which is not in chars .
Definition: BasicString.hxx:1326
BasicString(const CharType *pChars, size_type count)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:106
bool operator<(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1971
size_type ReverseFind(const CharType *pChars, size_type offset=NPos) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1194
typename BaseString::reference reference
The reference type of this type.
Definition: BasicString.hxx:49
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:1222
SelfType & operator+=(CharType c)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:299
reverse_iterator ReverseBegin()
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:895
SelfType & Append(const CharType *pChars)
This operation appends the as argument passed C-string.
Definition: BasicString.hxx:456
std::ostream & operator<<(std::ostream &os, const BasicString< CharType, Alloc > &right)
Streams the right string to the outstream os .
Definition: BasicString.hxx:1731
SelfType & Replace(size_type offset, size_type length, const CharType *pChars, size_type count)
Replaces a range of chars.
Definition: BasicString.hxx:693
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars, size_type count)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:739
BasicString(const SelfType &arg)=default
The copy constructor copies the as argument passed string deeply.
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:483
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:409
int Compare(size_type offset, size_type count, const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1425
SelfType & Insert(size_type offset, size_type count, CharType c)
Inserts count consecutive copies of character c at position offset .
Definition: BasicString.hxx:557
iterator Insert(const_iterator where, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:567
reference Front()
Returns a reference to the first character in the string.
Definition: BasicString.hxx:975
BasicString(const CharType *pChars, size_type count, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:115
void Resize(size_type newSize, CharType c)
Resizes this string to the specified new size.
Definition: BasicString.hxx:1109
const_reference Back() const
Returns a const reference to the last character in the string.
Definition: BasicString.hxx:999
bool operator>=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2079
SelfType & Append(size_type count, CharType c)
Appends to this string count consecutive copies of character c .
Definition: BasicString.hxx:465
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:1628
BasicString(std::initializer_list< CharType > arg, const Allocator &alloc=Allocator())
Copies each of the characters in initList , in the same order.
Definition: BasicString.hxx:167
typename BaseString::iterator iterator
The iterator type of this type.
Definition: BasicString.hxx:53
size_type Find(const CharType *pChars, size_type offset=0) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1157
SelfType & Replace(const_iterator first, const_iterator last, const_pointer first2, const_pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:798
reference At(size_type offset)
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1008
void PopBack()
Removes the character at the end of this string.
Definition: BasicString.hxx:964
BasicString(const CharType *pChars)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:122
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:1317
const_reference operator[](size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1035
std::vector< SelfType > Tokens
Used by Split() operation.
Definition: BasicString.hxx:41
iterator Insert(const_iterator where, const_pointer first, const_pointer last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:607
BasicString(const Allocator &alloc)
This constructor creates an empty string instance.
Definition: BasicString.hxx:79
BasicString(SelfType &&arg) noexcept=default
This move constructor moves the as argument passed string to this string.
SelfType & Replace(const_iterator first, const_iterator last, iterator first2, iterator last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:774
SelfType & Append(const SelfType &arg)
This operation appends the the argument to this string.
Definition: BasicString.hxx:429
bool StartWith(const SelfType &pattern) const
Determines if this string starts with the pattern string.
Definition: BasicString.hxx:1458
size_type FindLastOf(const CharType *pChars, size_type pos=NPos) const
Finds the last occurence of any character in pChars .
Definition: BasicString.hxx:1269
size_type Length() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1049
size_type FindLastNotOf(const CharType *pChars, size_type pos=NPos) const
Finds the last occurence of any character which is not in pChars .
Definition: BasicString.hxx:1345
std::istream & operator>>(std::istream &is, BasicString< CharType, Alloc > &right)
Streams the instream is into the right string.
Definition: BasicString.hxx:1742
int Compare(size_type offset, size_type count, const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1383
typename BaseString::const_reference const_reference
The const reference type of this type.
Definition: BasicString.hxx:50
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:1935
bool EndWith(const SelfType &pattern) const
Determines if this string starts with the pattern string.
Definition: BasicString.hxx:1474
const CharType * CStr() const
Gets the character data of this string.
Definition: BasicString.hxx:1518
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:1298
const_reference Front() const
Returns a const reference to the first character in the string.
Definition: BasicString.hxx:983
Alloc Allocator
The characters allocator type.
Definition: BasicString.hxx:36
SelfType & ReplaceAll(const SelfType &pattern, const SelfType &replacement)
Replaces a given pattern by a replacement string.
Definition: BasicString.hxx:823
size_type ReverseFind(const CharType *pChars, size_type offset, size_type count) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1185
iterator Erase(const_iterator first, const_iterator last)
Erases a range of chars [first;last).
Definition: BasicString.hxx:645
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:185
SelfType & Replace(const_iterator first, const_iterator last, pointer first2, pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:810
Bytes ToBytes() const
Copies this string to a byte array.
Definition: BasicString.hxx:1562
SelfType & Assign(iterator first, iterator last)
Copies the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:391
iterator End()
Returns the end iterator of this string.
Definition: BasicString.hxx:881
SelfType & Assign(BaseString &&arg)
This operation moves the argument to this string.
Definition: BasicString.hxx:356
const_iterator ConstEnd() const
Returns the end iterator of this const string.
Definition: BasicString.hxx:930
BasicString(const Bytes &bytes, const Allocator &alloc=Allocator())
Copies the as arguments passed bytes to this string.
Definition: BasicString.hxx:193
const BaseString & GetBaseString() const
Gets the basic std string.
Definition: BasicString.hxx:1511
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:98
SelfType & Replace(const_iterator first, const_iterator last, const SelfType &arg)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:727
const_reverse_iterator ReverseEnd() const
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:916
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:1664
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:319
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:492
size_type FindLastOf(CharType c, size_type pos=NPos) const
Finds the last occurence of character c .
Definition: BasicString.hxx:1279
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:681
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:525
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:1399
SelfType & operator+=(const SelfType &right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:281
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:400
BasicString(size_type count, CharType c)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:138
BasicString()=default
The default constructor constructs an empty string instance.
size_type FindLastNotOf(CharType c, size_type pos=NPos) const
Finds the last occurence of any character which is not equal to c .
Definition: BasicString.hxx:1355
SelfType TrimRight() const
Removes right appended white-spaces from this string
Definition: BasicString.hxx:1580
~BasicString()=default
The destructor deallocates all memory of this instance.
static const SelfType NewLine
This static string instance represents the (platform specific) new line string.
Definition: BasicString.hxx:228
void ShrinkToFit()
Might reduce the capacity of this string to its size.
Definition: BasicString.hxx:950
iterator end()
Returns the end iterator of this string.
Definition: BasicString.hxx:850
bool StartWith(const CharType *pChars) const
Determines if this string starts with the pChars C-string.
Definition: BasicString.hxx:1450
size_type Find(const CharType *pChars, size_type offset, size_type count) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1148
static const SelfType Empty
An emtpy static string instance.
Definition: BasicString.hxx:224
SelfType & Append(const CharType *pChars, size_type count)
This operation appends the as argument passed C-string partially.
Definition: BasicString.hxx:448
size_type Capacity() const
Rceturns the capacity of this string.
Definition: BasicString.hxx:1079
size_type ReverseFind(const SelfType &pattern, size_type offset=NPos) const
Finds the last substring which equal to pattern .
Definition: BasicString.hxx:1175
reference Back()
Returns a reference to the last character in the string.
Definition: BasicString.hxx:991
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:1440
size_type Size() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1061
CharType value_type
The char type of this type.
Definition: BasicString.hxx:46
size_type FindFirstOf(CharType c, size_type offset=0) const
Finds the first occurence of character c .
Definition: BasicString.hxx:1241
Allocator allocator_type
The allocator type of this type.
Definition: BasicString.hxx:45
typename BaseString::reverse_iterator reverse_iterator
The reverse iterator type of this type.
Definition: BasicString.hxx:55
SelfType & Assign(SelfType &&arg)
This operation moves the as argument passed string to this string.
Definition: BasicString.hxx:310
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:1899
std::basic_string< CharType, std::char_traits< CharType >, Allocator > BaseString
The type of the basic std string.
Definition: BasicString.hxx:40
void Resize(size_type newSize)
Resizes this string to the specified new size.
Definition: BasicString.hxx:1097
const_iterator End() const
Returns the end iterator of this string.
Definition: BasicString.hxx:888
SelfType & Insert(size_type offset, const CharType *pChars)
This operation inserts the as argument passed string.
Definition: BasicString.hxx:546
BasicString(const SelfType &arg, const Allocator &alloc)
This constructor copies the as argument passed string deeply.
Definition: BasicString.hxx:72
BasicString(size_type count, CharType c, const Allocator &alloc)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:147
BasicString(SelfType &&arg, const Allocator &alloc)
This move constructor moves the as argument passed string to this string.
Definition: BasicString.hxx:159
const_iterator begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:842
std::vector< byte > Bytes
Conversion from and to byte array.
Definition: BasicString.hxx:42
size_type FindFirstOf(const SelfType &chars, size_type offset=0) const
Finds the first occurence of any character in chars .
Definition: BasicString.hxx:1212
SelfType & operator=(const CharType *right)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:253
iterator Insert(const_iterator where, size_type count, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:577
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:272
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:2136
size_t result_type
The result type of this functor class (stl policy type)
Definition: BasicString.hxx:2130
Arp::BasicString< C, Alloc > argument_type
The argument type of this functor class (stl policy type)
Definition: BasicString.hxx:2128