Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QChar class provides a lightweight Unicode character. More...
#include <qstring.h>
The QChar class provides a lightweight Unicode character.
Unicode characters are (so far) 16-bit entities without any markup or structure. This class represents such an entity. It is lightweight, so it can be used everywhere. Most compilers treat it like a "short int." (In a few years it may be necessary to make QChar 32-bit when more than 65536 Unicode code points have been defined and come into use.)
QChar provides a full complement of testing/classification functions, converting to and from other formats, converting from composed to decomposed Unicode, and trying 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; otherwise they return FALSE. These classification 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 Mark), isLetter (a letter), isNumber() (any sort of numeric character), isLetterOrNumber(), and isDigit() (decimal digits). All of these are wrappers around category() which return the Unicode-defined category of each character.
QChar further provides direction(), which indicates the "natural" writing direction of this character. The joining() function indicates how the character joins with its neighbors (needed mostly for Arabic) and finally mirrored(), which indicates whether the 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") by using decomposition().
In Unicode, comparison is not necessarily possible and case conversion is very difficult at best. Unicode, covering the "entire" world, also includes most of the world's 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.
More information can be found in the document About Unicode.
See also QString, QCharRef and Text Related Classes.
This enum maps the Unicode character categories. The following characters are normative in Unicode:
The following categories are informative in Unicode:
There are two categories that are specific to Qt:
This enum defines names for some of the combining classes defined in the Unicode standard. See the Unicode Standard for a more detailed description.
This enum type defines the Unicode decomposition attributes. See the Unicode Standard for a description of the values.
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.
This enum type defines the Unicode decomposition attributes. See the Unicode Standard for a description of the values.
Constructs a null QChar (one that isNull()).
Constructs a QChar corresponding to ASCII/Latin1 character c.
Constructs a QChar corresponding to ASCII/Latin1 character c.
Constructs a QChar for Unicode cell c in row r.
Constructs a copy of c. This is a deep copy, if such a lightweight 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 for the character with Unicode code point rc.
Constructs a QChar for the character with Unicode code point rc.
See also Category.
The Qt text rendering engine uses this information to correctly position non spacing marks around a base character.
See also Direction.
See also isDigit().
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 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 Latin1 character equivalent to the QChar, or 0. This is mainly useful for non-internationalized software.
See also unicode().
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 (e.g. indexing into an array of Unicode information), this function is useful.
Returns a reference to the numeric Unicode value equal to the QChar.
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 c is not the ASCII/Latin1 character ch.
Returns TRUE if the numeric Unicode value of c1 is less than that of c2.
Returns TRUE if the numeric Unicode value of c is less than that of the ASCII/Latin1 character ch.
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 c1 is less than that of c2, or they are the same Unicode character.
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 the ASCII/Latin1 character ch is less than or equal to that of c.
Returns TRUE if c1 and c2 are the same Unicode character.
Returns TRUE if c is the ASCII/Latin1 character ch.
Returns TRUE if c is the ASCII/Latin1 character ch.
Returns TRUE if the numeric Unicode value of c1 is greater than that of c2.
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 the ASCII/Latin1 character ch is greater than that of c.
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 c is greater than or equal to that of the ASCII/Latin1 character ch.
Returns TRUE if the numeric Unicode value of the ASCII/Latin1 character ch is greater than or equal to that of c.
This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta4
|