The QChar class provides a light-weight Unicode character. More...
#include <qstring.h>
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 and About Unicode
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) -
In order to conform to C/C++ naming conventions "Dir" is prepended to the codes used in The Unicode Standard.
Constructs a null QChar (one that isNull()).
Constructs a QChar corresponding to ASCII/Latin1 character c.
Constructs a copy of c. This is a deep copy, if such a light-weight object can be said to have deep copies.
Constructs a QChar for the character with Unicode code point rc.
Constructs a QChar for the character with Unicode code point rc.
Constructs a QChar corresponding to ASCII/Latin1 character c.
Constructs a QChar for Unicode cell c in row r.
Constructs a QChar for the character with Unicode code point rc.
Constructs a QChar for the character with Unicode code point rc.
Returns the Latin1 character equivalent to the QChar, or 0. This is mainly useful for non-internationalized software.
See also unicode().
Returns the character category.
See also Category.
Returns the cell (least significant byte) of the Unicode character.
Returns a reference to the cell (least significant byte) of the Unicode character.
Decomposes a character into its parts. Returns QString::null if no decomposition exists.
Returns the tag defining the composition of the character. Returns QChar::Single if no decomposition exists.
Returns the numeric value of the digit, or -1 if the character is not a digit.
Returns the characters directionality.
See also Direction.
Returns whether the character is a decimal digit (Number_DecimalDigit).
Returns whether the character is a letter (Letter_* categories).
Returns whether the character is a letter or number (Letter_* or Number_* categories).
Returns whether the character is a mark (Mark_* categories).
Returns TRUE if the characters is the unicode character 0x0000, ie. ASCII NUL.
Returns whether the character is a number (of any sort - Number_* categories).
See also isDigit().
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.
Returns whether the character is punctuation (Punctuation_* categories).
Returns whether the character is a separator character (Separator_* categories).
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).
Returns a latin-1 copy of this character, if this character is in the latin-1 character set. If not, this function returns 0.
Returns the lowercase equivalent if the character is uppercase, or the character itself otherwise.
Returns whether the character is a mirrored character (one that should be reversed if the text direction is reversed).
Returns the mirrored char if this character is a mirrored char, the char itself otherwise.
[static]
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.
Returns the row (most significant byte) of the Unicode character.
Returns a reference to the row (most significant byte) of the Unicode character.
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.
Returns the uppercase equivalent if the character is lowercase, or the character itself otherwise.
Returns TRUE if the numeric Unicode value of c is less than or equal to that of the ASCII/Latin1 character ch.
Returns TRUE if the numeric Unicode value of c1 is greater than that of c2, or they are the same Unicode character.
Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is greater than or equal to that of c.
Returns TRUE if c is not the ASCII/Latin1 character ch.
Returns TRUE if the numeric Unicode value of c is greater than or equal to that of the ASCII/Latin1 character ch.
Returns TRUE if c1 and c2 are not the same Unicode character.
Returns TRUE if c is not the ASCII/Latin1 character ch.
Returns TRUE if the numeric Unicode value of c1 is less than that of c2, or they are the same Unicode character.
Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is greater than that of c.
Returns TRUE if the numeric Unicode value of c1 is less than that of c2.
Returns TRUE if c1 and c2 are the same Unicode character.
Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is less than or equal to that of c.
Returns TRUE if the numeric Unicode value of c1 is greater than that of c2.
Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is less than that of c.
Returns TRUE if the numeric Unicode value of c is greater than that of the ASCII/Latin1 character ch.
Returns TRUE if the numeric Unicode value of c is less than that of the ASCII/Latin1 character ch.
Returns TRUE if c is the ASCII/Latin1 character ch.
Returns TRUE if c is the ASCII/Latin1 character ch.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright © 2000 Trolltech | Trademarks | Qt version 2.2.1
|