ISLEman
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | Related Functions | List of all members
QChar Class Reference

The QChar class provides a light-weight Unicode character. More...

#include <qstring.h>

Public Types

enum  Category {
  NoCategory, Mark_NonSpacing, Mark_SpacingCombining, Mark_Enclosing,
  Number_DecimalDigit, Number_Letter, Number_Other, Separator_Space,
  Separator_Line, Separator_Paragraph, Other_Control, Other_Format,
  Other_Surrogate, Other_PrivateUse, Other_NotAssigned, Letter_Uppercase,
  Letter_Lowercase, Letter_Titlecase, Letter_Modifier, Letter_Other,
  Punctuation_Connector, Punctuation_Dask, Punctuation_Open, Punctuation_Close,
  Punctuation_InitialQuote, Punctuation_FinalQuote, Punctuation_Other, Symbol_Math,
  Symbol_Currency, Symbol_Modifier, Symbol_Other
}
 
enum  Direction {
  DirL, DirR, DirEN, DirES,
  DirET, DirAN, DirCS, DirB,
  DirS, DirWS, DirON, DirLRE,
  DirLRO, DirAL, DirRLE, DirRLO,
  DirPDF, DirNSM, DirBN
}
 
enum  Decomposition {
  Single, Canonical, Font, NoBreak,
  Initial, Medial, Final, Isolated,
  Circle, Super, Sub, Vertical,
  Wide, Narrow, Small, Square,
  Compat, Fraction
}
 
enum  Joining { OtherJoining, Dual, Right, Center }
 

Public Member Functions

 QChar ()
 
 QChar (char c)
 
 QChar (uchar c)
 
 QChar (uchar c, uchar r)
 
 QChar (const QChar &c)
 
 QChar (ushort rc)
 
 QChar (short rc)
 
 QChar (uint rc)
 
 QChar (int rc)
 
int digitValue () const
 
QChar lower () const
 
QChar upper () const
 
Category category () const
 
Direction direction () const
 
Joining joining () const
 
bool mirrored () const
 
QChar mirroredChar () const
 
QString decomposition () const
 
Decomposition decompositionTag () const
 
char latin1 () const
 
ushort unicode () const
 
 operator char () const
 
bool isNull () const
 
bool isPrint () const
 
bool isPunct () const
 
bool isSpace () const
 
bool isMark () const
 
bool isLetter () const
 
bool isNumber () const
 
bool isLetterOrNumber () const
 
bool isDigit () const
 
uchar & cell ()
 
uchar & row ()
 
uchar cell () const
 
uchar row () const
 

Static Public Member Functions

static bool networkOrdered ()
 

Public Attributes

QT_STATIC_CONST QChar null
 
QT_STATIC_CONST QChar replacement
 
QT_STATIC_CONST QChar byteOrderMark
 
QT_STATIC_CONST QChar byteOrderSwapped
 
QT_STATIC_CONST QChar nbsp
 

Friends

int operator== (char ch, QChar c)
 
int operator== (QChar c, char ch)
 
int operator== (QChar c1, QChar c2)
 
int operator!= (QChar c1, QChar c2)
 
int operator!= (char ch, QChar c)
 
int operator!= (QChar c, char ch)
 
int operator<= (QChar c, char ch)
 
int operator<= (char ch, QChar c)
 
int operator<= (QChar c1, QChar c2)
 

Related Functions

(Note that these are not member functions.)

int operator>= (QChar c1, QChar c2)
 
int operator>= (QChar c, char ch)
 
int operator>= (char ch, QChar c)
 
int operator< (QChar c1, QChar c2)
 
int operator< (QChar c, char ch)
 
int operator< (char ch, QChar c)
 
int operator> (QChar c1, QChar c2)
 
int operator> (QChar c, char ch)
 
int operator> (char ch, QChar c)
 

Detailed Description

The QChar class provides a light-weight Unicode character.

Unicode characters are (so far) 16-bit entities without any markup or structure. This class represents such an entity. It is rather light-weight, so it can be used everywhere. Most compilers treat it approximately like "short int". (In a few years, it may be necessary to make QChar 32-bit, once more than 65536 Unicode code points have been defined and come into use.)

