|
|
| basic_string () |
| | Default constructor.
|
| |
|
| basic_string (const self_type &other) |
| | Constructor.
|
| |
|
template<class B , class A > |
| | basic_string (const dcpp::nub::basic_string< B, A > &other) |
| | Constructor from other string types.
|
| |
|
| basic_string (const double number) |
| | Constructs a string from a float.
|
| |
|
| basic_string (int number) |
| | Constructs a string from an int.
|
| |
|
| basic_string (unsigned int number) |
| | Constructs a string from an unsigned int.
|
| |
|
| basic_string (long number) |
| | Constructs a string from a long.
|
| |
|
| basic_string (unsigned long number) |
| | Constructs a string from an unsigned long.
|
| |
|
template<class B > |
| | basic_string (const B *const c, dcpp::uint32_kt length) |
| | Constructor for copying a string from a pointer with a given length.
|
| |
|
template<class B > |
| | basic_string (const B *const c) |
| | Constructor for Unicode and ASCII strings.
|
| |
|
virtual | ~basic_string () |
| | Destructor.
|
| |
|
self_type & | operator= (const self_type &other) |
| | Assignment operator.
|
| |
|
template<class B , class A > |
| self_type & | operator= (const dcpp::nub::basic_string< B, A > &other) |
| | Assignment operator for other string types.
|
| |
|
template<class B > |
| self_type & | operator= (const B *const c) |
| | Assignment operator for strings, ASCII and Unicode.
|
| |
|
self_type | operator+ (const self_type &other) const |
| | Append operator for other strings.
|
| |
|
template<class B > |
| self_type | operator+ (const B *const c) const |
| | Append operator for strings, ASCII and Unicode.
|
| |
|
T & | operator[] (const dcpp::uint32_kt index) |
| | Direct access operator.
|
| |
|
const T & | operator[] (const dcpp::uint32_kt index) const |
| | Direct access operator.
|
| |
|
bool | operator== (const T *const str) const |
| | Equality operator.
|
| |
|
bool | operator== (const self_type &other) const |
| | Equality operator.
|
| |
|
bool | operator< (const self_type &other) const |
| | Is smaller comparator.
|
| |
|
bool | operator!= (const T *const str) const |
| | Inequality operator.
|
| |
|
bool | operator!= (const self_type &other) const |
| | Inequality operator.
|
| |
| dcpp::uint32_kt | size () const |
| | Returns length of the string's content.
|
| |
| bool | empty () const |
| |
|
void | clear (bool releaseMemory=true) |
| |
| const T * | data () const |
| | Returns character string.
|
| |
| std::basic_string< T > | str () const |
| | Returns std::string or std::wstring. The traits_type and allocator_type of the returned std::basic_string are the same as those from std::string or std::wstring.
|
| |
| | operator std::basic_string< T > () const |
| | Returns std::string or std::wstring. The traits_type and allocator_type of the returned std::basic_string are the same as those from std::string or std::wstring. Note that this type operator is marked explicit.
|
| |
|
self_type & | make_lower () |
| | Makes the string lower case.
|
| |
|
self_type & | make_upper () |
| | Makes the string upper case.
|
| |
| bool | equals_ignore_case (const self_type &other) const |
| | Compares the strings ignoring case.
|
| |
| bool | equals_substring_ignore_case (const self_type &other, const dcpp::int32_kt sourcePos=0) const |
| | Compares the strings ignoring case.
|
| |
| bool | lower_ignore_case (const self_type &other) const |
| | Compares the strings ignoring case.
|
| |
| bool | equalsn (const self_type &other, dcpp::uint32_kt n) const |
| | compares the first n characters of the strings
|
| |
| bool | equalsn (const T *const str, dcpp::uint32_kt n) const |
| | compares the first n characters of the strings
|
| |
| self_type & | append (T character) |
| | Appends a character to this string.
|
| |
| self_type & | append (const T *const other, dcpp::uint32_kt length=0xffffffff) |
| | Appends a char string to this string.
|
| |
| self_type & | append (const self_type &other) |
| | Appends a string to this string.
|
| |
| self_type & | append (const self_type &other, dcpp::uint32_kt length) |
| | Appends a string of the length l to this string.
|
| |
|
self_type & | insert (dcpp::uint32_kt pos, const char *s, dcpp::uint32_kt n) |
| | Insert a certain amount of characters into the string before the given index.
|
| |
| void | reserve (dcpp::uint32_kt count) |
| | Reserves some memory.
|
| |
| dcpp::int32_kt | findFirst (T c) const |
| | finds first occurrence of character in string
|
| |
| dcpp::int32_kt | findFirstChar (const T *const c, dcpp::uint32_kt count=1) const |
| | finds first occurrence of a character of a list in string
|
| |
| template<class B > |
| dcpp::int32_kt | findFirstCharNotInList (const B *const c, dcpp::uint32_kt count=1) const |
| | Finds first position of a character not in a given list.
|
| |
| template<class B > |
| dcpp::int32_kt | findLastCharNotInList (const B *const c, dcpp::uint32_kt count=1) const |
| | Finds last position of a character not in a given list.
|
| |
| dcpp::int32_kt | findNext (T c, dcpp::uint32_kt startPos) const |
| | finds next occurrence of character in string
|
| |
| dcpp::int32_kt | findLast (T c, dcpp::int32_kt start=-1) const |
| | finds last occurrence of character in string
|
| |
| dcpp::int32_kt | findLastChar (const T *const c, dcpp::uint32_kt count=1) const |
| | finds last occurrence of a character of a list in string
|
| |
| template<class B > |
| dcpp::int32_kt | find (const B *const str, const dcpp::uint32_kt start=0) const |
| | finds another string in this string
|
| |
| self_type | subString (dcpp::uint32_kt begin, dcpp::int32_kt length, bool make_lower=false) const |
| | Returns a substring.
|
| |
| self_type & | operator+= (T c) |
| | Appends a character to this string.
|
| |
| self_type & | operator+= (const T *const c) |
| | Appends a char string to this string.
|
| |
| self_type & | operator+= (const self_type &other) |
| | Appends a string to this string.
|
| |
| self_type & | operator+= (const int i) |
| | Appends a string representation of a number to this string.
|
| |
| self_type & | operator+= (const unsigned int i) |
| | Appends a string representation of a number to this string.
|
| |
| self_type & | operator+= (const long i) |
| | Appends a string representation of a number to this string.
|
| |
| self_type & | operator+= (const unsigned long i) |
| | Appends a string representation of a number to this string.
|
| |
| self_type & | operator+= (const double i) |
| | Appends a string representation of a number to this string.
|
| |
| self_type & | operator+= (const float i) |
| | Appends a string representation of a number to this string.
|
| |
| self_type & | replace (T toReplace, T replaceWith) |
| | Replaces all characters of a special type with another one.
|
| |
| self_type & | replace (const self_type &toReplace, const self_type &replaceWith) |
| | Replaces all instances of a string with another one.
|
| |
| self_type & | remove (T c) |
| | Removes characters from a string.
|
| |
| self_type & | remove (const self_type &toRemove) |
| | Removes a string from the string.
|
| |
| self_type & | removeChars (const self_type &characters) |
| | Removes characters from a string.
|
| |
| self_type & | trim (const self_type &whitespace=" \t\n\r") |
| | Trims the string.
|
| |
| self_type & | eraseTrailingFloatZeros (char decimalPoint='.') |
| | Erase 0's at the end when a string ends with a floating point number.
|
| |
| self_type & | erase (dcpp::uint32_kt index) |
| | Erases a character from the string.
|
| |
|
self_type & | validate () |
| | verify the existing string.
|
| |
|
T | lastChar () const |
| | gets the last char of a string or null
|
| |
| template<class container > |
| dcpp::uint32_kt | split (container &ret, const T *const delimiter, dcpp::uint32_kt countDelimiters=1, bool ignoreEmptyTokens=true, bool keepSeparators=false) const |
| | Split string into parts (tokens).
|
| |
Very simple string class with some useful features.
basic_string<dcpp::char_kt> and basic_string<wchar_t> both accept Unicode AND ASCII/Latin-1, so you can assign Unicode to basic_string<dcpp::char_kt> and ASCII/Latin-1 to basic_string<wchar_t> (and the other way round) if you want to.
However, note that the conversation between both is not done using any encoding. This means that dcpp::char_kt strings are treated as ASCII/Latin-1, not UTF-8, and are simply expanded to the equivalent wchar_t, while Unicode/wchar_t characters are truncated to 8-bit ASCII/Latin-1 characters, discarding all other information in the wchar_t.
Helper functions for converting between UTF-8 and wchar_t are provided outside the string class for explicit use.