Template Class string_base#

Class Documentation#

template<typename TCharType, bool bUnicode = true, size_t nFixedSize = 0>
class string_base#

Templated string class.

Template Parameters:
  • TCharType – The character type that the class uses.

  • bUnicode – When set, the string is a unicode string.

  • nFixedSize – Size of the fixed size buffer or 0 for a dynamic sized buffer.

Public Types

using value_type = TCharType#

Value type for this string class.

using iterator = internal::index_iterator<string_base<TCharType, bUnicode, nFixedSize>, false, false>#

Forward iterator class used by this string class.

using reverse_iterator = internal::index_iterator<string_base<TCharType, bUnicode, nFixedSize>, false, true>#

Backward iterator class used by this string class.

using const_iterator = internal::index_iterator<string_base<TCharType, bUnicode, nFixedSize>, true, false>#

Const forward iterator class used by this string class.

using const_reverse_iterator = internal::index_iterator<string_base<TCharType, bUnicode, nFixedSize>, true, true>#

Const backward iterator class used by this string class.

using reference = TCharType&#

Reference type of the element.

using const_reference = const TCharType&#

Const reference type of the element.

Public Functions

string_base() noexcept#

Default constructor.

~string_base()#

Destructor.

string_base(const string_base &rss)#

Copy constructor of same string type.

Parameters:

rss[in] Reference to the string to copy from.

template<typename TCharType2, bool bUnicode2, size_t nFixedSize2>
explicit string_base(const string_base<TCharType2, bUnicode2, nFixedSize2> &rss)#

Copy constructor of other string types.

Template Parameters:
  • TCharType2 – The character type that the provided string class uses.

  • bUnicode2 – When set, the provided string is a unicode string.

  • nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to copy from.

string_base(string_base &&rss) noexcept#

Move constructor of same string type.

Parameters:

rss[in] Reference to the string to move the data from.

template<size_t nFixedSize2>
string_base(string_base<TCharType, bUnicode, nFixedSize2> &&rss)#

Move constructor of other string types.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to move the data from.

template<typename TCharType2>
string_base(const std::basic_string<TCharType2> &rss)#

Constructor with C++ string assignment.

Template Parameters:

TCharType2 – The character type that the provided string class uses.

Parameters:

rss[in] Reference to the string to copy from.

string_base(const TCharType *szStr)#

Constructor with zero terminated C string assignment.

Parameters:

szStr[in] Pointer to zero terminated string.

string_base(size_t nCount, TCharType c)#

Construct a string consisting of nCount copies of character c.

Parameters:
  • nCount[in] Number of characters to insert.

  • c[in] The character to insert nCount times.

template<size_t nFixedSize2>
string_base(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos)#

Construct a string from a substring starting at nPos.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference of the string to extract the substring from.

  • nPos[in] The position to start the substring.

string_base(const std::basic_string<TCharType> &rss, size_t nPos)#

Construct a string from a substring starting at nPos.

Parameters:
  • rss[in] Reference of the string to extract the substring from.

  • nPos[in] The position to start the substring.

template<size_t nFixedSize2>
string_base(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos, size_t nCount)#

Construct a string from a substring starting at nPos.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference of the string to extract the substring from.

  • nPos[in] The position to start the substring.

  • nCount[in] The amount of characters of the substring to include.

string_base(const std::basic_string<TCharType> &rss, size_t nPos, size_t nCount)#

Construct a string from a substring starting at nPos.

Parameters:
  • rss[in] Reference of the string to extract the substring from.

  • nPos[in] The position to start the substring.

  • nCount[in] The amount of characters of the substring to include.

string_base(const TCharType *sz, size_t nCount)#

Construct a string with nCount characters.

Parameters:
  • sz[in] C-Style string. Can contain null characters.

  • nCount[in] The amount of characters to copy.

template<class TIterator>
string_base(TIterator itFirst, TIterator itLast)#

Construct a string with the content of a range defined by two iterators.

Remark

Both iterators must point to the same string.

Template Parameters:

TIterator – Iterator type to use.

Parameters:
  • itFirst[in] The iterator pointing to the first character.

  • itLast[in] The iterator pointing to the value past the last character.

string_base(std::initializer_list<TCharType> ilist)#

Construct a string from an initializer list.

Parameters:

ilist[in] Initializer list.

string_base &operator=(const string_base &rss)#

Assignment operator of same string type.

Parameters:

rss[in] Reference to the string to assign from.

Returns:

Returns a reference to this object.

