SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Provides transparent read-write access to a code point referenced by an RWUStringIterator. More...
#include <rw/i18n/RWUStringIterator.h>
Public Member Functions | |
RWUChar32Reference (const RWUChar32Reference &) | |
operator RWUChar32 () const | |
RWUChar32Reference & | operator= (RWUChar16 codeUnit) |
RWUChar32Reference & | operator= (RWUChar32 codePoint) |
Friends | |
class | RWUStringIterator |
RWUStringIterator::RWUChar32Reference provides transparent read-write access to a code point referenced by an RWUStringIterator. The code points are made available for read access as RWUChar32 values via the RWUChar32Reference::operator RWUChar32() const conversion.
The code points are made available for write access using two assignment operators. One assignment operator accepts an RWUChar16 value while the other accepts an RWUChar32 value. Both assignment operators properly update the state of both the referenced RWUString and the iterator from which the reference was created. Specifically, the assignment operators ensure that if an assignment is made that changes the length of the referenced RWUString, the RWUString will be updated, and the RWUStringIterator will be updated so as not to be invalidated by the operation. Note, however, that such an assignment may invalidate other iterators, if it changes the number of code units in the string.
RWUStringIterator::RWUChar32Reference objects are obtained from the non-const
dereference operator on RWUStringIterator, and are typically used anonymously. For example:
|
inline |
Constructs an RWUChar32Reference referring to the same code unit as source.
RWUStringIterator::RWUChar32Reference::operator RWUChar32 | ( | ) | const |
Returns the value of the code point referenced by self.
RWBoundsErr | Thrown if the iterator associated with self is invalid. |
RWConversionErr | Thrown if the iterator associated with self points to a code unit sequence that contains an incomplete surrogate pair where either the high surrogate or the low surrogate code unit is missing. |
|
inline |
Replaces the code point referenced by self with the value given for codeUnit and returns a reference to self.
If the operation changes the length of the original RWUString, then both the RWBasicUString and the RWUStringIterator are updated to reflect the change. The iterator is not invalidated. Note, however, that such an assignment may invalidate other iterators, if it changes the number of code units in the string.
RWBoundsErr | Thrown if the iterator associated with self is invalid. |
RWConversionErr | Thrown if the iterator associated with self points to a code unit sequence that contains an incomplete surrogate pair where either the high surrogate or the low surrogate code unit is missing. |
RWUChar32Reference & RWUStringIterator::RWUChar32Reference::operator= | ( | RWUChar32 | codePoint | ) |
Replaces the code point referenced by self with the value given for codePoint and returns a reference to self.
If the operation changes the length of the original RWUString, then both the RWUString and the RWUStringIterator are updated to reflect the change. The iterator is not invalidated. Note, however, that such an assignment may invalidate other iterators, if it changes the number of code units in the string.
RWBoundsErr | Thrown if the iterator associated with self is invalid. |
RWConversionErr | Thrown if the iterator associated with self points to a code unit sequence that contains an incomplete surrogate pair where either the high surrogate or the low surrogate code unit is missing. |
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |