UtfString
|
An iterator that iterates through the code points in a UTF-8 string, but allowing only access to constant code points. More...
#include <Utf8String.h>
Inherits iterator< std::random_access_iterator_tag, Utf8Char >.
Public Member Functions | |
const_iterator (const std::string &basicString, const std::string::const_iterator &basicStringIterator) | |
Constructs an iterator for Utf8String using the base class iterator. More... | |
const_iterator (const Utf8String::iterator &otherIterator) | |
Constructs an iterator for Utf8String using a non-constant iterator. More... | |
const_iterator (const Utf8String::const_iterator &otherIterator) | |
Constructs an iterator for Utf8String using another constant iterator. More... | |
const_iterator (const Utf8String::const_reverse_iterator &reverseIterator) | |
Constructs an constant iterator for Utf8String using a constant reverse iterator. More... | |
~const_iterator () | |
Cleans up before the iterator is destroyed. | |
const_iterator & | operator= (const const_iterator &otherIterator) |
Assigns the value of another iterator to this iterator. More... | |
bool | operator== (const const_iterator &otherIterator) const |
Compares this iterator with another iterator and tests for equality. More... | |
bool | operator!= (const const_iterator &otherIterator) const |
Compares this iterator with another iterator and tests for inequality. More... | |
bool | operator< (const const_iterator &otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes before the other iterator in the string. More... | |
bool | operator<= (const const_iterator &otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes before or is at the same position the other iterator in the string. More... | |
bool | operator> (const const_iterator &otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes after the other iterator in the string. More... | |
bool | operator>= (const const_iterator &otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes after or is at the same position the other iterator in the string. More... | |
const_iterator & | operator++ () |
Increments this iterator to the next position in the Utf8String. More... | |
const_iterator | operator++ (int) |
Increments this iterator to the next position in the Utf8String. More... | |
const_iterator & | operator+= (size_t offset) |
Increments this iterator by a specific offset. More... | |
const_iterator | operator+ (size_t offset) |
Creates an iterator that has the position of this iterator incremented by a specific offset. More... | |
const_iterator & | operator-- () |
Decrements this iterator to the previous position in the Utf8String. More... | |
const_iterator | operator-- (int) |
Decrements this iterator to the previous position in the Utf8String. More... | |
const_iterator & | operator-= (size_t offset) |
Decrements this iterator by a specific offset. More... | |
const_iterator | operator- (size_t offset) |
Creates an iterator that has the position of this iterator decremented by a specific offset. More... | |
const Utf8Char | operator* () |
Gets the character at the position of this iterator. More... | |
const Utf8Char * | operator-> () |
Gets a pointer to the character at the position of this iterator. More... | |
An iterator that iterates through the code points in a UTF-8 string, but allowing only access to constant code points.
This iterator assumes that the UTF-8 string being iterated over is a valid UTF-8 string.
UtfString::Utf8String::const_iterator::const_iterator | ( | const std::string & | basicString, |
const std::string::const_iterator & | basicStringIterator | ||
) |
Constructs an iterator for Utf8String using the base class iterator.
This function assumes that basicStringIterator is a valid iterator
[in] | basicString | A reference to the string that basicStringIterator points to |
[in] | basicStringIterator | The base class iterator to use in constructing this iterator |
UtfString::Utf8String::const_iterator::const_iterator | ( | const Utf8String::iterator & | otherIterator) |
Constructs an iterator for Utf8String using a non-constant iterator.
This iterator will take on the same characteristics and position as the other iterator
[in] | otherIterator | The other iterator to use in constructing this iterator |
UtfString::Utf8String::const_iterator::const_iterator | ( | const Utf8String::const_iterator & | otherIterator) |
Constructs an iterator for Utf8String using another constant iterator.
This iterator will take on the same characteristics and position as the other iterator
[in] | otherIterator | The other iterator to use in constructing this iterator |
UtfString::Utf8String::const_iterator::const_iterator | ( | const Utf8String::const_reverse_iterator & | reverseIterator) |
Constructs an constant iterator for Utf8String using a constant reverse iterator.
This constant iterator will take on the same position as the constant reverse iterator.
[in] | reverseIterator | The constant reverse iterator to use in constructing this constant iterator |
bool UtfString::Utf8String::const_iterator::operator!= | ( | const const_iterator & | otherIterator) | const |
Compares this iterator with another iterator and tests for inequality.
[in] | otherIterator | The other iterator to be compared with this iterator |
const Utf8Char UtfString::Utf8String::const_iterator::operator* | ( | ) |
Gets the character at the position of this iterator.
If this iterator is not pointing to a position in a Utf8String, the result will be undefined.
The reference returned by this function will be invalidated if the iterator is changed in any way. Changing the value of the returned object will not change the string.
const_iterator UtfString::Utf8String::const_iterator::operator+ | ( | size_t | offset) |
Creates an iterator that has the position of this iterator incremented by a specific offset.
Note that since a UTF-8 string contains variable-width characters, we have to iterate over the code units. As a result, this operator has a performance of O(N). Hence, this operator should be used with care.
[in] | offset | The offset to be used when incrementing this position of this iterator |
const_iterator& UtfString::Utf8String::const_iterator::operator++ | ( | ) |
Increments this iterator to the next position in the Utf8String.
This is the prefix operator.
const_iterator UtfString::Utf8String::const_iterator::operator++ | ( | int | ) |
Increments this iterator to the next position in the Utf8String.
This is a postfix operator.
const_iterator& UtfString::Utf8String::const_iterator::operator+= | ( | size_t | offset) |
Increments this iterator by a specific offset.
Note that since a UTF-8 string contains variable-width characters, we have to iterate over the code units. As a result, this operator has a performance of O(N). Hence, this operator should be used with care.
[in] | offset | The offset to use in incrementing this iterator |
const_iterator UtfString::Utf8String::const_iterator::operator- | ( | size_t | offset) |
Creates an iterator that has the position of this iterator decremented by a specific offset.
Note that since a UTF-8 string contains variable-width characters, we have to iterate over the code units. As a result, this operator has a performance of O(N). Hence, this operator should be used with care.
[in] | offset | The offset to use in decrementing the position of this iterator |
const_iterator& UtfString::Utf8String::const_iterator::operator-- | ( | ) |
Decrements this iterator to the previous position in the Utf8String.
This is a prefix operator.
const_iterator UtfString::Utf8String::const_iterator::operator-- | ( | int | ) |
Decrements this iterator to the previous position in the Utf8String.
This is a postfix operator.
const_iterator& UtfString::Utf8String::const_iterator::operator-= | ( | size_t | offset) |
Decrements this iterator by a specific offset.
Note that since a UTF-8 string contains variable-width characters, we have to iterate over the code units. As a result, this operator has a performance of O(N). Hence, this operator should be used with care.
[in] | offset | The offset to use in decrementing this iterator |
const Utf8Char* UtfString::Utf8String::const_iterator::operator-> | ( | ) |
Gets a pointer to the character at the position of this iterator.
If this iterator is not pointing to a position in a Utf8String, the result will be undefined.
The pointer returned by this function will be invalidated if the iterator is changed in any way.
bool UtfString::Utf8String::const_iterator::operator< | ( | const const_iterator & | otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes before the other iterator in the string.
This operator has a performance of O(1).
[in] | otherIterator | The other iterator to be compared with this iterator |
bool UtfString::Utf8String::const_iterator::operator<= | ( | const const_iterator & | otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes before or is at the same position the other iterator in the string.
This operator has a performance of O(1).
[in] | otherIterator | The other iterator to be compared with this iterator |
const_iterator& UtfString::Utf8String::const_iterator::operator= | ( | const const_iterator & | otherIterator) |
Assigns the value of another iterator to this iterator.
This iterator will take on the same characteristics and position as the other iterator
[in] | otherIterator | The other iterator to be assigned to this iterator |
bool UtfString::Utf8String::const_iterator::operator== | ( | const const_iterator & | otherIterator) | const |
Compares this iterator with another iterator and tests for equality.
[in] | otherIterator | The other iterator to be compared with this iterator |
bool UtfString::Utf8String::const_iterator::operator> | ( | const const_iterator & | otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes after the other iterator in the string.
This operator has a performance of O(1).
[in] | otherIterator | The other iterator to be compared with this iterator |
bool UtfString::Utf8String::const_iterator::operator>= | ( | const const_iterator & | otherIterator) |
Compares this iterator to another iterator and tests whether this iterator comes after or is at the same position the other iterator in the string.
This operator has a performance of O(1).
[in] | otherIterator | The other iterator to be compared with this iterator |