template<size_t nFixedSize2>
string_base &operator=(const string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Assignment operator of other string types.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to assign from.

Returns:

Returns a reference to this object.

string_base &operator=(string_base &&rss) noexcept#

Move operator of same string type.

Parameters:

rss[in] Reference to the string to assign from.

Returns:

Returns a reference to this object.

template<size_t nFixedSize2>
string_base &operator=(string_base<TCharType, bUnicode, nFixedSize2> &&rss)#

Move operator of other string types.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to assign from.

Returns:

Returns a reference to this object.

string_base &operator=(const std::basic_string<TCharType> &rss)#

Assignment operator with C++ string assignment.

Parameters:

rss[in] Reference to the string to assign from.

Returns:

Returns a reference to this object.

string_base &operator=(const TCharType *szStr)#

Assignment operator with zero terminated C string assignment.

Parameters:

szStr[in] Pointer to zero terminated string.

Returns:

Returns a reference to this object.

string_base &operator=(std::initializer_list<TCharType> ilist)#

Assignment operator with initializer list.

Parameters:

ilist[in] Initializer list

Returns:

Returns a reference to this object.

string_base &assign(size_t nCount, TCharType c)#

Assign a string consisting of nCount copies of character c.

Parameters:
  • nCount[in] Number of characters to insert.

  • c[in] The character to insert nCount times.

Returns:

Returns a reference to this object.

template<size_t nFixedSize2>
string_base &assign(const string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Assign a copy of a string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to copy from.

Returns:

Returns a reference to this object.

string_base &assign(const std::basic_string<TCharType> &rss)#

Assign a copy of a C++ string.

Parameters:

rss[in] Reference to the string to copy from.

Returns:

Returns a reference to this object.

template<size_t nFixedSize2>
string_base &assign(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos, size_t nCount = npos)#

Assign a string from a substring starting at nPos.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference of the string to extract the substring from.

  • nPos[in] The position to start the substring.

  • nCount[in] The amount of characters of the substring to include.

Returns:

Returns a reference to this object.

string_base &assign(const std::basic_string<TCharType> &rss, size_t nPos, size_t nCount = npos)#

Assign a string from a substring starting at nPos.

Parameters:
  • rss[in] Reference of the string to extract the substring from.

  • nPos[in] The position to start the substring.

  • nCount[in] The amount of characters of the substring to include.

Returns:

Returns a reference to this object.

template<size_t nFixedSize2>
string_base &assign(string_base<TCharType, bUnicode, nFixedSize2> &&rss)#

Move the string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to move the data from.

Returns:

Returns a reference to this object.

string_base &assign(const TCharType *sz, size_t nCount)#

Assign a string with nCount characters.

Parameters:
  • sz[in] C-Style string. Can contain null characters.

  • nCount[in] The amount of characters to copy.

Returns:

Returns a reference to this object.

string_base &assign(const TCharType *sz)#

Assign with zero terminated C string assignment.

Parameters:

sz[in] Pointer to zero terminated string.

Returns:

Returns a reference to this object.

template<class TIterator>
string_base &assign(TIterator itFirst, TIterator itLast)#

Assign a string with the content of a range defined by two iterators.

Remark

Both iterators must point to the same string.

Template Parameters:

TIterator – Iterator type to use.

Parameters:
  • itFirst[in] The iterator pointing to the first character.

  • itLast[in] The iterator pointing to the value past the last character.

Returns:

Returns a reference to this object.

string_base &assign(std::initializer_list<TCharType> ilist)#

Assign a string from an initializer list.

Parameters:

ilist[in] Initializer list.

Returns:

Returns a reference to this object.

reference at(size_t nPos)#

Return a reference to the character at the specified position.

Parameters:

nPos[in] The specified position.

Returns:

Reference to the character.

const_reference at(size_t nPos) const#

Return a reference to the character at the specified position.

Parameters:

nPos[in] The specified position.

Returns:

Reference to the character.

reference operator[](size_t nPos)#

Return a reference to the character at the specified position.

Parameters:

nPos[in] The specified position.

Returns:

Reference to the character.

const_reference operator[](size_t nPos) const#

Return a reference to the character at the specified position.

Parameters:

nPos[in] The specified position.

Returns:

Reference to the character.

TCharType &front()#

Return a reference to the first character.

Returns:

Reference to the character.

const TCharType &front() const#

Return a reference to the first character.

Returns:

Reference to the character.

TCharType &back()#

Return a reference to the last character.

Returns:

Reference to the character.

const TCharType &back() const#

Return a reference to the last character.

Returns:

Reference to the character.

template<typename TCharType2, bool bUnicode2, size_t nFixedSize2>
operator string_base<TCharType2, bUnicode2, nFixedSize2>() const#

Cast operator for SDV strings.

Template Parameters:
  • TCharType2 – The character type of the string to convert to.

  • bUnicode2 – When set, the string to convert to is a unicode string.

  • nFixedSize2 – The fixed size of the string to convert to.

Returns:

Returns a SDV string object containing a copy of the string.

operator std::basic_string<TCharType>() const#

Cast operator for C++ strings.

Returns:

Returns a C++ string object containing a copy of the string.

const TCharType *data() const noexcept#

Access to the underlying data.

Remark

The underlying data might not be zero terminated.

Returns:

Pointer to the string.

pointer<TCharType, nFixedSize ? nFixedSize + 1 : 0> &buffer() noexcept#

Access to the buffer.

Returns:

Returns reference to the internal buffer.

const TCharType *c_str() const noexcept#

Return a pointer to a zero terminate string.

Returns:

Pointer to the string.

iterator begin() noexcept#

Return an iterator to the first character of the string.

Returns:

Iterator to the first character of te string.

const_iterator begin() const noexcept#

Return an iterator to the first character of the string.

Returns:

Iterator to the first character of te string.

const_iterator cbegin() const noexcept#

Return a const iterator to the first character of the string.

Returns:

Const iterator to the first character of te string.

reverse_iterator rbegin() noexcept#

Return a reverse-iterator to the last character of the string.

Returns:

Reverse iterator to the last character of te string.

const_reverse_iterator rbegin() const noexcept#

Return a reverse-iterator to the last character of the string.

Returns:

Reverse iterator to the last character of te string.

const_reverse_iterator crbegin() const noexcept#

Return a const reverse iterator to the last character of the string.

Returns:

Const reverse iterator to the last character of te string.

iterator end() noexcept#

Return an iterator beyond the last character of the string.

Returns:

Iterator beyond the last character of te string.

const_iterator end() const noexcept#

Return an iterator beyond the last character of the string.

Returns:

Iterator beyond the last character of te string.

const_iterator cend() const noexcept#

Return a const beyond the last character of the string.

Returns:

Const iterator beyond the last character of te string.

reverse_iterator rend() noexcept#

Return a reverse iterator before the first character of the string.

Returns:

Reverse iterator before the last character of te string.

const_reverse_iterator rend() const noexcept#

Return a reverse iterator before the first character of the string.

Returns:

Reverse iterator before the last character of te string.

const_reverse_iterator crend() const noexcept#

Return a const reverse iterator before the first character of the string.

Returns:

Const reverse iterator before the last character of te string.

bool empty() const#

Is the string empty?

Returns:

Returns ‘true’ when the string is empty; ‘false’ when not.

size_t size() const#

Get the size of the string.

Remark

The length and the size for the string are equal.

Returns:

The size of the string buffer.

size_t length() const#

Get the length of the string.

Remark

The length and the size for the string are equal.

Returns:

The length of the string.

void reserve(size_t nNewCap = 0)#

Reserve capacity for the string buffer. Additional buffer will be filled with zeros.

Remark

Reducing the capacity will have no effect.

Parameters:

nNewCap[in] The new capacity.

size_t capacity() const noexcept#

Get the current string capacity.

Remark

This will be the same as the length and size of the string.

Returns:

The capacity of the current string.

void shrink_to_fit()#

Reduce the buffer to fit the string.

Remark

This function will have no effect.

void clear()#

Clear the string.

string_base &insert(size_t nIndex, size_t nCount, TCharType c)#

Insert nCount copies of character c at the position nIndex.

Parameters:
  • nIndex[in] The index at which to insert the characters.

  • nCount[in] Number of characters to insert.

  • c[in] The character to insert nCount times.

Returns:

Reference to this string.

string_base &insert(size_t nIndex, const TCharType *sz)#

Inserts zero-terminated character string pointed to by sz at the position nIndex.

Parameters:
  • nIndex[in] The index at which to insert the characters.

  • sz[in] Zero terminated string.

Returns:

Reference to this string.

string_base &insert(size_t nIndex, const TCharType *sz, size_t nCount)#

Inserts nCount characters from the string at the position nIndex.

Parameters:
  • nIndex[in] The index at which to insert the characters.

  • sz[in] Zero terminated string.

  • nCount[in] Number of characters to insert.

Returns:

Reference to this string.

template<size_t nFixedSize2>
string_base &insert(size_t nIndex, const string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Inserts string rss at the position nIndex.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • nIndex[in] The index at which to insert the string.

  • rss[in] Reference to the string to insert.

Returns:

Reference to this string.

template<size_t nFixedSize2>
string_base &insert(size_t nIndex, const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos, size_t nCount = npos)#

Inserts a sub-string starting at index nPos and with nCount character at the position nIndex.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • nIndex[in] The index at which to insert the string.

  • rss[in] Reference to the string to insert.

  • nPos[in] Position of the first character in ss to insert.

  • nCount[in] Number of characters to insert.

Returns:

Reference to this string.

string_base &insert(size_t nIndex, const std::basic_string<TCharType> &rss)#

Inserts C++ string_base<TCharType> ss at the position nIndex.

Parameters:
  • nIndex[in] The index at which to insert the string.

  • rss[in] Reference to the string to insert.

Returns:

Reference to this string.

string_base &insert(size_t nIndex, const std::basic_string<TCharType> &rss, size_t nPos, size_t nCount = npos)#

Inserts a sub-string starting at index nPos and with nCount character at the position nIndex.

Parameters:
  • nIndex[in] The index at which to insert the string.

  • rss[in] Reference to the string to insert.

  • nPos[in] Position of the first character in ss to insert.

  • nCount[in] Number of characters to insert.

Returns:

Reference to this string.

iterator insert(const_iterator itPos, TCharType c)#

Insert a character c at the position itPos.

Parameters:
  • itPos[in] Iterator pointing to the position to insert the characters.

  • c[in] The character to insert.

Returns:

The iterator pointing to the inserted character.

iterator insert(const_iterator itPos, size_t nCount, TCharType c)#

Insert nCount copies of character c at the position itPos.

Parameters:
  • itPos[in] Iterator pointing to the position to insert the characters.

  • nCount[in] Number of characters to insert.

  • c[in] The character to insert nCount times.

Returns:

The iterator pointing to the inserted character.

template<class TIterator>
iterator insert(const_iterator itPos, TIterator itFirst, TIterator itLast)#

Insert a string with the content of a range defined by two iterators.

Remark

Both iterators must point to the same string.

Template Parameters:

TIterator – Iterator type to use.

Parameters:
  • itPos[in] Iterator pointing to the position to insert the characters.

  • itFirst[in] The iterator pointing to the first character.

  • itLast[in] The iterator pointing to the value past the last character.

Returns:

The iterator pointing to the inserted string.

iterator insert(const_iterator itPos, std::initializer_list<TCharType> ilist)#

Insert a string from an initializer list.

Parameters:
  • itPos[in] Iterator pointing to the position to insert the characters.

  • ilist[in] Initializer list.

Returns:

The iterator pointing to the inserted character.

string_base &erase(size_t nIndex = 0, size_t nCount = npos)#

Remove characters at the provided position.

Parameters:
  • nIndex[in] The index at which to erase the characters.

  • nCount[in] Number of characters to erase.

Returns:

Returns a reference to this object.

iterator erase(const_iterator itPos)#

Remove a character at the provided position.

Remark

The iterator must point to this string.

Parameters:

itPos[in] Iterator pointing to the position to erase the character from.

Returns:

Iterator to the character following the erase character or end() when no more characters are available.

iterator erase(const_iterator itFirst, const_iterator itLast)#

Remove al characters starting at itFirst until but not including itLast.

Remark

Both iterators must point to this string.

Parameters:
  • itFirst[in] The iterator pointing to the first character.

  • itLast[in] The iterator pointing to the value past the last character.

Returns:

Iterator to the character following the erased characters or end() when no more characters are available.

void push_back(TCharType c)#

Appends the given character to the end of the string.

Parameters:

c[in] The character to append.

void pop_back()#

Removes the last character from the string.

string_base &append(size_t nCount, TCharType c)#

Append nCount copies of character c at the end of the string.

Parameters:
  • nCount[in] Number of characters to insert.

  • c[in] The character to append nCount times.

Returns:

Reference to this string.

template<size_t nFixedSize2>
string_base &append(const string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Append string rss at the end of the string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to insert.

Returns:

Reference to this string.

string_base &append(const std::basic_string<TCharType> &rss)#

Append string rss at the end of the string.

Parameters:

rss[in] Reference to the string to insert.

Returns:

Reference to this string.

template<size_t nFixedSize2>
string_base &append(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos, size_t nCount = npos)#

Append a sub-string starting at index nPos and with nCount character at the end of the string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference to the string to insert.

  • nPos[in] Position of the first character in ss to insert.

  • nCount[in] Number of characters to insert.

Returns:

Reference to this string.

string_base &append(const std::basic_string<TCharType> &rss, size_t nPos, size_t nCount = npos)#

Append a sub-string starting at index nPos and with nCount character at the end of the string.

Parameters:
  • rss[in] Reference to the string to insert.

  • nPos[in] Position of the first character in ss to insert.

  • nCount[in] Number of characters to insert.

Returns:

Reference to this string.

string_base &append(const TCharType *sz, size_t nCount)#

Append nCount characters from the string at the end of the string.

Parameters:
  • sz[in] Zero terminated string.

  • nCount[in] Number of characters to insert.

Returns:

Reference to this string.

string_base &append(const TCharType *sz)#

Append the provided string at the end of the string.

Parameters:

sz[in] Zero terminated string.

Returns:

Reference to this string.

template<class TIterator>
string_base &append(TIterator itFirst, TIterator itLast)#

Append a string with the content of a range defined by two iterators.

Remark

Both iterators must point to the same string.

Template Parameters:

TIterator – Iterator type to use.

Parameters:
  • itFirst[in] The iterator pointing to the first character.

  • itLast[in] The iterator pointing to the value past the last character.

Returns:

Reference to this string.

string_base &append(std::initializer_list<TCharType> ilist)#

Append a string from an initializer list.

Parameters:

ilist[in] Initializer list.

Returns:

Reference to this string.

template<size_t nFixedSize2>
string_base &operator+=(const string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Append string rss at the end of the string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to insert.

Returns:

Reference to this string.

string_base &operator+=(const std::basic_string<TCharType> &rss)#

Append string rss at the end of the string.

Parameters:

rss[in] Reference to the string to insert.

Returns:

Reference to this string.

string_base &operator+=(TCharType c)#

Append the character c at the end of the string.

Parameters:

c[in] The character to append.

Returns:

Reference to this string.

string_base &operator+=(const TCharType *sz)#

Append the provided string at the end of the string.

Parameters:

sz[in] Zero terminated string.

Returns:

Reference to this string.

string_base &operator+=(std::initializer_list<TCharType> ilist)#

Append a string from an initializer list.

Parameters:

ilist[in] Initializer list.

Returns:

Reference to this string.

template<size_t nFixedSize2>
int compare(const string_base<TCharType, bUnicode, nFixedSize2> &rss) const noexcept#

Compare two character sequences.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] Reference to the string to compare this string with.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

int compare(const std::basic_string<TCharType> &rss) const noexcept#

Compare two character sequences.

Parameters:

rss[in] Reference to the string to compare this string with.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

template<size_t nFixedSize2>
int compare(size_t nPos1, size_t nCount1, const string_base<TCharType, bUnicode, nFixedSize2> &rss) const#

Compare two character sequences.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • nPos1[in] Position of the first character in the string to compare.

  • nCount1[in] Number if characters in this string to compare.

  • rss[in] Reference to the string to compare this string with.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

int compare(size_t nPos1, size_t nCount1, const std::basic_string<TCharType> &rss) const#

Compare two character sequences.

Parameters:
  • nPos1[in] Position of the first character in the string to compare.

  • nCount1[in] Number if characters in this string to compare.

  • rss[in] Reference to the string to compare this string with.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

template<size_t nFixedSize2>
int compare(size_t nPos1, size_t nCount1, const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos2, size_t nCount2 = npos) const#

Compare two character sequences.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • nPos1[in] Position of the first character in this string to compare.

  • nCount1[in] Number if characters in this string to compare.

  • rss[in] Reference to the string to compare this string with.

  • nPos2[in] Position of the first character in the provided string to compare.

  • nCount2[in] Number if characters in the provided string to compare.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

int compare(size_t nPos1, size_t nCount1, const std::basic_string<TCharType> &rss, size_t nPos2, size_t nCount2 = npos) const#

Compare two character sequences.

Parameters:
  • nPos1[in] Position of the first character in this string to compare.

  • nCount1[in] Number if characters in this string to compare.

  • rss[in] Reference to the string to compare this string with.

  • nPos2[in] Position of the first character in the provided string to compare.

  • nCount2[in] Number if characters in the provided string to compare.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

int compare(const TCharType *sz) const#

Compare two character sequences.

Parameters:

sz[in] Pointer to the character string to compare.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

int compare(size_t nPos1, size_t nCount1, const TCharType *sz) const#

Compare two character sequences.

Parameters:
  • nPos1[in] Position of the first character in this string to compare.

  • nCount1[in] Number if characters in this string to compare.

  • sz[in] Pointer to the character string to compare.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

int compare(size_t nPos1, size_t nCount1, const TCharType *sz, size_t nCount2) const#

Compare two character sequences.

Parameters:
  • nPos1[in] Position of the first character in this string to compare.

  • nCount1[in] Number if characters in this string to compare.

  • sz[in] Pointer to the character string to compare.

  • nCount2[in] Number if characters in the provided string to compare.

Returns:

Is negative when the string contains characters of lesser lexicographical order; returns prositive when the string contains characters of higher lexcicographical order; otherwise returns 0.

template<size_t nFixedSize2>
string_base &replace(size_t nPos, size_t nCount, const string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Replace characters with provided string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • nPos[in] Position to replace characters.

  • nCount[in] Amount of characters to replace.

  • rss[in] Reference to the string to use for recplacement.

Returns:

Reference to this string.

string_base &replace(size_t nPos, size_t nCount, const std::basic_string<TCharType> &rss)#

Replace characters with provided string.

Parameters:
  • nPos[in] Position to replace characters.

  • nCount[in] Amount of characters to replace.

  • rss[in] Reference to the string to use for recplacement.

Returns:

Reference to this string.

template<size_t nFixedSize2>
string_base &replace(const_iterator itFirst, const_iterator itLast, const string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Replace characters with provided string.

Remark

itFirst and itLast must point to a position of this string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • itFirst[in] Iterator position of the first character to replace.

  • itLast[in] Iterator position of the character beyond the last character to replace.

  • rss[in] Reference to the string to use for recplacement.

Returns:

Reference to this string.

string_base &replace(const_iterator itFirst, const_iterator itLast, const std::basic_string<TCharType> &rss)#

Replace characters with provided string.

Remark

itFirst and itLast must point to a position of this string.

Parameters:
  • itFirst[in] Iterator position of the first character to replace.

  • itLast[in] Iterator position of the character beyond the last character to replace.

  • rss[in] Reference to the string to use for recplacement.

Returns:

Reference to this string.

template<size_t nFixedSize2>
string_base &replace(size_t nPos, size_t nCount, const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos2, size_t nCount2 = npos)#

Replace characters with provided string substring.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • nPos[in] Position to replace characters.

  • nCount[in] Amount of characters to replace.

  • rss[in] Reference to the string to use for recplacement.

  • nPos2[in] Position of the characters within the provided string.

  • nCount2[in] Amount of characters within the provided string.

Returns:

Reference to this string.

string_base &replace(size_t nPos, size_t nCount, const std::basic_string<TCharType> &rss, size_t nPos2, size_t nCount2 = npos)#

Replace characters with provided string substring.

Parameters:
  • nPos[in] Position to replace characters.

  • nCount[in] Amount of characters to replace.

  • rss[in] Reference to the string to use for recplacement.

  • nPos2[in] Position of the characters within the provided string.

  • nCount2[in] Amount of characters within the provided string.

Returns:

Reference to this string.

string_base &replace(size_t nPos, size_t nCount, const TCharType *sz, size_t nCount2)#

Replace characters with provided string substring.

Parameters:
  • nPos[in] Position to replace characters.

  • nCount[in] Amount of characters to replace.

  • sz[in] Pointer to the C string to use for recplacement. Can contain zeros.

  • nCount2[in] Amount of characters within the provided string.

Returns:

Reference to this string.

string_base &replace(const_iterator itFirst, const_iterator itLast, const TCharType *sz, size_t nCount2)#

Replace characters with provided string substring.

Remark

itFirst and itLast must point to a position of this string.

Parameters:
  • itFirst[in] Iterator position of the first character to replace.

  • itLast[in] Iterator position of the character beyond the last character to replace.

  • sz[in] Pointer to the C string to use for recplacement. Can contain zeros.

  • nCount2[in] Amount of characters within the provided string.

Returns:

Reference to this string.

string_base &replace(size_t nPos, size_t nCount, const TCharType *sz)#

Replace characters with provided zero terminated string.

Parameters:
  • nPos[in] Position to replace characters.

  • nCount[in] Amount of characters to replace.

  • sz[in] Pointer to the zero terminated string to use for recplacement.

Returns:

Reference to this string.

string_base &replace(const_iterator itFirst, const_iterator itLast, const TCharType *sz)#

Replace characters with provided zero terminated string.

Remark

itFirst and itLast must point to a position of this string.

Parameters:
  • itFirst[in] Iterator position of the first character to replace.

  • itLast[in] Iterator position of the character beyond the last character to replace.

  • sz[in] Pointer to the zero terminated string to use for recplacement.

Returns:

Reference to this string.

string_base &replace(size_t nPos, size_t nCount, size_t nCount2, TCharType c)#

Replace characters with nCount2 characters.

Parameters:
  • nPos[in] Position to replace characters.

  • nCount[in] Amount of characters to replace.

  • nCount2[in] Amount of characters to use for replacement.

  • c[in] Character to use for recplacement.

Returns:

Reference to this string.

string_base &replace(const_iterator itFirst, const_iterator itLast, size_t nCount2, TCharType c)#

Replace characters with nCount2 characters.

Remark

itFirst and itLast must point to a position of this string.

Parameters:
  • itFirst[in] Iterator position of the first character to replace.

  • itLast[in] Iterator position of the character beyond the last character to replace.

  • nCount2[in] Amount of characters to use for replacement.

  • c[in] Character to use for recplacement.

Returns:

Reference to this string.

template<class TIterator>
string_base &replace(const_iterator itFirst, const_iterator itLast, TIterator itFirst2, TIterator itLast2)#

Replace characters with a container of TCharType identified by beginning and ending iterators.

Remark

itFirst and itLast must point to a position of this string.

Template Parameters:

TIterator – Type of iterator to use for iterating through the container.

Parameters:
  • itFirst[in] Iterator position of the first character to replace.

  • itLast[in] Iterator position of the character beyond the last character to replace.

  • itFirst2[in] Beginning iterator of the container.

  • itLast2[in] Ending iterator of the container

Returns:

Reference to this string.

string_base &replace(const_iterator itFirst, const_iterator itLast, std::initializer_list<TCharType> ilist)#

Replace characters with an initializer list.

Remark

itFirst and itLast must point to a position of this string.

Parameters:
  • itFirst[in] Iterator position of the first character to replace.

  • itLast[in] Iterator position of the character beyond the last character to replace.

  • ilist[in] Initializer list.

Returns:

Reference to this string.

string_base substr(size_t nPos = 0, size_t nCount = npos) const#

Return a substring.

Parameters:
  • nPos[in] The substring start position.

  • nCount[in] The amount of characters in the substring (if more than the available, all the characters right of the position).

Returns:

Returns a string with the substring characters.

size_t copy(TCharType *szDest, size_t nCount, size_t nPos = 0) const#

Copy a substring into the szDestination.

Remark

Does not copy a zero terminating character.

Parameters:
  • szDest[in] Destination string.

  • nCount[in] Amount of characters to copy (or the maximum amount is determined by the size).

  • nPos[in] The position from where to start copying.

Returns:

Amount of characters copied.

void resize(size_t nCount)#

Set the new size of the string. Additional characters will be filled with ‘\0’.

Parameters:

nCount[in] The size of the string buffer.

void resize(size_t nCount, TCharType c)#

Set the new size of the string. Additional characters will be filled with c.

Parameters:
  • nCount[in] The size of the string buffer.

  • c[in] Character to use to fill additional buffer space with.

template<size_t nFixedSize2>
void swap(string_base<TCharType, bUnicode, nFixedSize2> &rss)#

Exchange the content of provided string with this string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:

rss[in] String to swap with.

template<size_t nFixedSize2>
size_t find(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos = 0) const noexcept#

Find the position of the occurrence of the character sequence in the string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find(const std::basic_string<TCharType> &rss, size_t nPos = 0) const noexcept#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find(const TCharType *sz, size_t nPos, size_t nCount) const#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • sz[in] Pointer to the string to find. May contain zeros.

  • nPos[in] Position to start searching.

  • nCount[in] Length of the string to search for.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find(const TCharType *sz, size_t nPos = 0) const#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • sz[in] Pointer to zero terminated string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find(TCharType c, size_t nPos = 0) const noexcept#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • c[in] Character to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the character hasn’t been found.

template<size_t nFixedSize2>
size_t rfind(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos = npos) const noexcept#

Find the position of the occurrence of the character sequence in the string.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching in reverse order (nPos - 1).

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t rfind(const std::basic_string<TCharType> &rss, size_t nPos = npos) const noexcept#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching in reverse order (nPos - 1).

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t rfind(const TCharType *sz, size_t nPos, size_t nCount) const#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • sz[in] Pointer to the string to find. May contain zeros.

  • nPos[in] Position to start searching in reverse order (nPos - 1).

  • nCount[in] Length of the string to search for.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t rfind(const TCharType *sz, size_t nPos = npos) const#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • sz[in] Pointer to zero terminated string to find.

  • nPos[in] Position to start searching in reverse order (nPos - 1).

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t rfind(TCharType c, size_t nPos = npos) const noexcept#

Find the position of the occurrence of the character sequence in the string.

Parameters:
  • c[in] Character to find to find.

  • nPos[in] Position to start searching in reverse order (nPos - 1).

Returns:

Position of the first occurrence or npos if the character hasn’t been found.

template<size_t nFixedSize2>
size_t find_first_of(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos = 0) const noexcept#

Find the position of the occurrence of one of the characters being in the provided character sequence.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_of(const std::basic_string<TCharType> &rss, size_t nPos = 0) const noexcept#

Find the position of the occurrence of one of the characters being in the provided character sequence.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_of(const TCharType *sz, size_t nPos, size_t nCount) const#

Find the position of the occurrence of one of the characters being in the provided character sequence.

Parameters:
  • sz[in] Pointer to the string to find. May contain zeros.

  • nPos[in] Position to start searching.

  • nCount[in] Length of the string to search for.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_of(const TCharType *sz, size_t nPos = 0) const#

Find the position of the occurrence of one of the characters being in the provided character sequence.

Parameters:
  • sz[in] Pointer to zero terminated string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_of(TCharType c, size_t nPos = 0) const noexcept#

Find the position of the occurrence of the provided character.

Parameters:
  • c[in] Character to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the character hasn’t been found.

template<size_t nFixedSize2>
size_t find_first_not_of(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos = 0) const noexcept#

Find the position of the occurrence of any characters not being in the provided character.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_not_of(const std::basic_string<TCharType> &rss, size_t nPos = 0) const noexcept#

Find the position of the occurrence of any characters not being in the provided character.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_not_of(const TCharType *sz, size_t nPos, size_t nCount) const#

Find the position of the occurrence of any characters not being in the provided character.

Parameters:
  • sz[in] Pointer to the string to find. May contain zeros.

  • nPos[in] Position to start searching.

  • nCount[in] Length of the string to search for.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_not_of(const TCharType *sz, size_t nPos = 0) const#

Find the position of the occurrence of any characters not being in the provided character.

Parameters:
  • sz[in] Pointer to zero terminated string to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the string hasn’t been found.

size_t find_first_not_of(TCharType c, size_t nPos = 0) const noexcept#

Find the position of the occurrence of any characters not being the provided character.

Parameters:
  • c[in] Character to find.

  • nPos[in] Position to start searching.

Returns:

Position of the first occurrence or npos if the character hasn’t been found.

template<size_t nFixedSize2>
size_t find_last_of(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos = npos) const noexcept#

Find the position of the last occurrence of one of the characters being in the provided character sequence.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_of(const std::basic_string<TCharType> &rss, size_t nPos = npos) const noexcept#

Find the position of the last occurrence of one of the characters being in the provided character sequence.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_of(const TCharType *sz, size_t nPos, size_t nCount) const#

Find the position of the last occurrence of one of the characters being in the provided character sequence.

Parameters:
  • sz[in] Pointer to the string to find. May contain zeros.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

  • nCount[in] Length of the string to search for.

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_of(const TCharType *sz, size_t nPos = npos) const#

Find the position of the last occurrence of one of the characters being in the provided character sequence.

Parameters:
  • sz[in] Pointer to zero terminated string to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_of(TCharType c, size_t nPos = npos) const noexcept#

Find the position of the last occurrence of the provided character.

Parameters:
  • c[in] Character to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the character hasn’t been found.

template<size_t nFixedSize2>
size_t find_last_not_of(const string_base<TCharType, bUnicode, nFixedSize2> &rss, size_t nPos = npos) const noexcept#

Find the last position of the occurrence of any characters not being in the provided character.

Template Parameters:

nFixedSize2 – The fixed size of the provided string.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_not_of(const std::basic_string<TCharType> &rss, size_t nPos = npos) const noexcept#

Find the last position of the occurrence of any characters not being in the provided character.

Parameters:
  • rss[in] Reference to the string to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_not_of(const TCharType *sz, size_t nPos, size_t nCount) const#

Find the last position of the occurrence of any characters not being in the provided character.

Parameters:
  • sz[in] Pointer to the string to find. May contain zeros.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

  • nCount[in] Length of the string to search for.

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_not_of(const TCharType *sz, size_t nPos = npos) const#

Find the last position of the occurrence of any characters not being in the provided character.

Parameters:
  • sz[in] Pointer to zero terminated string to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the string hasn’t been found.

size_t find_last_not_of(TCharType c, size_t nPos = npos) const noexcept#

Find the last position of the occurrence of any characters not being the provided character.

Parameters:
  • c[in] Character to find.

  • nPos[in] Ending position to start searching (last character ist nPos - 1).

Returns:

Position of the last occurrence or npos if the character hasn’t been found.

Public Static Attributes

static bool is_unicode = bUnicode#

Set when the type is a unicode type.

static size_t npos = static_cast<size_t>(-1)#

Declaration of npos.