Qt 4.8
Public Functions | Private Functions | Properties | Friends | List of all members
QCharRef Class Reference

The QCharRef class is a helper class for QString. More...

#include <qstring.h>

Public Functions

QChar::Category category () const
 
uchar cell () const
 
uchar combiningClass () const
 
QString decomposition () const
 
QChar::Decomposition decompositionTag () const
 
int digitValue () const
 
QChar::Direction direction () const
 
bool hasMirrored () const
 
bool isDigit () const
 
bool isLetter () const
 
bool isLetterOrNumber ()
 
bool isLower () const
 
bool isMark () const
 
bool isNull () const
 
bool isNumber () const
 
bool isPrint () const
 
bool isPunct () const
 
bool isSpace () const
 
bool isTitleCase () const
 
bool isUpper () const
 
QChar::Joining joining () const
 
QChar mirroredChar () const
 
 operator QChar () const
 
QCharRefoperator= (const QChar &c)
 
QT_ASCII_CAST_WARN QCharRefoperator= (char c)
 
QT_ASCII_CAST_WARN QCharRefoperator= (uchar c)
 
QCharRefoperator= (const QCharRef &c)
 
QCharRefoperator= (ushort rc)
 
QCharRefoperator= (short rc)
 
QCharRefoperator= (uint rc)
 
QCharRefoperator= (int rc)
 
uchar row () const
 
void setCell (uchar cell)
 
void setRow (uchar row)
 
char toAscii () const
 
char toLatin1 () const
 
QChar toLower () const
 
QChar toTitleCase () const
 
QChar toUpper () const
 
ushort unicode () const
 
ushortunicode ()
 
QChar::UnicodeVersion unicodeVersion () const
 

Private Functions

 QCharRef (QString &str, int idx)
 

Properties

int i
 
QStrings
 

Friends

class QString
 

Detailed Description

The QCharRef class is a helper class for QString.

Note
This class or function is reentrant.
Warning
This function is not part of the public interface.

When you get an object of type QCharRef, if you can assign to it, the assignment will apply to the character in the string from which you got the reference. That is its whole purpose in life. The QCharRef becomes invalid once modifications are made to the string: if you want to keep the character, copy it into a QChar.

Most of the QChar member functions also exist in QCharRef. However, they are not explicitly documented here.

See also
QString::operator[]() QString::at() QChar

Definition at line 785 of file qstring.h.

Constructors and Destructors

◆ QCharRef()

QCharRef::QCharRef ( QString str,
int  idx 
)
inlineprivate

Definition at line 788 of file qstring.h.

789  : s(str),i(idx) {}
QString & s
Definition: qstring.h:786
int i
Definition: qstring.h:787

Functions

◆ category()

QChar::Category QCharRef::category ( ) const
inline

Definition at line 834 of file qstring.h.

