11 #include <initializer_list> 12 #include "boost/algorithm/string/replace.hpp" 13 #include "Arp/System/Core/BasicFormatter.hxx" 14 #include "Arp/System/Core/Impl/BasicStringFormatExceptionHandler.hpp" 16 #ifndef ARP_INSIDE_ARP_H 17 #error Never include 'BasicString.hxx' directly, just include 'Arp.h' 30 template<
class C,
class Alloc = std::allocator<C>>
37 typedef std::basic_string<CharType, std::char_traits<CharType>, Allocator>
BaseString;
46 typedef typename Allocator::pointer
pointer;
48 typedef typename BaseString::iterator
iterator;
66 : baseString(arg.baseString)
74 : baseString(arg.baseString, alloc)
90 : baseString(arg.baseString, offset, count)
99 BasicString(
const SelfType& arg, size_type offset, size_type count,
const Allocator& alloc)
100 : baseString(arg.baseString, offset, count, alloc)
108 : baseString(pChars, count)
116 BasicString(
const CharType* pChars, size_type count,
const Allocator& alloc)
117 : baseString(pChars, count, alloc)
132 : baseString(pChars, alloc)
140 : baseString(count, c)
149 : baseString(count, c, alloc)
156 : baseString(arg.baseString)
164 : baseString(arg.baseString, alloc)
172 : baseString(arg, alloc)
181 : baseString(first, last, alloc)
190 : baseString(first, last, alloc)
234 this->baseString = right.baseString;
241 SelfType&
operator=(std::initializer_list<CharType> right)
243 this->baseString = right;
252 this->baseString = right.baseString;
261 this->baseString = right;
270 this->baseString = c;
280 this->baseString += right;
289 this->baseString += right.baseString;
298 this->baseString += right;
307 this->baseString += c;
318 this->baseString = arg.baseString;
325 SelfType&
Assign(std::initializer_list<CharType> arg)
327 this->baseString.assign(arg);
336 this->baseString.assign(arg.baseString);
344 SelfType&
Assign(
const SelfType& arg, size_type offset, size_type count = NPos)
346 this->baseString.assign(arg.baseString, offset, count);
355 this->baseString.assign(arg);
364 this->baseString.assign(arg);
371 SelfType&
Assign(
const CharType* pChars, size_type count)
373 this->baseString.assign(pChars, count);
381 this->baseString.assign(pChars);
388 SelfType&
Assign(size_type count, CharType c)
390 this->baseString.assign(count, c);
397 SelfType&
Assign(iterator first, iterator last)
399 this->baseString.assign(first, last);
406 SelfType&
Assign(const_iterator first, const_iterator last)
408 this->baseString.assign(first, last);
415 SelfType&
Assign(const_pointer first, const_pointer last)
417 this->baseString.assign(first, last);
426 SelfType&
Append(std::initializer_list<CharType> arg)
428 this->baseString.append(arg);
437 this->baseString.append(arg.baseString);
445 SelfType&
Append(
const SelfType& arg, size_type offset, size_type count = NPos)
447 this->baseString.append(arg.baseString, offset, count);
454 SelfType&
Append(
const CharType* pChars, size_type count)
456 this->baseString.append(pChars, count);
464 this->baseString.append(pChars);
471 SelfType&
Append(size_type count, CharType c)
473 this->baseString.append(count, c);
480 SelfType&
Append(iterator first, iterator last)
482 this->baseString.append(first, last);
489 SelfType&
Append(const_iterator first, const_iterator last)
491 this->baseString.append(first, last);
498 SelfType&
Append(const_pointer first, const_pointer last)
500 this->baseString.append(first, last);
510 iterator
Insert(const_iterator where, std::initializer_list<CharType> arg)
512 return this->baseString.insert(where, arg);
519 SelfType&
Insert(size_type offset,
const SelfType& arg)
521 this->baseString.insert(offset, arg.baseString);
531 SelfType&
Insert(size_type offset,
const SelfType& arg, size_type argOffset, size_type count = NPos)
533 this->baseString.insert(offset, arg.baseString, argOffset, count);
542 SelfType&
Insert(size_type offset,
const CharType* pChars, size_type count)
544 this->baseString.insert(offset, pChars, count);
552 SelfType&
Insert(size_type offset,
const CharType* pChars)
554 this->baseString.insert(offset, pChars);
563 SelfType&
Insert(size_type offset, size_type count, CharType c)
565 this->baseString.insert(offset, count, c);
569 ARP_DEPRECATED(
"Do not use this operation, is is not part of the C++ standard and will be removed in future.")
573 return this->baseString.insert(where);
580 iterator
Insert(const_iterator where, CharType c)
582 return this->baseString.insert(where, c);
590 iterator
Insert(const_iterator where, size_type count, CharType c)
592 return this->baseString.insert(where, count, c);
600 iterator
Insert(const_iterator where, iterator first, iterator last)
602 return this->baseString.insert(where, first, last);
610 iterator
Insert(const_iterator where, const_iterator first, const_iterator last)
612 return this->baseString.insert(where, first, last);
620 iterator
Insert(const_iterator where, const_pointer first, const_pointer last)
622 return this->baseString.insert(where, first, last);
630 SelfType&
Erase(size_type offset = 0)
632 this->baseString.erase(offset);
640 SelfType&
Erase(size_type offset, size_type count)
642 this->baseString.erase(offset, count);
649 iterator
Erase(const_iterator where)
651 return this->baseString.erase(where);
658 iterator
Erase(const_iterator first, const_iterator last)
660 return this->baseString.erase(first, last);
670 SelfType&
Replace(const_iterator first, const_iterator last, std::initializer_list<CharType> chars)
672 this->baseString.replace(first, last, chars);
681 SelfType&
Replace(size_type offset, size_type length,
const SelfType& arg)
683 this->baseString.replace(offset, length, arg.baseString);
694 SelfType&
Replace(size_type offset, size_type length,
const SelfType& arg, size_type offsetArg, size_type count =
NPos)
696 this->baseString.replace(offset, length, arg.baseString, offsetArg, count);
706 SelfType&
Replace(size_type offset, size_type length,
const CharType* pChars, size_type count)
708 this->baseString.replace(offset, length, pChars, offset, count);
717 SelfType&
Replace(size_type offset, size_type length,
const CharType* pChars)
719 this->baseString.replace(offset, length, pChars);
729 SelfType&
Replace(size_type offset, size_type length, size_type count, CharType c)
731 this->baseString.replace(offset, length, count, c);
740 SelfType&
Replace(const_iterator first, const_iterator last,
const SelfType& arg)
742 this->baseString.replace(first, last, arg.baseString);
752 SelfType&
Replace(const_iterator first, const_iterator last,
const CharType* pChars, size_type count)
754 this->baseString.replace(first, last, pChars, count);
763 SelfType&
Replace(const_iterator first, const_iterator last,
const CharType* pChars)
765 this->baseString.replace(first, last, pChars);
775 SelfType&
Replace(const_iterator first, const_iterator last, size_type count, CharType c)
777 this->baseString.replace(first, last, count, c);
787 SelfType&
Replace(const_iterator first, const_iterator last, iterator first2, iterator last2)
789 this->baseString.replace(first, last, first2, last2);
799 SelfType&
Replace(const_iterator first, const_iterator last, const_iterator first2, const_iterator last2)
801 this->baseString.replace(first, last, first2, last2);
811 SelfType&
Replace(const_iterator first, const_iterator last, const_pointer first2, const_pointer last2)
813 this->baseString.replace(first, last, first2, last2);
823 SelfType&
Replace(const_iterator first, const_iterator last, pointer first2, pointer last2)
825 this->baseString.replace(first, last, first2, last2);
836 SelfType&
ReplaceAll(
const SelfType& pattern,
const SelfType& replacement)
838 boost::replace_all(this->baseString, pattern.baseString, replacement.baseString);
849 return this->baseString.begin();
857 return this->baseString.begin();
865 return this->baseString.end();
871 const_iterator
end()
const 873 return this->baseString.end();
882 return this->baseString.begin();
889 return this->baseString.begin();
896 return this->baseString.end();
901 const_iterator
End()
const 903 return this->baseString.end();
910 return this->baseString.rbegin();
917 return this->baseString.rbegin();
924 return this->baseString.rend();
931 return this->baseString.rend();
938 return this->baseString.cbegin();
945 return this->baseString.cend();
952 return this->baseString.crbegin();
959 return this->baseString.crend();
965 this->baseString.shrink_to_fit();
972 this->baseString.push_back(c);
981 this->baseString.pop_back();
990 return this->baseString.front();
998 return this->baseString.front();
1006 return this->baseString.back();
1014 return this->baseString.back();
1021 reference
At(size_type offset)
1023 return this->baseString.at(offset);
1030 const_reference
At(size_type offset)
const 1032 return this->baseString.at(offset);
1041 return this->baseString[offset];
1050 return this->baseString[offset];
1064 return this->baseString.length();
1076 return this->baseString.size();
1082 return this->baseString.max_size();
1094 return this->baseString.capacity();
1101 return this->baseString.empty();
1112 this->baseString.resize(newSize);
1124 this->baseString.resize(newSize, c);
1136 this->baseString.reserve(newCapacity);
1142 this->baseString.clear();
1151 size_type
Find(
const SelfType& pattern, size_type offset = 0)
const 1153 return this->baseString.find(pattern.baseString, offset);
1161 size_type
Find(
const CharType* pChars, size_type offset, size_type count)
const 1163 return this->baseString.find(pChars, offset, count);
1170 size_type
Find(
const CharType* pChars, size_type offset = 0)
const 1172 return this->baseString.find(pChars, offset);
1179 size_type
Find(CharType c, size_type offset = 0)
const 1181 return this->baseString.find(c, offset);
1190 return this->baseString.rfind(pattern.baseString, offset);
1198 size_type
ReverseFind(
const CharType* pChars, size_type offset, size_type count)
const 1200 return this->baseString.rfind(pChars, offset, count);
1209 return this->baseString.rfind(pChars, offset);
1218 return this->baseString.rfind(c, offset);
1225 size_type
FindFirstOf(
const SelfType& chars, size_type offset = 0)
const 1227 return this->baseString.find_first_of(chars.baseString, offset);
1235 size_type
FindFirstOf(
const CharType* pChars, size_type offset, size_type count)
const 1237 return this->baseString.find_first_of(pChars, offset, count);
1244 size_type
FindFirstOf(
const CharType* pChars, size_type offset = 0)
const 1246 return this->baseString.find_first_of(pChars, offset);
1256 return this->baseString.find_first_of(c, offset);
1265 return this->baseString.find_last_of(chars.baseString, offset);
1273 size_type
FindLastOf(
const CharType* pChars, size_type offset, size_type count)
const 1275 return this->baseString.find_last_of(pChars, offset, count);
1284 return this->baseString.find_last_of(pChars, offset);
1294 return this->baseString.find_last_of(c, offset);
1303 return this->baseString.find_first_not_of(chars.baseString, offset);
1311 size_type
FindFirstNotOf(
const CharType* pChars, size_type offset, size_type count)
const 1313 return this->baseString.find_first_not_of(pChars, offset, count);
1322 return this->baseString.find_first_not_of(pChars, offset);
1332 return this->baseString.find_first_not_of(c, offset);
1341 return this->baseString.find_last_not_of(chars.baseString, offset);
1349 size_type
FindLastNotOf(
const CharType *pChars, size_type offset, size_type count)
const 1351 return this->baseString.find_last_not_of(pChars, offset, count);
1360 return this->baseString.find_last_not_of(pChars, offset);
1370 return this->baseString.find_last_not_of(c, offset);
1384 return this->baseString.compare(other.baseString);
1396 int Compare(size_type offset, size_type count,
const SelfType& other)
const 1398 return this->baseString.compare(offset, count, other.baseString);
1412 int Compare(size_type offset, size_type count,
const SelfType& other, size_type offsetOther, size_type countOther =
NPos)
const 1414 return this->baseString.compare(offset, count, other.baseString, offsetOther, countOther);
1426 return this->baseString.compare(pOther);
1438 int Compare(size_type offset, size_type count,
const CharType *pOther)
const 1440 return this->baseString.compare(offset, count, pOther);
1453 int Compare(size_type offset, size_type count,
const CharType *pOther, size_type countOther)
const 1455 return this->baseString.compare(offset, count, pOther, countOther);
1465 return this->
Find(pChars) == 0;
1473 return this->
Find(pattern) == 0;
1481 template<
typename... Args>
1482 static SelfType
Format(
const SelfType& format,
const Args& ... args)
1491 template<
typename... Args>
1492 static SelfType
Format(
const char* format,
const Args& ... args)
1502 return this->baseString;
1509 return this->baseString.c_str();
1514 operator const CharType*()
const 1516 return this->baseString.data();
1521 operator const BaseString& ()
const 1523 return this->baseString;
1530 SelfType
Substr(size_type offset = 0, size_type count =
NPos)
const 1532 return SelfType(this->baseString.substr(offset, count));
1539 return this->baseString.get_allocator();
1546 this->baseString.swap(other.baseString);
1556 BaseString baseString;
1561 template <
class CharType,
class Alloc>
1564 template <
class CharType,
class Alloc>
1573 template<
class CharType,
class Alloc>
1583 template<
class CharType,
class Alloc>
1584 inline std::ostream& operator<<(std::ostream& os, const BasicString<CharType, Alloc>& right)
1586 os << right.GetBaseString();
1594 template<
class CharType,
class Alloc>
1597 std::basic_string<CharType, std::char_traits<CharType>, Alloc> baseString;
1599 right.Assign(baseString);
1607 template<
class CharType,
class Alloc>
1612 return left.GetBaseString() + right.GetBaseString();
1619 template<
class CharType,
class Alloc>
1621 const CharType* left,
1624 return left + right.GetBaseString();
1631 template<
class CharType,
class Alloc>
1633 const CharType left,
1636 return left + right.GetBaseString();
1643 template<
class CharType,
class Alloc>
1646 const CharType* right)
1648 return left.GetBaseString() + right;
1655 template<
class CharType,
class Alloc>
1658 const CharType right)
1660 return left.GetBaseString() + right;
1667 template<
class CharType,
class Alloc>
1672 return left.GetBaseString() + right.GetBaseString();
1679 template<
class CharType,
class Alloc>
1684 return (std::move(left.Append(right)));
1691 template<
class CharType,
class Alloc>
1696 return left.GetBaseString() + right.GetBaseString();
1703 template<
class CharType,
class Alloc>
1705 const CharType* left,
1708 return left + right.GetBaseString();
1715 template<
class CharType,
class Alloc>
1717 const CharType left,
1720 return left + right.GetBaseString();
1727 template<
class CharType,
class Alloc>
1730 const CharType* right)
1732 return left.GetBaseString() + right;
1739 template<
class CharType,
class Alloc>
1742 const CharType right)
1744 return left.GetBaseString() + right;
1751 template<
class CharType,
class Alloc>
1756 return left.GetBaseString() == right.GetBaseString();
1763 template<
class CharType,
class Alloc>
1765 const CharType* left,
1768 return left == right.GetBaseString();
1775 template<
class CharType,
class Alloc>
1778 const CharType* right)
1780 return left.GetBaseString() == right;
1787 template<
class CharType,
class Alloc>
1792 return (!(left == right));
1799 template<
class CharType,
class Alloc>
1801 const CharType *left,
1804 return (!(left == right));
1811 template<
class CharType,
class Alloc>
1814 const CharType* right)
1816 return (!(left == right));
1823 template<
class CharType,
class Alloc>
1828 return left.GetBaseString() < right.GetBaseString();
1835 template<
class CharType,
class Alloc>
1837 const CharType* left,
1840 return left < right.GetBaseString();
1847 template<
class CharType,
class Alloc>
1850 const CharType* right)
1852 return left.GetBaseString() < right;
1859 template<
class CharType,
class Alloc>
1864 return (right < left);
1871 template<
class CharType,
class Alloc>
1873 const CharType* left,
1876 return (right < left);
1883 template<
class CharType,
class Alloc>
1886 const CharType* right)
1888 return (right < left);
1895 template<
class CharType,
class Alloc>
1900 return (!(right < left));
1907 template<
class CharType,
class Alloc>
1909 const CharType* left,
1912 return (!(right < left));
1919 template<
class CharType,
class Alloc>
1922 const CharType* right)
1924 return (!(right < left));
1931 template<
class CharType,
class Alloc>
1936 return (!(left < right));
1943 template<
class CharType,
class Alloc>
1945 const CharType* left,
1948 return (!(left < right));
1955 template<
class CharType,
class Alloc>
1958 const CharType* right)
1960 return (!(left < right));
1973 template<
class C,
class Alloc>
const_reverse_iterator ReverseBegin() const
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:915
BasicString(const CharType *pChars, size_type count, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:116
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:1608
BasicString(const SelfType &arg, const Allocator &alloc)
This constructor copies the as argument passed string deeply.
Definition: BasicString.hxx:73
size_type FindLastOf(CharType c, size_type offset=NPos) const
Finds the last occurence of character c .
Definition: BasicString.hxx:1292
size_type Size() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1074
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:1492
SelfType & operator=(SelfType &&right)
This move assignment operator moves the right-hand-side operand to this string.
Definition: BasicString.hxx:232
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:218
SelfType & Assign(const SelfType &arg)
This operation copies the the argument to this string.
Definition: BasicString.hxx:334
std::istream & operator>>(std::istream &is, BasicString< CharType, Alloc > &right)
Streams the instream is into the right string.
Definition: BasicString.hxx:1595
BasicString(SelfType &&arg)
This move constructor moves the as argument passed string to this string.
Definition: BasicString.hxx:155
iterator Begin()
Returns the begin iterator of this string.
Definition: BasicString.hxx:880
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars, size_type count)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:752
BaseString::iterator iterator
The iterator type of this type.
Definition: BasicString.hxx:48
SelfType & Replace(const_iterator first, const_iterator last, const CharType *pChars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:763
SelfType & operator+=(const CharType *right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:296
SelfType & operator+=(const SelfType &right)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:287
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:1368
BaseString::const_reverse_iterator const_reverse_iterator
The const reverse iterator type of this type.
Definition: BasicString.hxx:51
BaseString::size_type size_type
The size type of this type.
Definition: BasicString.hxx:42
SelfType & Replace(const_iterator first, const_iterator last, iterator first2, iterator last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:787
size_type Find(const CharType *pChars, size_type offset=0) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1170
static const SelfType NewLine
This static string instance represents the (platform specific) new line string.
Definition: BasicString.hxx:226
SelfType & Replace(const_iterator first, const_iterator last, size_type count, CharType c)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:775
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:1788
SelfType & Insert(size_type offset, const CharType *pChars)
This operation inserts the as argument passed string.
Definition: BasicString.hxx:552
SelfType & Erase(size_type offset, size_type count)
This operation erases chars from this string.
Definition: BasicString.hxx:640
const_reference Back() const
Returns a const reference to the last character in the string.
Definition: BasicString.hxx:1012
SelfType & Append(size_type count, CharType c)
Appends to this string count consecutive copies of character c .
Definition: BasicString.hxx:471
BaseString::const_iterator const_iterator
The const iterator type of this type.
Definition: BasicString.hxx:49
SelfType & Replace(size_type offset, size_type length, const CharType *pChars, size_type count)
Replaces a range of chars.
Definition: BasicString.hxx:706
BaseString::reverse_iterator reverse_iterator
The reverse iterator type of this type.
Definition: BasicString.hxx:50
BasicString(std::initializer_list< CharType > arg, const Allocator &alloc=Allocator())
Copies each of the characters in initList , in the same order.
Definition: BasicString.hxx:171
size_type MaxSize() const
Returns the number maximum size any string might have.
Definition: BasicString.hxx:1080
int Compare(size_type offset, size_type count, const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1438
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:694
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:1273
SelfType & Assign(SelfType &&arg)
This operation moves the as argument passed string to this string.
Definition: BasicString.hxx:316
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:1412
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:415
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:426
int Compare(size_type offset, size_type count, const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1396
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:489
reference Back()
Returns a reference to the last character in the string.
Definition: BasicString.hxx:1004
SelfType & Assign(const BaseString &arg)
This operation copies the argument to this string.
Definition: BasicString.hxx:353
Namespace of the C++ standard library
std::basic_string< CharType, std::char_traits< CharType >, Allocator > BaseString
The type of the basic std string.
Definition: BasicString.hxx:37
SelfType Substr(size_type offset=0, size_type count=NPos) const
Gets a substring of this string.
Definition: BasicString.hxx:1530
CharType value_type
The char type of this type.
Definition: BasicString.hxx:41
size_type ReverseFind(CharType c, size_type offset=NPos) const
Finds the last char which equal to c .
Definition: BasicString.hxx:1216
const_iterator End() const
Returns the end iterator of this string.
Definition: BasicString.hxx:901
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:1235
Definition: BasicFormatter.hxx:18
Allocator::pointer pointer
The pointer type of this type.
Definition: BasicString.hxx:46
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
size_type FindFirstOf(const CharType *pChars, size_type offset=0) const
Finds the first occurence of any character in pChars .
Definition: BasicString.hxx:1244
BaseString::reference reference
The reference type of this type.
Definition: BasicString.hxx:44
iterator end()
Returns the end iterator of this string.
Definition: BasicString.hxx:863
bool operator>(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1860
BaseString::const_reference const_reference
The const reference type of this type.
Definition: BasicString.hxx:45
iterator Insert(const_iterator where, const_iterator first, const_iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:610
const_iterator ConstEnd() const
Returns the end iterator of this const string.
Definition: BasicString.hxx:943
bool operator<(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1824
bool StartWith(const SelfType &pattern) const
Determines if this string starts with the pattern string.
Definition: BasicString.hxx:1471
size_type FindFirstOf(const SelfType &chars, size_type offset=0) const
Finds the first occurence of any character in chars .
Definition: BasicString.hxx:1225
int Compare(const SelfType &other) const
Compares this string to the other string lexicographical.
Definition: BasicString.hxx:1382
size_type FindFirstOf(CharType c, size_type offset=0) const
Finds the first occurence of character c .
Definition: BasicString.hxx:1254
size_t result_type
The result type of this functor class (stl policy type)
Definition: BasicString.hxx:1983
size_type FindLastOf(const SelfType &chars, size_type offset=NPos) const
Finds the last occurence of any character in chars .
Definition: BasicString.hxx:1263
reference At(size_type offset)
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1021
size_type Find(CharType c, size_type offset=0) const
Finds the first char which equal to c .
Definition: BasicString.hxx:1179
void Reserve(size_type newCapacity=0)
Reserves memory upto the specified newCapacity .
Definition: BasicString.hxx:1134
const CharType * CStr() const
Gets the character data of this string.
Definition: BasicString.hxx:1507
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:498
void Swap(SelfType &other)
Swaps the content of this string with the content of the other string.
Definition: BasicString.hxx:1544
const BaseString & GetBaseString() const
Gets the basic std string.
Definition: BasicString.hxx:1500
BaseString::difference_type difference_type
The difference type of this type.
Definition: BasicString.hxx:43
iterator Insert(const_iterator where, const_pointer first, const_pointer last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:620
size_type Find(const SelfType &pattern, size_type offset=0) const
Finds the first substring which equal to pattern .
Definition: BasicString.hxx:1151
reverse_iterator ReverseBegin()
Returns the begin iterator of this string for reverse iterating.
Definition: BasicString.hxx:908
SelfType & Erase(size_type offset=0)
This operation erases chars from this string.
Definition: BasicString.hxx:630
~BasicString()
The destructor deallocates all memory of this instance.
Definition: BasicString.hxx:209
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:1358
bool IsEmpty() const
Determines if this string is empty.
Definition: BasicString.hxx:1099
SelfType & operator+=(CharType c)
This assignment operator appends the the right-hand-side operand to this string.
Definition: BasicString.hxx:305
SelfType & Append(const SelfType &arg)
This operation appends the the argument to this string.
Definition: BasicString.hxx:435
void Resize(size_type newSize, CharType c)
Resizes this string to the specified new size.
Definition: BasicString.hxx:1122
iterator Insert(const_iterator where, size_type count, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:590
static const SelfType Empty
An emtpy static string instance.
Definition: BasicString.hxx:222
SelfType & Replace(const_iterator first, const_iterator last, const_pointer first2, const_pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:811
SelfType & operator=(const SelfType &right)
This assignment operator copies the the right-hand-side operand to this string.
Definition: BasicString.hxx:250
void ShrinkToFit()
Reduces the capacity of this string to its size.
Definition: BasicString.hxx:963
iterator Erase(const_iterator first, const_iterator last)
Erases a range of chars [first;last).
Definition: BasicString.hxx:658
BasicString(size_type count, CharType c)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:139
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:1320
Allocator GetAllocator() const
Gets the allocator of this string.
Definition: BasicString.hxx:1537
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:189
reference operator[](size_type offset)
Returns a reference to the character at position offset .
Definition: BasicString.hxx:1039
void PushBack(CharType c)
Appends the character c to this string.
Definition: BasicString.hxx:970
bool StartWith(const CharType *pChars) const
Determines if this string starts with the pChars C-string.
Definition: BasicString.hxx:1463
iterator Erase(const_iterator where)
This operation erases chars from this string.
Definition: BasicString.hxx:649
Alloc Allocator
The characters allocator type.
Definition: BasicString.hxx:34
void Clear()
Clears the content of this string, but does not modify the capacity.
Definition: BasicString.hxx:1140
size_type ReverseFind(const SelfType &pattern, size_type offset=NPos) const
Finds the last substring which equal to pattern .
Definition: BasicString.hxx:1188
iterator End()
Returns the end iterator of this string.
Definition: BasicString.hxx:894
BasicString(size_type count, CharType c, const Allocator &alloc)
Fills the string with count consecutive copies of character c .
Definition: BasicString.hxx:148
size_type Find(const CharType *pChars, size_type offset, size_type count) const
Finds the first substring which equal to pChars .
Definition: BasicString.hxx:1161
size_type ReverseFind(const CharType *pChars, size_type offset=NPos) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1207
size_type Length() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1062
void Resize(size_type newSize)
Resizes this string to the specified new size.
Definition: BasicString.hxx:1110
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:325
void swap(BasicString< CharType, Alloc > &left, BasicString< CharType, Alloc > &right)
Swaps the content of the left string with the content of the right string.
Definition: BasicString.hxx:1574
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:1330
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:1453
SelfType & ReplaceAll(const SelfType &pattern, const SelfType &replacement)
Replaces a given pattern by a replacement string.
Definition: BasicString.hxx:836
size_type ReverseFind(const CharType *pChars, size_type offset, size_type count) const
Finds the last substring which equal to pChars .
Definition: BasicString.hxx:1198
SelfType & Append(const SelfType &arg, size_type offset, size_type count=NPos)
This operation appends the as argument passed string partially.
Definition: BasicString.hxx:445
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:1482
BasicString(BaseString &&arg)
This move constructor moves the as argument passed std::string to this string.
Definition: BasicString.hxx:203
size_type FindLastOf(const CharType *pChars, size_type offset=NPos) const
Finds the last occurence of any character in pChars .
Definition: BasicString.hxx:1282
iterator begin()
Returns the begin iterator of this string.
Definition: BasicString.hxx:847
BasicString(const Allocator &alloc)
This constructor creates an empty string instance.
Definition: BasicString.hxx:80
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:1311
SelfType & Insert(size_type offset, const CharType *pChars, size_type count)
This operation inserts the as argument passed string partially.
Definition: BasicString.hxx:542
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:180
Root namespace for the PLCnext API
size_type Capacity() const
Rceturns the capacity of this string.
Definition: BasicString.hxx:1092
SelfType & operator=(const CharType *right)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:259
SelfType & Replace(const_iterator first, const_iterator last, std::initializer_list< CharType > chars)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:670
SelfType & Replace(size_type offset, size_type length, const SelfType &arg)
Replaces a range of chars.
Definition: BasicString.hxx:681
Allocator::const_pointer const_pointer
The const pointer type of this type.
Definition: BasicString.hxx:47
const_reverse_iterator ConstReverseEnd() const
Returns the end iterator of this const string for reverse iterating.
Definition: BasicString.hxx:957
SelfType & operator=(CharType c)
This assignment operator copies the right-hand-side operand to this string.
Definition: BasicString.hxx:268
Arp::BasicString< C, Alloc > argument_type
The argument type of this functor class (stl policy type)
Definition: BasicString.hxx:1981
const_iterator begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:855
SelfType & Replace(const_iterator first, const_iterator last, const_iterator first2, const_iterator last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:799
reverse_iterator ReverseEnd()
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:922
SelfType & Append(const CharType *pChars, size_type count)
This operation appends the as argument passed C-string partially.
Definition: BasicString.hxx:454
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:1349
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:1752
const_iterator end() const
Returns the end iterator of this string.
Definition: BasicString.hxx:871
C CharType
The character type.
Definition: BasicString.hxx:35
SelfType & Assign(iterator first, iterator last)
Copies the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:397
SelfType & Append(const CharType *pChars)
This operation appends the as argument passed C-string.
Definition: BasicString.hxx:462
SelfType & Replace(const_iterator first, const_iterator last, pointer first2, pointer last2)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:823
SelfType & Insert(size_type offset, const SelfType &arg)
This operation inserts the the argument at the given position.
Definition: BasicString.hxx:519
bool operator>=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1932
const_reverse_iterator ReverseEnd() const
Returns the end iterator of this string for reverse iterating.
Definition: BasicString.hxx:929
const_reference Front() const
Returns a const reference to the first character in the string.
Definition: BasicString.hxx:996
BasicString()
The default constructor constructs an empty string instance.
Definition: BasicString.hxx:58
iterator Insert(const_iterator where, iterator first, iterator last)
Inserts a range of chars [first;last) at position where .
Definition: BasicString.hxx:600
SelfType & Insert(size_type offset, size_type count, CharType c)
Inserts count consecutive copies of character c at position offset .
Definition: BasicString.hxx:563
SelfType & Replace(size_type offset, size_type length, size_type count, CharType c)
Replaces a range of chars by a character.
Definition: BasicString.hxx:729
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:406
const_iterator Begin() const
Returns the begin iterator of this string.
Definition: BasicString.hxx:887
const_reference operator[](size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1048
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:1339
const_iterator ConstBegin() const
Returns the begin iterator of this const string.
Definition: BasicString.hxx:936
BasicString(const CharType *pChars, const Allocator &alloc)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:131
SelfType & Assign(const SelfType &arg, size_type offset, size_type count=NPos)
This operation copies the as argument passed string partially.
Definition: BasicString.hxx:344
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:278
result_type operator()(const argument_type &key) const
This functor operator returns the hash value of the as argument passed string.
Definition: BasicString.hxx:1989
BasicString(const BaseString &arg)
This copy constructor copies the as argument passed std::string to this string.
Definition: BasicString.hxx:196
int Compare(const CharType *pOther) const
Compares this string to the pOther string lexicographical.
Definition: BasicString.hxx:1424
SelfType & Assign(BaseString &&arg)
This operation moves the argument to this string.
Definition: BasicString.hxx:362
BasicString(const CharType *pChars, size_type count)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:107
BasicString< CharType, Allocator > SelfType
The self type.
Definition: BasicString.hxx:36
SelfType & Replace(const_iterator first, const_iterator last, const SelfType &arg)
Replaces a range of chars [first;last).
Definition: BasicString.hxx:740
SelfType & Append(iterator first, iterator last)
Appends the sequence of characters in the range [first,last), in the same order.
Definition: BasicString.hxx:480
Allocator allocator_type
The allocator type of this type.
Definition: BasicString.hxx:40
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:531
SelfType & Assign(const CharType *pChars, size_type count)
This operation copies the as argument passed C-string partially.
Definition: BasicString.hxx:371
void PopBack()
Removes the character at the end of this string.
Definition: BasicString.hxx:977
BasicString(const CharType *pChars)
This constructor copies the as argument passed C-string.
Definition: BasicString.hxx:123
iterator Insert(const_iterator where, CharType c)
Inserts character c at position where .
Definition: BasicString.hxx:580
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:510
SelfType & Replace(size_type offset, size_type length, const CharType *pChars)
Replaces a range of chars.
Definition: BasicString.hxx:717
SelfType & Assign(const CharType *pChars)
This operation copies the as argument passed C-string.
Definition: BasicString.hxx:379
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:241
const_reference At(size_type offset) const
Returns a const reference to the character at position offset .
Definition: BasicString.hxx:1030
SelfType & Assign(size_type count, CharType c)
Fills this string with count consecutive copies of character c .
Definition: BasicString.hxx:388
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:1301
reference Front()
Returns a reference to the first character in the string.
Definition: BasicString.hxx:988
bool operator<=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string.
Definition: BasicString.hxx:1896
BasicString(const SelfType &arg)
The copy constructor copies the as argument passed string deeply.
Definition: BasicString.hxx:65
const_reverse_iterator ConstReverseBegin() const
Returns the begin iterator of this const string for reverse iterating.
Definition: BasicString.hxx:950
BasicString(SelfType &&arg, const Allocator &alloc)
This move constructor moves the as argument passed string to this string.
Definition: BasicString.hxx:163
BasicString(const SelfType &arg, size_type offset, size_type count=NPos)
This constructor copies the as argument passed string partially.
Definition: BasicString.hxx:89