The ICharacterReference class is a simple proxy class for accessing characters safely. This class is used in IText and ITextIterator's APIs wherever a non-constant UniChar& would otherwise be used. Changing a character through an ICharacterReference is safer and more efficient than changing a character through a UniChar& because:
ICharacterReference has no public constructors. The user must create an ICharacterReference using the [] operator or at() function on IText or the * or [] operator of one of the ITextIterator classes.
Do not derive from this class.
Use the destructor in this group to destroy objects of class ICharacterReference.
![]() |
public:
~ICharacterReference()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use the assignment operators in this group to replace the character referred to in the current ICharacterReference object with the given one specified by the that or newChar parameter.
![]() |
public:
ICharacterReference& operator =(UniChar newChar)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
ICharacterReference& operator =( const ICharacterReference& that )
someText[i] = someText[j]
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these functions to get a pointer to the text referred to or its offset.
![]() |
public:
size_t offset() const
Returns the character offset within its IText of the character the ICharacterReference refers to.
Note: ICharacterReference is implemented as a single pointer to a UniChar when possible, and as a pointer to an IText and a character offset the rest of the time. When an ICharacterReference holds a pointer to a character, this function returns (size_t)(-1) and the value returned by text() is not valid. (Consider this function to be obsolete.)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IText* text() const
Returns a pointer to the IText the ICharacterReference refers to.
Note: ICharacterReference is implemented as a single pointer to a UniChar when possible, and as a pointer to an IText and a character offset the rest of the time. Therefore, the value returned by this function may not be valid. To determine whether this value is valid, check the value returned by offset(). If it's (size_t)(-1), the value returned by text() is invalid. (Consider this function to be obsolete.)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
ICharacterReference(const ICharacterReference& that)
operator UniChar() const