QChar provides a full complement of testing/classification functions, conversion to and from other formats, from composed to decomposed unicode, and will try to compare and case-convert if you ask it to.

The classification functions include functions like those in ctype.h, but operating on the full range of unicode characters. They all return TRUE if the character is a certain type of character, and FALSE otherwise.

These functions are: isNull() (returns TRUE if the character is U+0000), isPrint() (TRUE if the character is any sort of printable character, including whitespace), isPunct() (any sort of punctation), isMark() (Unicode Marks), isLetter (letters), isNumber() (any sort of numeric characters), isLetterOrNumber(), and isDigit() (decimal digits). All of these are wrappers around category(), which returns the unicode-defined category of each character.

QChar further provides direction(), which indicates the "natural" writing direction of this character, joining(), which indicates how this character joins with its neighbors (needed mostly for Arabic) and finally mirrored(), which indicates whether this character needs to be mirrored when it is printed in its unnatural writing direction.

Composed Unicode characters (like å) can be converted to decomposed Unicode ("a" followed by "ring above") using decomposition().

In Unicode, comparison is not necessarily possible, and case conversion is at best very hard. Unicode, covering the "entire" globe, also includes a globe-sized collection of case and sorting problems. Qt tries, but not very hard: operator== and friends will do comparison based purely on the numeric Unicode value (code point) of the characters, and upper() and lower() will do case changes when the character has a well-defined upper/lower-case equivalent. There is no provision for locale-dependent case folding rules or comparison: These functions are meant to be fast, so they can be used unambiguously in data structures.

The conversion functions include unicode() (to a scalar), latin1() (to scalar, but converts all non-Latin1 characters to 0), row() (gives the Unicode row), cell() (gives the unicode cell), digitValue() (gives the integer value of any of the numerous digit characters), and a host of constructors.

See also
QString QCharRef About Unicode

Member Enumeration Documentation

§ Category

This enum maps the Unicode character categories. The currently known categories are:

  • NoCategory - used when Qt is dazed and confused and cannot make sense of anything.

  • Mark_NonSpacing - (Mn) -

  • Mark_SpacingCombining - (Mc) -

  • Mark_Enclosing - (Me) -

  • Number_DecimalDigit - (Nd) -

  • Number_Letter - (Nl) -

  • Number_Other - (No) -

  • Separator_Space - (Zs) -

  • Separator_Line - (Zl) -

  • Separator_Paragraph - (Zp) -

  • Other_Control - (Cc) -

  • Other_Format - (Cf) -

  • Other_Surrogate - (Cs) -

  • Other_PrivateUse - (Co) -

  • Other_NotAssigned - (Cn) -

  • Letter_Uppercase - (Lu) -

  • Letter_Lowercase - (Ll) -

  • Letter_Titlecase - (Lt) -

  • Letter_Modifier - (Lm) -

  • Letter_Other - (Lo) -

  • Punctuation_Connector - (Pc) -

  • Punctuation_Dask - (Pd) -

  • Punctuation_Open - (Ps) -

  • Punctuation_Close - (Pe) -

  • Punctuation_InitialQuote - (Pi) -

  • Punctuation_FinalQuote - (Pf) -

  • Punctuation_Other - (Po) -

  • Symbol_Math - (Sm) -

  • Symbol_Currency - (Sc) -

  • Symbol_Modifier - (Sk) -

  • Symbol_Other - (So) -

§ Decomposition

This enum type defines the Unicode decomposition attributes. See the Unicode Standard for a description of the values.

§ Direction

This enum type defines the Unicode direction attributes. See the Unicode Standard for a description of the values.

In order to conform to C/C++ naming conventions "Dir" is prepended to the codes used in The Unicode Standard.

§ Joining

This enum type defines the Unicode decomposition attributes. See the Unicode Standard for a description of the values.

Constructor & Destructor Documentation

§ QChar() [1/9]

QChar::QChar ( )
inline

Constructs a null QChar (one that isNull()).

§ QChar() [2/9]

QChar::QChar ( char  c)
inline

Constructs a QChar corresponding to ASCII/Latin1 character c.

§ QChar() [3/9]

QChar::QChar ( uchar  c)
inline

Constructs a QChar corresponding to ASCII/Latin1 character c.

§ QChar() [4/9]

QChar::QChar ( uchar  c,
uchar  r 
)
inline

Constructs a QChar for Unicode cell c in row r.

§ QChar() [5/9]

QChar::QChar ( const QChar c)
inline

Constructs a copy of c. This is a deep copy, if such a light-weight object can be said to have deep copies.

§ QChar() [6/9]

QChar::QChar ( ushort  rc)
inline

Constructs a QChar for the character with Unicode code point rc.

§ QChar() [7/9]

QChar::QChar ( short  rc)
inline

Constructs a QChar for the character with Unicode code point rc.

§ QChar() [8/9]

QChar::QChar ( uint  rc)
inline

Constructs a QChar for the character with Unicode code point rc.

§ QChar() [9/9]

QChar::QChar ( int  rc)
inline

Constructs a QChar for the character with Unicode code point rc.

Member Function Documentation

§ category()

QChar::Category QChar::category ( ) const

Returns the character category.

See also
Category

§ cell() [1/2]

uchar & QChar::cell ( )
inline

Returns a reference to the cell (least significant byte) of the Unicode character.

§ cell() [2/2]

uchar QChar::cell ( ) const
inline

Returns the cell (least significant byte) of the Unicode character.

§ decomposition()

QString QChar::decomposition ( ) const

Decomposes a character into its parts. Returns QString::null if no decomposition exists.

§ decompositionTag()

QChar::Decomposition QChar::decompositionTag ( ) const

Returns the tag defining the composition of the character. Returns QChar::Single if no decomposition exists.

§ digitValue()

int QChar::digitValue ( ) const

Returns the numeric value of the digit, or -1 if the character is not a digit.

§ direction()

QChar::Direction QChar::direction ( ) const

Returns the characters directionality.

See also
Direction

§ isDigit()

bool QChar::isDigit ( ) const

Returns whether the character is a decimal digit (Number_DecimalDigit).

§ isLetter()

bool QChar::isLetter ( ) const

Returns whether the character is a letter (Letter_* categories).

§ isLetterOrNumber()

bool QChar::isLetterOrNumber ( ) const

Returns whether the character is a letter or number (Letter_* or Number_* categories).

§ isMark()

bool QChar::isMark ( ) const

Returns whether the character is a mark (Mark_* categories).

§ isNull()

bool QChar::isNull ( ) const
inline

Returns TRUE if the characters is the unicode character 0x0000, ie. ASCII NUL.

§ isNumber()

bool QChar::isNumber ( ) const

Returns whether the character is a number (of any sort - Number_* categories).

See also
isDigit()

§ isPrint()

bool QChar::isPrint ( ) const

Returns whether the character is a printable character. This is any character not of category Cc or Cn. Note that this gives no indication of whether the character is available in some font.

§ isPunct()

bool QChar::isPunct ( ) const

Returns whether the character is punctuation (Punctuation_* categories).

§ isSpace()

bool QChar::isSpace ( ) const

Returns whether the character is a separator character (Separator_* categories).

§ joining()

QChar::Joining QChar::joining ( ) const

This function is not supported (it may change to use Unicode character classes).

Returns information about the joining properties of the character (needed for arabic).

§ latin1()

char QChar::latin1 ( ) const
inline

Returns a latin-1 copy of this character, if this character is in the latin-1 character set. If not, this function returns 0.

§ lower()

QChar QChar::lower ( ) const

Returns the lowercase equivalent if the character is uppercase, or the character itself otherwise.

§ mirrored()

bool QChar::mirrored ( ) const

Returns whether the character is a mirrored character (one that should be reversed if the text direction is reversed).

§ mirroredChar()

QChar QChar::mirroredChar ( ) const

Returns the mirrored char if this character is a mirrored char, the char itself otherwise

§ networkOrdered()

bool QChar::networkOrdered ( )
inlinestatic

Returns TRUE if this character is in network byte order (MSB first), and FALSE if it is not. This is a platform-dependent property, so we strongly advise against using this function in portable code.

§ operator char()

QChar::operator char ( ) const
inline

Returns the Latin1 character equivalent to the QChar, or 0. This is mainly useful for non-internationalized software.

See also
unicode()

§ row() [1/2]

uchar & QChar::row ( )
inline

Returns a reference to the row (most significant byte) of the Unicode character.

§ row() [2/2]

uchar QChar::row ( ) const
inline

Returns the row (most significant byte) of the Unicode character.

§ unicode()

ushort QChar::unicode ( ) const
inline

Returns the numeric Unicode value equal to the QChar. Normally, you should use QChar objects as they are equivalent, but for some low-level tasks (eg. indexing into an array of Unicode information), this function is useful.

§ upper()

QChar QChar::upper ( ) const

Returns the uppercase equivalent if the character is lowercase, or the character itself otherwise.

Friends And Related Function Documentation

§ operator!= [1/3]

int operator!= ( QChar  c1,
QChar  c2 
)
friend

Returns TRUE if c1 and c2 are not the same Unicode character.

§ operator!= [2/3]

int operator!= ( char  ch,
QChar  c 
)
friend

Returns TRUE if c is not the ASCII/Latin1 character ch.

§ operator!= [3/3]

int operator!= ( QChar  c,
char  ch 
)
friend

Returns TRUE if c is not the ASCII/Latin1 character ch.

§ operator<() [1/3]

int operator< ( QChar  c1,
QChar  c2 
)
related

Returns TRUE if the numeric Unicode value of c1 is less than that of c2.

§ operator<() [2/3]

int operator< ( QChar  c,
char  ch 
)
related

Returns TRUE if the numeric Unicode value of c is less than that of the ASCII/Latin1 character ch.

§ operator<() [3/3]

int operator< ( char  ch,
QChar  c 
)
related

Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is less than that of c.

§ operator<= [1/3]

int operator<= ( QChar  c,
char  ch 
)
friend

Returns TRUE if the numeric Unicode value of c is less than or equal to that of the ASCII/Latin1 character ch.

§ operator<= [2/3]

int operator<= ( char  ch,
QChar  c 
)
friend

Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is less than or equal to that of c.

§ operator<= [3/3]

int operator<= ( QChar  c1,
QChar  c2 
)
friend

Returns TRUE if the numeric Unicode value of c1 is less than that of c2, or they are the same Unicode character.

§ operator== [1/3]

int operator== ( char  ch,
QChar  c 
)
friend

Returns TRUE if c is the ASCII/Latin1 character ch.

§ operator== [2/3]

int operator== ( QChar  c,
char  ch 
)
friend

Returns TRUE if c is the ASCII/Latin1 character ch.

§ operator== [3/3]

int operator== ( QChar  c1,
QChar  c2 
)
friend

Returns TRUE if c1 and c2 are the same Unicode character.

§ operator>() [1/3]

int operator> ( QChar  c1,
QChar  c2 
)
related

Returns TRUE if the numeric Unicode value of c1 is greater than that of c2.

§ operator>() [2/3]

int operator> ( QChar  c,
char  ch 
)
related

Returns TRUE if the numeric Unicode value of c is greater than that of the ASCII/Latin1 character ch.

§ operator>() [3/3]

int operator> ( char  ch,
QChar  c 
)
related

Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is greater than that of c.

§ operator>=() [1/3]

int operator>= ( QChar  c1,
QChar  c2 
)
related

Returns TRUE if the numeric Unicode value of c1 is greater than that of c2, or they are the same Unicode character.

§ operator>=() [2/3]

int operator>= ( QChar  c,
char  ch 
)
related

Returns TRUE if the numeric Unicode value of c is greater than or equal to that of the ASCII/Latin1 character ch.

§ operator>=() [3/3]

int operator>= ( char  ch,
QChar  c 
)
related

Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is greater than or equal to that of c.


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