834 { return QChar(*this).category(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
Category category() const
Returns the character&#39;s category.
Definition: qchar.cpp:853

◆ cell()

uchar QCharRef::cell ( ) const
inline

Definition at line 845 of file qstring.h.

845 { return QChar(*this).cell(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
uchar cell() const
Returns the cell (least significant byte) of the Unicode character.
Definition: qchar.h:283

◆ combiningClass()

uchar QCharRef::combiningClass ( ) const
inline

Definition at line 841 of file qstring.h.

841 { return QChar(*this).combiningClass(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
unsigned char combiningClass() const
Returns the combining class for the character as defined in the Unicode standard. ...
Definition: qchar.cpp:1153

◆ decomposition()

QString QCharRef::decomposition ( ) const
inline

Definition at line 839 of file qstring.h.

839 { return QChar(*this).decomposition(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QString decomposition() const
Decomposes a character into its parts.
Definition: qchar.cpp:1096

◆ decompositionTag()

QChar::Decomposition QCharRef::decompositionTag ( ) const
inline

Definition at line 840 of file qstring.h.

840 { return QChar(*this).decompositionTag(); }
Decomposition decompositionTag() const
Returns the tag defining the composition of the character.
Definition: qchar.cpp:1122
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72

◆ digitValue()

int QCharRef::digitValue ( ) const
inline

Definition at line 829 of file qstring.h.

829 { return QChar(*this).digitValue(); }
int digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
Definition: qchar.cpp:817
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72

◆ direction()

QChar::Direction QCharRef::direction ( ) const
inline

Definition at line 835 of file qstring.h.

835 { return QChar(*this).direction(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
Direction direction() const
Returns the character&#39;s direction.
Definition: qchar.cpp:889

◆ hasMirrored()

bool QCharRef::hasMirrored ( ) const
inline

Definition at line 837 of file qstring.h.

837 { return QChar(*this).hasMirrored(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool hasMirrored() const
Returns true if the character should be reversed if the text direction is reversed; otherwise returns...
Definition: qchar.cpp:968

◆ isDigit()

bool QCharRef::isDigit ( ) const
inline

Definition at line 824 of file qstring.h.

824 { return QChar(*this).isDigit(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isDigit() const
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false...
Definition: qchar.cpp:699

◆ isLetter()

bool QCharRef::isLetter ( ) const
inline

Definition at line 821 of file qstring.h.

821 { return QChar(*this).isLetter(); }
bool isLetter() const
Returns true if the character is a letter (Letter_* categories); otherwise returns false...
Definition: qchar.cpp:653
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72

◆ isLetterOrNumber()

bool QCharRef::isLetterOrNumber ( )
inline

Definition at line 823 of file qstring.h.

823 { return QChar(*this).isLetterOrNumber(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isLetterOrNumber() const
Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise retu...
Definition: qchar.cpp:681

◆ isLower()

bool QCharRef::isLower ( ) const
inline

Definition at line 825 of file qstring.h.

825 { return QChar(*this).isLower(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isLower() const
Returns true if the character is a lowercase letter, i.
Definition: qchar.h:272

◆ isMark()

bool QCharRef::isMark ( ) const
inline

Definition at line 820 of file qstring.h.

820 { return QChar(*this).isMark(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isMark() const
Returns true if the character is a mark (Mark_* categories); otherwise returns false.
Definition: qchar.cpp:625

◆ isNull()

bool QCharRef::isNull ( ) const
inline

Definition at line 816 of file qstring.h.

816 { return QChar(*this).isNull(); }
bool isNull() const
Returns true if the character is the Unicode character 0x0000 (&#39;\0&#39;); otherwise returns false...
Definition: qchar.h:262
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72

◆ isNumber()

bool QCharRef::isNumber ( ) const
inline

Definition at line 822 of file qstring.h.

822 { return QChar(*this).isNumber(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isNumber() const
Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns fals...
Definition: qchar.cpp:669

◆ isPrint()

bool QCharRef::isPrint ( ) const
inline

Definition at line 817 of file qstring.h.

817 { return QChar(*this).isPrint(); }
bool isPrint() const
Returns true if the character is a printable character; otherwise returns false.
Definition: qchar.cpp:598
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72

◆ isPunct()

bool QCharRef::isPunct ( ) const
inline

Definition at line 818 of file qstring.h.

818 { return QChar(*this).isPunct(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isPunct() const
Returns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns fal...
Definition: qchar.cpp:637

◆ isSpace()

bool QCharRef::isSpace ( ) const
inline

Definition at line 819 of file qstring.h.

819 { return QChar(*this).isSpace(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
Definition: qchar.cpp:609

◆ isTitleCase()

bool QCharRef::isTitleCase ( ) const
inline

Definition at line 827 of file qstring.h.

827 { return QChar(*this).isTitleCase(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isTitleCase() const
Returns true if the character is a titlecase letter, i.
Definition: qchar.h:274

◆ isUpper()

bool QCharRef::isUpper ( ) const
inline

Definition at line 826 of file qstring.h.

826 { return QChar(*this).isUpper(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
bool isUpper() const
Returns true if the character is an uppercase letter, i.
Definition: qchar.h:273

◆ joining()

QChar::Joining QCharRef::joining ( ) const
inline

Definition at line 836 of file qstring.h.

836 { return QChar(*this).joining(); }
Joining joining() const
Returns information about the joining properties of the character (needed for certain languages such ...
Definition: qchar.cpp:924
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72

◆ mirroredChar()

QChar QCharRef::mirroredChar ( ) const
inline

Definition at line 838 of file qstring.h.

838 { return QChar(*this).mirroredChar(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar mirroredChar() const
Returns the mirrored character if this character is a mirrored character; otherwise returns the chara...
Definition: qchar.cpp:1016

◆ operator QChar()

QCharRef::operator QChar ( ) const
inline

Definition at line 796 of file qstring.h.

797  { return i < s.d->size ? s.d->data[i] : 0; }
QString & s
Definition: qstring.h:786
int i
Definition: qstring.h:787
Data * d
Definition: qstring.h:618
ushort * data
Definition: qstring.h:606

◆ operator=() [1/8]

QCharRef& QCharRef::operator= ( const QChar c)
inline

Definition at line 798 of file qstring.h.

799  { if (i >= s.d->size) s.expand(i); else s.detach();
800  s.d->data[i] = c.unicode(); return *this; }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
QString & s
Definition: qstring.h:786
void expand(int i)
Definition: qstring.cpp:1477
int i
Definition: qstring.h:787
void detach()
Definition: qstring.h:714
Data * d
Definition: qstring.h:618
ushort * data
Definition: qstring.h:606

◆ operator=() [2/8]

QT_ASCII_CAST_WARN QCharRef& QCharRef::operator= ( char  c)
inline

Definition at line 804 of file qstring.h.

805  { return operator=(QChar::fromAscii(c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798
static QChar fromAscii(char c)
Converts the ASCII character c to its equivalent QChar.
Definition: qchar.cpp:1521

◆ operator=() [3/8]

QT_ASCII_CAST_WARN QCharRef& QCharRef::operator= ( uchar  c)
inline

Definition at line 806 of file qstring.h.

807  { return operator=(QChar::fromAscii(c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798
static QChar fromAscii(char c)
Converts the ASCII character c to its equivalent QChar.
Definition: qchar.cpp:1521

◆ operator=() [4/8]

QCharRef& QCharRef::operator= ( const QCharRef c)
inline

Definition at line 809 of file qstring.h.

Referenced by operator=().

809 { return operator=(QChar(c)); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798

◆ operator=() [5/8]

QCharRef& QCharRef::operator= ( ushort  rc)
inline

Definition at line 810 of file qstring.h.

Referenced by operator=().

810 { return operator=(QChar(rc)); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798

◆ operator=() [6/8]

QCharRef& QCharRef::operator= ( short  rc)
inline

Definition at line 811 of file qstring.h.

Referenced by operator=().

811 { return operator=(QChar(rc)); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798

◆ operator=() [7/8]

QCharRef& QCharRef::operator= ( uint  rc)
inline

Definition at line 812 of file qstring.h.

Referenced by operator=().

812 { return operator=(QChar(rc)); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798

◆ operator=() [8/8]

QCharRef& QCharRef::operator= ( int  rc)
inline

Definition at line 813 of file qstring.h.

Referenced by operator=().

813 { return operator=(QChar(rc)); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QCharRef & operator=(const QChar &c)
Definition: qstring.h:798

◆ row()

uchar QCharRef::row ( ) const
inline

Definition at line 846 of file qstring.h.

846 { return QChar(*this).row(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
uchar row() const
Returns the row (most significant byte) of the Unicode character.
Definition: qchar.h:284

◆ setCell()

void QCharRef::setCell ( uchar  cell)
inline

Definition at line 876 of file qstring.h.

876 { QChar(*this).setCell(acell); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
void setCell(uchar cell)
Definition: qchar.h:387

◆ setRow()

void QCharRef::setRow ( uchar  row)
inline

Definition at line 875 of file qstring.h.

875 { QChar(*this).setRow(arow); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
void setRow(uchar row)
Definition: qchar.h:389

◆ toAscii()

char QCharRef::toAscii ( ) const
inline

Definition at line 855 of file qstring.h.

855 { return QChar(*this).toAscii(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
char toAscii() const
Returns the character value of the QChar obtained using the current codec used to read C strings...
Definition: qchar.cpp:1490

◆ toLatin1()

char QCharRef::toLatin1 ( ) const
inline

Definition at line 856 of file qstring.h.

856 { return QChar(*this).toLatin1(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
char toLatin1() const
Returns the Latin-1 character equivalent to the QChar, or 0.
Definition: qchar.h:376

◆ toLower()

QChar QCharRef::toLower ( ) const
inline

Definition at line 830 of file qstring.h.

830 { return QChar(*this).toLower(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239

◆ toTitleCase()

QChar QCharRef::toTitleCase ( ) const
inline

Definition at line 832 of file qstring.h.

832 { return QChar(*this).toTitleCase(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar toTitleCase() const
Returns the title case equivalent if the character is lowercase or uppercase; otherwise returns the c...
Definition: qchar.cpp:1335

◆ toUpper()

QChar QCharRef::toUpper ( ) const
inline

Definition at line 831 of file qstring.h.

831 { return QChar(*this).toUpper(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1287

◆ unicode() [1/2]

ushort QCharRef::unicode ( ) const
inline

Definition at line 857 of file qstring.h.

857 { return QChar(*this).unicode(); }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72

◆ unicode() [2/2]

ushort& QCharRef::unicode ( )
inline

Definition at line 859 of file qstring.h.

859 { return s.data()[i].unicode(); }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
QString & s
Definition: qstring.h:786
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
int i
Definition: qstring.h:787

◆ unicodeVersion()

QChar::UnicodeVersion QCharRef::unicodeVersion ( ) const
inline

Definition at line 843 of file qstring.h.

843 { return QChar(*this).unicodeVersion(); }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
UnicodeVersion unicodeVersion() const
Returns the Unicode version that introduced this character.
Definition: qchar.cpp:1189

Friends and Related Functions

◆ QString

friend class QString
friend

Definition at line 790 of file qstring.h.

Properties

◆ i

int QCharRef::i
private

Definition at line 787 of file qstring.h.

◆ s

QString& QCharRef::s
private

Definition at line 786 of file qstring.h.


The documentation for this class was generated from the following file: