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>;
42 using Tokens = std::vector<SelfType>;
43 using Bytes = std::vector<byte>;
52 using pointer =
typename AllocatorTraits::pointer;
54 using iterator =
typename BaseString::iterator;
74 : baseString(arg.baseString, alloc)
90 : baseString(arg.baseString, offset, count)
100 : baseString(arg.baseString, offset, count, alloc)
108 : baseString(pChars, count)
117 : baseString(pChars, count, alloc)
132 : baseString(pChars, alloc)
140 : baseString(count, c)
149 : baseString(count, c, alloc)
161 : baseString(
std::move(arg.baseString), alloc)
169 : baseString(arg, alloc)
178 : baseString(first, last, alloc)
187 : baseString(first, last, alloc)
195 : baseString(reinterpret_cast<const char*>(bytes.data()), reinterpret_cast<const char*>(bytes.data() + bytes.size()), alloc)
209 : baseString(
std::move(arg))
242 this->baseString = right;
256 this->baseString = right;
265 this->baseString = c;
275 this->baseString += right;
284 this->baseString += right.baseString;
293 this->baseString += right;
302 this->baseString += c;
313 this->baseString = std::move(arg.baseString);
322 this->baseString.assign(arg);
331 this->baseString.assign(arg.baseString);
341 this->baseString.assign(arg.baseString, offset, count);
350 this->baseString.assign(arg);
359 this->baseString.assign(std::move(arg));
368 this->baseString.assign(pChars, count);
376 this->baseString.assign(pChars);
385 this->baseString.assign(count, c);
394 this->baseString.assign(first, last);
403 this->baseString.assign(first, last);
412 this->baseString.assign(first, last);
423 this->baseString.append(arg);
432 this->baseString.append(arg.baseString);
442 this->baseString.append(arg.baseString, offset, count);
451 this->baseString.append(pChars, count);
459 this->baseString.append(pChars);
468 this->baseString.append(count, c);
477 this->baseString.append(first, last);
486 this->baseString.append(first, last);
495 this->baseString.append(first, last);
507 return this->baseString.insert(where, arg);
516 this->baseString.insert(offset, arg.baseString);
528 this->baseString.insert(offset, arg.baseString, argOffset, count);
539 this->baseString.insert(offset, pChars, count);
549 this->baseString.insert(offset, pChars);
560 this->baseString.insert(offset, count, c);
570 return this->baseString.insert(where, c);
580 return this->baseString.insert(where, count, c);
590 return this->baseString.insert(where, first, last);
600 return this->baseString.insert(where, first, last);
610 return this->baseString.insert(where, first, last);
620 this->baseString.erase(offset);
630 this->baseString.erase(offset, count);
639 return this->baseString.erase(where);
648 return this->baseString.erase(first, last);
660 this->baseString.replace(first, last, chars);
671 this->baseString.replace(offset, length, arg.baseString);
684 this->baseString.replace(offset, length, arg.baseString, offsetArg, count);
696 this->baseString.replace(offset, length, pChars, offset, count);
707 this->baseString.replace(offset, length, pChars);
719 this->baseString.replace(offset, length, count, c);
730 this->baseString.replace(first, last, arg.baseString);
742 this->baseString.replace(first, last, pChars, count);
753 this->baseString.replace(first, last, pChars);
765 this->baseString.replace(first, last, count, c);
777 this->baseString.replace(first, last, first2, last2);
789 this->baseString.replace(first, last, first2, last2);
801 this->baseString.replace(first, last, first2, last2);
813 this->baseString.replace(first, last, first2, last2);
826 boost::replace_all(this->baseString, pattern.baseString, replacement.baseString);
837 return this->baseString.begin();
845 return this->baseString.begin();
853 return this->baseString.end();
861 return this->baseString.end();
870 return this->baseString.begin();
877 return this->baseString.begin();
884 return this->baseString.end();
891 return this->baseString.end();
898 return this->baseString.rbegin();
905 return this->baseString.rbegin();
912 return this->baseString.rend();
919 return this->baseString.rend();
926 return this->baseString.cbegin();
933 return this->baseString.cend();
940 return this->baseString.crbegin();
947 return this->baseString.crend();
953 this->baseString.shrink_to_fit();
960 this->baseString.push_back(c);
969 this->baseString.pop_back();
978 return this->baseString.front();
986 return this->baseString.front();
994 return this->baseString.back();
1002 return this->baseString.back();
1011 return this->baseString.at(offset);
1020 return this->baseString.at(offset);
1029 return this->baseString[offset];
1038 return this->baseString[offset];
1052 return this->baseString.length();
1064 return this->baseString.size();
1070 return this->baseString.max_size();
1082 return this->baseString.capacity();
1089 return this->baseString.empty();
1100 this->baseString.resize(newSize);
1112 this->baseString.resize(newSize, c);
1124 this->baseString.reserve(newCapacity);
1130 this->baseString.clear();
1141 return this->baseString.find(pattern.baseString, offset);
1151 return this->baseString.find(pChars, offset, count);
1160 return this->baseString.find(pChars, offset);
1169 return this->baseString.find(c, offset);
1178 return this->baseString.rfind(pattern.baseString, offset);
1188 return this->baseString.rfind(pChars, offset, count);
1197 return this->baseString.rfind(pChars, offset);
1206 return this->baseString.rfind(c, offset);
1215 return this->baseString.find_first_of(chars.baseString, offset);
1225 return this->baseString.find_first_of(pChars, offset, count);
1234 return this->baseString.find_first_of(pChars, offset);
1244 return this->baseString.find_first_of(c, offset);
1253 return this->baseString.find_last_of(chars.baseString, pos);
1263 return this->baseString.find_last_of(pChars, pos, count);
1272 return this->baseString.find_last_of(pChars, pos);
1282 return this->baseString.find_last_of(c, pos);
1291 return this->baseString.find_first_not_of(chars.baseString, offset);
1301 return this->baseString.find_first_not_of(pChars, offset, count);
1310 return this->baseString.find_first_not_of(pChars, offset);
1320 return this->baseString.find_first_not_of(c, offset);
1329 return this->baseString.find_last_not_of(chars.baseString, pos);
1339 return this->baseString.find_last_not_of(pChars, pos, count);
1348 return this->baseString.find_last_not_of(pChars, pos);
1358 return this->baseString.find_last_not_of(c, pos);
1372 return this->baseString.compare(other.baseString);
1386 return this->baseString.compare(offset, count, other.baseString);
1402 return this->baseString.compare(offset, count, other.baseString, offsetOther, countOther);
1414 return this->baseString.compare(pOther);
1428 return this->baseString.compare(offset, count, pOther);
1443 return this->baseString.compare(offset, count, pOther, countOther);
1453 return this->
Find(pChars) == 0;
1461 return this->
Find(pattern) == 0;
1477 size_t thisLength = this->baseString.length();
1478 size_t patternLength = pattern.baseString.length();
1480 if (thisLength < patternLength)
1485 return (this->baseString.compare(thisLength - patternLength, patternLength, pattern.baseString) == 0);
1493 template<
typename... Args>
1503 template<
typename... Args>
1515 return this->baseString;
1522 return this->baseString;
1529 return this->baseString.c_str();
1536 return this->baseString.data();
1543 return this->baseString;
1552 return SelfType(this->baseString.substr(offset, count));
1559 return this->baseString.get_allocator();
1566 this->baseString.swap(other.baseString);
1573 return Bytes(
reinterpret_cast<const byte*
>(this->
CStr()),
reinterpret_cast<const byte*
>(this->
CStr() + this->
Size()));
1580 auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
1582 return !std::isspace<char>(c, std::locale::classic());
1584 return SelfType(left, this->baseString.end());
1591 auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
1593 return !std::isspace<char>(c, std::locale::classic());
1595 return SelfType(this->baseString.begin(), right.base());
1602 auto left = std::find_if(this->baseString.begin(), this->baseString.end(), [](
char c)
1604 return !std::isspace<char>(c, std::locale::classic());
1608 if (left == this->baseString.end())
1613 auto right = std::find_if(this->baseString.rbegin(), this->baseString.rend(), [](
char c)
1615 return !std::isspace<char>(c, std::locale::classic());
1617 return SelfType(left, right.base());
1625 Tokens Split(
char delimiter,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const
1627 char delimiters[] = { delimiter };
1628 return this->
Split(delimiters, 1, trimTokens, removeEmptyTokens);
1637 Tokens Split(
const char delimiters[],
size_t delimitersCount,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const
1642 size_t length = this->
Length();
1644 for (
size_t first = 0; first < length; first = last + 1)
1646 size_t position = this->
FindFirstOf(delimiters, first, delimitersCount);
1647 last = (position !=
NPos) ? position : this->
Length();
1652 token = token.
Trim();
1654 if (!removeEmptyTokens || !token.
IsEmpty())
1656 tokens.push_back(token);
1660 if (!removeEmptyTokens && (this->
FindLastOf(delimiters,
NPos, delimitersCount) == (length - 1)))
1662 tokens.push_back(
Empty);
1678 size_t length = this->
Length();
1679 size_t delimiterLength = delimiter.
Length();
1681 for (
size_t first = 0; first < length; first = last + delimiterLength)
1683 size_t position = this->
Find(delimiter, first);
1684 last = (position !=
NPos) ? position : length;
1689 token = token.
Trim();
1691 if (!token.
IsEmpty() || !removeEmptyTokens)
1693 tokens.push_back(token);
1697 if (!removeEmptyTokens && this->
EndWith(delimiter))
1699 tokens.push_back(
Empty);
1717template <
class CharType,
class Alloc>
1720template <
class CharType,
class Alloc>
1729template<
class CharType,
class Alloc>
1739template<
class CharType,
class Alloc>
1750template<
class CharType,
class Alloc>
1753 std::basic_string<CharType, std::char_traits<CharType>, Alloc> baseString;
1755 right.
Assign(baseString);
1763template<
class CharType,
class Alloc>
1775template<
class CharType,
class Alloc>
1777 const CharType* left,
1787template<
class CharType,
class Alloc>
1789 const CharType left,
1799template<
class CharType,
class Alloc>
1802 const CharType* right)
1811template<
class CharType,
class Alloc>
1814 const CharType right)
1823template<
class CharType,
class Alloc>
1835template<
class CharType,
class Alloc>
1840 return (std::move(left.Append(right)));
1847template<
class CharType,
class Alloc>
1852 return left.GetStdString() + right.GetStdString();
1859template<
class CharType,
class Alloc>
1861 const CharType* left,
1864 return left + right.GetStdString();
1871template<
class CharType,
class Alloc>
1873 const CharType left,
1876 return left + right.GetStdString();
1883template<
class CharType,
class Alloc>
1886 const CharType* right)
1888 return left.GetStdString() + right;
1895template<
class CharType,
class Alloc>
1898 const CharType right)
1900 return left.GetStdString() + right;
1907template<
class CharType,
class Alloc>
1919template<
class CharType,
class Alloc>
1921 const CharType* left,
1931template<
class CharType,
class Alloc>
1934 const CharType* right)
1943template<
class CharType,
class Alloc>
1948 return (!(left == right));
1955template<
class CharType,
class Alloc>
1957 const CharType *left,
1960 return (!(left == right));
1967template<
class CharType,
class Alloc>
1970 const CharType* right)
1972 return (!(left == right));
1979template<
class CharType,
class Alloc>
1991template<
class CharType,
class Alloc>
1993 const CharType* left,
2003template<
class CharType,
class Alloc>
2006 const CharType* right)
2015template<
class CharType,
class Alloc>
2020 return (right < left);
2027template<
class CharType,
class Alloc>
2029 const CharType* left,
2032 return (right < left);
2039template<
class CharType,
class Alloc>
2042 const CharType* right)
2044 return (right < left);
2051template<
class CharType,
class Alloc>
2056 return (!(right < left));
2063template<
class CharType,
class Alloc>
2065 const CharType* left,
2068 return (!(right < left));
2075template<
class CharType,
class Alloc>
2078 const CharType* right)
2080 return (!(right < left));
2087template<
class CharType,
class Alloc>
2092 return (!(left < right));
2099template<
class CharType,
class Alloc>
2101 const CharType* left,
2104 return (!(left < right));
2111template<
class CharType,
class Alloc>
2114 const CharType* right)
2116 return (!(left < right));
2129template<
class C,
class Alloc>
2130struct 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:1261
SelfType & Assign(const CharType *pChars, size_type count)
This operation copies the as argument passed C-string partially.
Definition: BasicString.hxx:366
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:240
typename AllocatorTraits::pointer pointer
The pointer type of this type.
Definition: BasicString.hxx:52
const_reverse_iterator ConstReverseBegin() const
Returns the begin iterator of this const string for reverse iterating.
Definition: BasicString.hxx:938
typename BaseString::const_iterator const_iterator
The const iterator type of this type.
Definition: BasicString.hxx:55
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:1289
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:1494
SelfType & Insert(size_type offset, const SelfType &arg)
This operation inserts the the argument at the given position.
Definition: BasicString.hxx:514
typename AllocatorTraits::const_pointer const_pointer
The const pointer type of this type.
Definition: BasicString.hxx:53
typename BaseString::size_type size_type
The size type of this type.
Definition: BasicString.hxx:48
size_type FindFirstOf(const CharType *pChars, size_type offset=0) const
Finds the first occurence of any character in pChars .
Definition: BasicString.hxx:1232
BasicString(const CharType *pChars, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:131
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:1578
SelfType & operator+=(const CharType *right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:291
const_reference At(size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1018
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:537
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:1625
bool IsEmpty() const
Determines if this string is empty.
Definition: BasicString.hxx:1087
size_type ReverseFind(CharType c, size_type offset=NPos) const
Finds the last char which equal to c .
Definition: BasicString.hxx:1204
iterator Erase(const_iterator where)
This operation erases a char from a string.
Definition: BasicString.hxx:637
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:177
BasicString(const BaseString &arg)
This copy constructor copies the as argument passed std::string to this string.
Definition: BasicString.hxx:201
const_reverse_iterator ConstReverseEnd() const
Returns the end iterator of this const string for reverse iterating.
Definition: BasicString.hxx:945
iterator Insert(const_iterator where, const_iterator first, const_iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:598
SelfType & Assign(size_type count, CharType c)
Fills this string with count consecutive copies of character c .
Definition: BasicString.hxx:383
SelfType & Assign(const SelfType &arg, size_type offset, size_type count=NPos)
This operation copies the as argument passed string partially.
Definition: BasicString.hxx:339
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:669
SelfType & operator=(CharType c)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:263
SelfType & Replace(size_type offset, size_type length, size_type count, CharType c)
Replaces a range of chars by a character.
Definition: BasicString.hxx:717
const_iterator ConstBegin() const
Returns the begin iterator of this const string.
Definition: BasicString.hxx:924
size_type Find(CharType c, size_type offset=0) const
Finds the first char which equal to c .
Definition: BasicString.hxx:1167
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:1764
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:751
typename BaseString::const_reverse_iterator const_reverse_iterator
The const reverse iterator type of this type.
Definition: BasicString.hxx:57
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:505
size_type FindLastOf(const SelfType &chars, size_type pos=NPos) const
Finds the last occurence of any character in chars .
Definition: BasicString.hxx:1251
bool EndWith(const CharType *pChars) const
Determines if this string ends with the pChars C-string.
Definition: BasicString.hxx:1467
Allocator GetAllocator() const
Gets the allocator of this string.
Definition: BasicString.hxx:1557
SelfType & Replace(size_type offset, size_type length, const CharType *pChars)
Replaces a range of chars.
Definition: BasicString.hxx:705
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:421
void Reserve(size_type newCapacity=0)
Reserves memory upto the specified newCapacity .
Definition: BasicString.hxx:1122
SelfType Substr(size_type offset=0, size_type count=NPos) const
Gets a substring of this string.
Definition: BasicString.hxx:1550
typename BaseString::difference_type difference_type
The difference type of this type.
Definition: BasicString.hxx:49
SelfType & Erase(size_type offset=0)
This operation erases chars from this string.
Definition: BasicString.hxx:618
SelfType & Erase(size_type offset, size_type count)
This operation erases chars from this string.
Definition: BasicString.hxx:628
SelfType & Append(iterator first, iterator last)
Appends the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:475
reference operator[](size_type offset)
Returns a reference to the character at position offset .
Definition: BasicString.hxx:1027
SelfType & Replace(const_iterator first, const_iterator last, std::initializer_list< CharType > chars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:658
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:1504
SelfType & Replace(const_iterator first, const_iterator last, const_iterator first2, const_iterator last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:787
int Compare(const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1370
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:1730
const_iterator Begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:875
bool operator<=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2052
const_reverse_iterator ReverseBegin() const
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:903
bool operator>(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2016
void PushBack(CharType c)
Appends the character c to this string.
Definition: BasicString.hxx:958
BasicString(BaseString &&arg)
This move constructor moves the as argument passed std::string to this string.
Definition: BasicString.hxx:208
void Clear()
Clears the content of this string, but does not modify the capacity.
Definition: BasicString.hxx:1128
SelfType & Assign(const CharType *pChars)
This operation copies the as argument passed C-string.
Definition: BasicString.hxx:374
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:1308
size_type MaxSize() const
Returns the number maximum size any string might have.
Definition: BasicString.hxx:1068
SelfType Trim() const
Removes left and rigth appended white-spaces from this string
Definition: BasicString.hxx:1600
int Compare(const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1412
void Swap(SelfType &other)
Swaps the content of this string with the content of the other string.
Definition: BasicString.hxx:1564
SelfType & Assign(const SelfType &arg)
This operation copies the the argument to this string.
Definition: BasicString.hxx:329
iterator Insert(const_iterator where, iterator first, iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:588
SelfType & Replace(const_iterator first, const_iterator last, size_type count, CharType c)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:763
iterator begin()
Returns the begin iterator of this string.
Definition: BasicString.hxx:835
BasicString(const SelfType &arg, size_type offset, size_type count=NPos)
This constructor copies the as argument passed string partially.
Definition: BasicString.hxx:89
SelfType & Append(const SelfType &arg, size_type offset, size_type count=NPos)
This operation appends the as argument passed string partially.
Definition: BasicString.hxx:440
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:868
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:221
reverse_iterator ReverseEnd()
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:910
const_iterator end() const
Returns the end iterator of this string.
Definition: BasicString.hxx:859
SelfType & Assign(const BaseString &arg)
This operation copies the argument to this string.
Definition: BasicString.hxx:348
size_type Find(const SelfType &pattern, size_type offset=0) const
Finds the first substring which equal to pattern .
Definition: BasicString.hxx:1139
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:1337
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:1327
BasicString(const CharType *pChars, size_type count)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:107
bool operator<(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1980
size_type ReverseFind(const CharType *pChars, size_type offset=NPos) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1195
typename BaseString::reference reference
The reference type of this type.
Definition: BasicString.hxx:50
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:1223
SelfType & operator+=(CharType c)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:300
reverse_iterator ReverseBegin()
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:896
SelfType & Append(const CharType *pChars)
This operation appends the as argument passed C-string.
Definition: BasicString.hxx:457
std::ostream & operator<<(std::ostream &os, const BasicString< CharType, Alloc > &right)
Streams the right string to the outstream os .
Definition: BasicString.hxx:1740
SelfType & Replace(size_type offset, size_type length, const CharType *pChars, size_type count)
Replaces a range of chars.
Definition: BasicString.hxx:694
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars, size_type count)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:740
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:484
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:410
int Compare(size_type offset, size_type count, const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1426
SelfType & Insert(size_type offset, size_type count, CharType c)
Inserts count consecutive copies of character c at position offset .
Definition: BasicString.hxx:558
iterator Insert(const_iterator where, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:568
reference Front()
Returns a reference to the first character in the string.
Definition: BasicString.hxx:976
BasicString(const CharType *pChars, size_type count, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:116
void Resize(size_type newSize, CharType c)
Resizes this string to the specified new size.
Definition: BasicString.hxx:1110
const_reference Back() const
Returns a const reference to the last character in the string.
Definition: BasicString.hxx:1000
bool operator>=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:2088
SelfType & Append(size_type count, CharType c)
Appends to this string count consecutive copies of character c .
Definition: BasicString.hxx:466
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:1637
BasicString(std::initializer_list< CharType > arg, const Allocator &alloc=Allocator())
Copies each of the characters in initList , in the same order.
Definition: BasicString.hxx:168
typename BaseString::iterator iterator
The iterator type of this type.
Definition: BasicString.hxx:54
size_type Find(const CharType *pChars, size_type offset=0) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1158
SelfType & Replace(const_iterator first, const_iterator last, const_pointer first2, const_pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:799
reference At(size_type offset)
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1009
void PopBack()
Removes the character at the end of this string.
Definition: BasicString.hxx:965
BasicString(const CharType *pChars)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:123
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:1318
const_reference operator[](size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1036
const StdString & GetStdString() const
Gets the basic std string.
Definition: BasicString.hxx:1520
std::vector< SelfType > Tokens
Used by Split() operation.
Definition: BasicString.hxx:42
iterator Insert(const_iterator where, const_pointer first, const_pointer last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:608
BasicString(const Allocator &alloc)
This constructor creates an empty string instance.
Definition: BasicString.hxx:80
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:775
SelfType & Append(const SelfType &arg)
This operation appends the the argument to this string.
Definition: BasicString.hxx:430
bool StartWith(const SelfType &pattern) const
Determines if this string starts with the pattern string.
Definition: BasicString.hxx:1459
size_type FindLastOf(const CharType *pChars, size_type pos=NPos) const
Finds the last occurence of any character in pChars .
Definition: BasicString.hxx:1270
size_type Length() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1050
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:1346
std::istream & operator>>(std::istream &is, BasicString< CharType, Alloc > &right)
Streams the instream is into the right string.
Definition: BasicString.hxx:1751
int Compare(size_type offset, size_type count, const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1384
typename BaseString::const_reference const_reference
The const reference type of this type.
Definition: BasicString.hxx:51
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:1944
bool EndWith(const SelfType &pattern) const
Determines if this string starts with the pattern string.
Definition: BasicString.hxx:1475
const CharType * CStr() const
Gets the character data of this string.
Definition: BasicString.hxx:1527
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:1299
const_reference Front() const
Returns a const reference to the first character in the string.
Definition: BasicString.hxx:984
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:824
size_type ReverseFind(const CharType *pChars, size_type offset, size_type count) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1186
iterator Erase(const_iterator first, const_iterator last)
Erases a range of chars [first;last).
Definition: BasicString.hxx:646
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:186
SelfType & Replace(const_iterator first, const_iterator last, pointer first2, pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:811
Bytes ToBytes() const
Copies this string to a byte array.
Definition: BasicString.hxx:1571
SelfType & Assign(iterator first, iterator last)
Copies the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:392
iterator End()
Returns the end iterator of this string.
Definition: BasicString.hxx:882
SelfType & Assign(BaseString &&arg)
This operation moves the argument to this string.
Definition: BasicString.hxx:357
const_iterator ConstEnd() const
Returns the end iterator of this const string.
Definition: BasicString.hxx:931
BasicString(const Bytes &bytes, const Allocator &alloc=Allocator())
Copies the as arguments passed bytes to this string.
Definition: BasicString.hxx:194
const BaseString & GetBaseString() const
Gets the basic std string.
Definition: BasicString.hxx:1513
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:99
SelfType & Replace(const_iterator first, const_iterator last, const SelfType &arg)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:728
const_reverse_iterator ReverseEnd() const
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:917
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:1673
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:320
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:493
size_type FindLastOf(CharType c, size_type pos=NPos) const
Finds the last occurence of character c .
Definition: BasicString.hxx:1280
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:682
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:526
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:1400
SelfType & operator+=(const SelfType &right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:282
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:401
BasicString(size_type count, CharType c)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:139
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:1356
SelfType TrimRight() const
Removes right appended white-spaces from this string
Definition: BasicString.hxx:1589
~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:229
std::basic_string< CharType, std::char_traits< CharType >, Allocator > StdString
The type of the basic std string.
Definition: BasicString.hxx:41
void ShrinkToFit()
Might reduce the capacity of this string to its size.
Definition: BasicString.hxx:951
iterator end()
Returns the end iterator of this string.
Definition: BasicString.hxx:851
bool StartWith(const CharType *pChars) const
Determines if this string starts with the pChars C-string.
Definition: BasicString.hxx:1451
size_type Find(const CharType *pChars, size_type offset, size_type count) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1149
static const SelfType Empty
An emtpy static string instance.
Definition: BasicString.hxx:225
SelfType & Append(const CharType *pChars, size_type count)
This operation appends the as argument passed C-string partially.
Definition: BasicString.hxx:449
size_type Capacity() const
Rceturns the capacity of this string.
Definition: BasicString.hxx:1080
size_type ReverseFind(const SelfType &pattern, size_type offset=NPos) const
Finds the last substring which equal to pattern .
Definition: BasicString.hxx:1176
reference Back()
Returns a reference to the last character in the string.
Definition: BasicString.hxx:992
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:1441
size_type Size() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1062
CharType value_type
The char type of this type.
Definition: BasicString.hxx:47
size_type FindFirstOf(CharType c, size_type offset=0) const
Finds the first occurence of character c .
Definition: BasicString.hxx:1242
Allocator allocator_type
The allocator type of this type.
Definition: BasicString.hxx:46
typename BaseString::reverse_iterator reverse_iterator
The reverse iterator type of this type.
Definition: BasicString.hxx:56
SelfType & Assign(SelfType &&arg)
This operation moves the as argument passed string to this string.
Definition: BasicString.hxx:311
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:1908
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:1098
const_iterator End() const
Returns the end iterator of this string.
Definition: BasicString.hxx:889
SelfType & Insert(size_type offset, const CharType *pChars)
This operation inserts the as argument passed string.
Definition: BasicString.hxx:547
BasicString(const SelfType &arg, const Allocator &alloc)
This constructor copies the as argument passed string deeply.
Definition: BasicString.hxx:73
BasicString(size_type count, CharType c, const Allocator &alloc)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:148
BasicString(SelfType &&arg, const Allocator &alloc)
This move constructor moves the as argument passed string to this string.
Definition: BasicString.hxx:160
const_iterator begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:843
std::vector< byte > Bytes
Conversion from and to byte array.
Definition: BasicString.hxx:43
size_type FindFirstOf(const SelfType &chars, size_type offset=0) const
Finds the first occurence of any character in chars .
Definition: BasicString.hxx:1213
SelfType & operator=(const CharType *right)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:254
iterator Insert(const_iterator where, size_type count, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:578
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:273
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38
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:2145
size_t result_type
The result type of this functor class (stl policy type)
Definition: BasicString.hxx:2139
Arp::BasicString< C, Alloc > argument_type
The argument type of this functor class (stl policy type)
Definition: BasicString.hxx:2137