'\" t
.TH QChar 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QChar \- Lightweight Unicode character
.SH SYNOPSIS
Almost all the functions in this class are reentrant when Qt is built with thread support. The exception is \fBdecomposition\fR().
.PP
\fC#include \fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQChar\fR ()"
.br
.ti -1c
.BI "\fBQChar\fR ( char c )"
.br
.ti -1c
.BI "\fBQChar\fR ( uchar c )"
.br
.ti -1c
.BI "\fBQChar\fR ( uchar c, uchar r )"
.br
.ti -1c
.BI "\fBQChar\fR ( const QChar & c )"
.br
.ti -1c
.BI "\fBQChar\fR ( ushort rc )"
.br
.ti -1c
.BI "\fBQChar\fR ( short rc )"
.br
.ti -1c
.BI "\fBQChar\fR ( uint rc )"
.br
.ti -1c
.BI "\fBQChar\fR ( int rc )"
.br
.ti -1c
.BI "enum \fBCategory\fR { 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_Dash, Punctuation_Dask = Punctuation_Dash, Punctuation_Open, Punctuation_Close, Punctuation_InitialQuote, Punctuation_FinalQuote, Punctuation_Other, Symbol_Math, Symbol_Currency, Symbol_Modifier, Symbol_Other }"
.br
.ti -1c
.BI "enum \fBDirection\fR { DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON, DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN }"
.br
.ti -1c
.BI "enum \fBDecomposition\fR { Single, Canonical, Font, NoBreak, Initial, Medial, Final, Isolated, Circle, Super, Sub, Vertical, Wide, Narrow, Small, Square, Compat, Fraction }"
.br
.ti -1c
.BI "enum \fBJoining\fR { OtherJoining, Dual, Right, Center }"
.br
.ti -1c
.BI "enum \fBCombiningClass\fR { Combining_BelowLeftAttached = 200, Combining_BelowAttached = 202, Combining_BelowRightAttached = 204, Combining_LeftAttached = 208, Combining_RightAttached = 210, Combining_AboveLeftAttached = 212, Combining_AboveAttached = 214, Combining_AboveRightAttached = 216, Combining_BelowLeft = 218, Combining_Below = 220, Combining_BelowRight = 222, Combining_Left = 224, Combining_Right = 226, Combining_AboveLeft = 228, Combining_Above = 230, Combining_AboveRight = 232, Combining_DoubleBelow = 233, Combining_DoubleAbove = 234, Combining_IotaSubscript = 240 }"
.br
.ti -1c
.BI "int \fBdigitValue\fR () const"
.br
.ti -1c
.BI "QChar \fBlower\fR () const"
.br
.ti -1c
.BI "QChar \fBupper\fR () const"
.br
.ti -1c
.BI "Category \fBcategory\fR () const"
.br
.ti -1c
.BI "Direction \fBdirection\fR () const"
.br
.ti -1c
.BI "Joining \fBjoining\fR () const"
.br
.ti -1c
.BI "bool \fBmirrored\fR () const"
.br
.ti -1c
.BI "QChar \fBmirroredChar\fR () const"
.br
.ti -1c
.BI "const QString & \fBdecomposition\fR () const"
.br
.ti -1c
.BI "Decomposition \fBdecompositionTag\fR () const"
.br
.ti -1c
.BI "unsigned char \fBcombiningClass\fR () const"
.br
.ti -1c
.BI "char \fBlatin1\fR () const"
.br
.ti -1c
.BI "ushort \fBunicode\fR () const"
.br
.ti -1c
.BI "ushort & \fBunicode\fR ()"
.br
.ti -1c
.BI "\fBoperator char\fR () const"
.br
.ti -1c
.BI "bool \fBisNull\fR () const"
.br
.ti -1c
.BI "bool \fBisPrint\fR () const"
.br
.ti -1c
.BI "bool \fBisPunct\fR () const"
.br
.ti -1c
.BI "bool \fBisSpace\fR () const"
.br
.ti -1c
.BI "bool \fBisMark\fR () const"
.br
.ti -1c
.BI "bool \fBisLetter\fR () const"
.br
.ti -1c
.BI "bool \fBisNumber\fR () const"
.br
.ti -1c
.BI "bool \fBisLetterOrNumber\fR () const"
.br
.ti -1c
.BI "bool \fBisDigit\fR () const"
.br
.ti -1c
.BI "bool \fBisSymbol\fR () const"
.br
.ti -1c
.BI "uchar \fBcell\fR () const"
.br
.ti -1c
.BI "uchar \fBrow\fR () const"
.br
.in -1c
.SS "Static Public Members"
.in +1c
.ti -1c
.BI "bool networkOrdered () \fI(obsolete)\fR"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "bool \fBoperator==\fR ( QChar c1, QChar c2 )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( char ch, QChar c )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( QChar c, char ch )"
.br
.ti -1c
.BI "int \fBoperator!=\fR ( QChar c1, QChar c2 )"
.br
.ti -1c
.BI "int \fBoperator!=\fR ( char ch, QChar c )"
.br
.ti -1c
.BI "int \fBoperator!=\fR ( QChar c, char ch )"
.br
.ti -1c
.BI "int \fBoperator<=\fR ( QChar c1, QChar c2 )"
.br
.ti -1c
.BI "int \fBoperator<=\fR ( QChar c, char ch )"
.br
.ti -1c
.BI "int \fBoperator<=\fR ( char ch, QChar c )"
.br
.ti -1c
.BI "int \fBoperator>=\fR ( QChar c1, QChar c2 )"
.br
.ti -1c
.BI "int \fBoperator>=\fR ( QChar c, char ch )"
.br
.ti -1c
.BI "int \fBoperator>=\fR ( char ch, QChar c )"
.br
.ti -1c
.BI "int \fBoperator<\fR ( QChar c1, QChar c2 )"
.br
.ti -1c
.BI "int \fBoperator<\fR ( QChar c, char ch )"
.br
.ti -1c
.BI "int \fBoperator<\fR ( char ch, QChar c )"
.br
.ti -1c
.BI "int \fBoperator>\fR ( QChar c1, QChar c2 )"
.br
.ti -1c
.BI "int \fBoperator>\fR ( QChar c, char ch )"
.br
.ti -1c
.BI "int \fBoperator>\fR ( char ch, QChar c )"
.br
.in -1c
.SH DESCRIPTION
The QChar class provides a lightweight Unicode character.
.PP
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.)
.PP
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.
.PP
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.
.PP
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.
.PP
Composed Unicode characters (like å) can be converted to decomposed Unicode ("a" followed by "ring above") by using decomposition().
.PP
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. (See QString::localeAwareCompare() though.)
.PP
The conversion functions include unicode() (to a scalar), latin1() (to scalar, but converts all non-Latin-1 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.
.PP
More information can be found in the document About Unicode.
.PP
See also QString, QCharRef, and Text Related Classes.
.SS "Member Type Documentation"
.SH "QChar::Category"
This enum maps the Unicode character categories.
.PP
The following characters are normative in Unicode:
.TP
\fCQChar::Mark_NonSpacing\fR - Unicode class name Mn
.TP
\fCQChar::Mark_SpacingCombining\fR - Unicode class name Mc
.TP
\fCQChar::Mark_Enclosing\fR - Unicode class name Me
.TP
\fCQChar::Number_DecimalDigit\fR - Unicode class name Nd
.TP
\fCQChar::Number_Letter\fR - Unicode class name Nl
.TP
\fCQChar::Number_Other\fR - Unicode class name No
.TP
\fCQChar::Separator_Space\fR - Unicode class name Zs
.TP
\fCQChar::Separator_Line\fR - Unicode class name Zl
.TP
\fCQChar::Separator_Paragraph\fR - Unicode class name Zp
.TP
\fCQChar::Other_Control\fR - Unicode class name Cc
.TP
\fCQChar::Other_Format\fR - Unicode class name Cf
.TP
\fCQChar::Other_Surrogate\fR - Unicode class name Cs
.TP
\fCQChar::Other_PrivateUse\fR - Unicode class name Co
.TP
\fCQChar::Other_NotAssigned\fR - Unicode class name Cn
.PP
The following categories are informative in Unicode:
.TP
\fCQChar::Letter_Uppercase\fR - Unicode class name Lu
.TP
\fCQChar::Letter_Lowercase\fR - Unicode class name Ll
.TP
\fCQChar::Letter_Titlecase\fR - Unicode class name Lt
.TP
\fCQChar::Letter_Modifier\fR - Unicode class name Lm
.TP
\fCQChar::Letter_Other\fR - Unicode class name Lo
.TP
\fCQChar::Punctuation_Connector\fR - Unicode class name Pc
.TP
\fCQChar::Punctuation_Dash\fR - Unicode class name Pd
.TP
\fCQChar::Punctuation_Open\fR - Unicode class name Ps
.TP
\fCQChar::Punctuation_Close\fR - Unicode class name Pe
.TP
\fCQChar::Punctuation_InitialQuote\fR - Unicode class name Pi
.TP
\fCQChar::Punctuation_FinalQuote\fR - Unicode class name Pf
.TP
\fCQChar::Punctuation_Other\fR - Unicode class name Po
.TP
\fCQChar::Symbol_Math\fR - Unicode class name Sm
.TP
\fCQChar::Symbol_Currency\fR - Unicode class name Sc
.TP
\fCQChar::Symbol_Modifier\fR - Unicode class name Sk
.TP
\fCQChar::Symbol_Other\fR - Unicode class name So
.PP
There are two categories that are specific to Qt:
.TP
\fCQChar::NoCategory\fR - used when Qt is dazed and confused and cannot make sense of anything.
.TP
\fCQChar::Punctuation_Dask\fR - old typo alias for Punctuation_Dash
.SH "QChar::CombiningClass"
This enum type defines names for some of the Unicode combining classes. See the Unicode Standard for a description of the values.
.SH "QChar::Decomposition"
This enum type defines the Unicode decomposition attributes. See the Unicode Standard for a description of the values.
.SH "QChar::Direction"
This enum type defines the Unicode direction attributes. See the Unicode Standard for a description of the values.
.PP
In order to conform to C/C++ naming conventions "Dir" is prepended to the codes used in the Unicode Standard.
.SH "QChar::Joining"
This enum type defines the Unicode joining attributes. See the Unicode Standard for a description of the values.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QChar::QChar ()"
Constructs a null QChar (one that isNull()).
.SH "QChar::QChar ( char c )"
Constructs a QChar corresponding to ASCII/Latin-1 character \fIc\fR.
.SH "QChar::QChar ( uchar c )"
Constructs a QChar corresponding to ASCII/Latin-1 character \fIc\fR.
.SH "QChar::QChar ( uchar c, uchar r )"
Constructs a QChar for Unicode cell \fIc\fR in row \fIr\fR.
.SH "QChar::QChar ( const QChar & c )"
Constructs a copy of \fIc\fR. This is a deep copy, if such a lightweight object can be said to have deep copies.
.SH "QChar::QChar ( ushort rc )"
Constructs a QChar for the character with Unicode code point \fIrc\fR.
.SH "QChar::QChar ( short rc )"
Constructs a QChar for the character with Unicode code point \fIrc\fR.
.SH "QChar::QChar ( uint rc )"
Constructs a QChar for the character with Unicode code point \fIrc\fR.
.SH "QChar::QChar ( int rc )"
Constructs a QChar for the character with Unicode code point \fIrc\fR.
.SH "Category QChar::category () const"
Returns the character category.
.PP
See also Category.
.SH "uchar QChar::cell () const"
Returns the cell (least significant byte) of the Unicode character.
.SH "unsigned char QChar::combiningClass () const"
Returns the combining class for the character as defined in the Unicode standard. This is mainly useful as a positioning hint for marks attached to a base character.
.PP
The Qt text rendering engine uses this information to correctly position non spacing marks around a base character.
.SH "const QString & QChar::decomposition () const"
\fBWarning:\fR This function is \fInot\fR reentrant.
.PP
Decomposes a character into its parts. Returns QString::null if no decomposition exists.
.SH "Decomposition QChar::decompositionTag () const"
Returns the tag defining the composition of the character. Returns QChar::Single if no decomposition exists.
.SH "int QChar::digitValue () const"
Returns the numeric value of the digit, or -1 if the character is not a digit.
.SH "Direction QChar::direction () const"
Returns the character's direction.
.PP
See also Direction.
.SH "bool QChar::isDigit () const"
Returns TRUE if the character is a decimal digit (Number_DecimalDigit); otherwise returns FALSE.
.SH "bool QChar::isLetter () const"
Returns TRUE if the character is a letter (Letter_* categories); otherwise returns FALSE.
.SH "bool QChar::isLetterOrNumber () const"
Returns TRUE if the character is a letter or number (Letter_* or Number_* categories); otherwise returns FALSE.
.SH "bool QChar::isMark () const"
Returns TRUE if the character is a mark (Mark_* categories); otherwise returns FALSE.
.SH "bool QChar::isNull () const"
Returns TRUE if the character is the Unicode character 0x0000 (ASCII NUL); otherwise returns FALSE.
.SH "bool QChar::isNumber () const"
Returns TRUE if the character is a number (of any sort - Number_* categories); otherwise returns FALSE.
.PP
See also isDigit().
.SH "bool QChar::isPrint () const"
Returns TRUE if the character is a printable character; otherwise returns FALSE. This is any character not of category Cc or Cn.
.PP
Note that this gives no indication of whether the character is available in a particular font.
.SH "bool QChar::isPunct () const"
Returns TRUE if the character is a punctuation mark (Punctuation_* categories); otherwise returns FALSE.
.SH "bool QChar::isSpace () const"
Returns TRUE if the character is a separator character (Separator_* categories); otherwise returns FALSE.
.SH "bool QChar::isSymbol () const"
Returns TRUE if the character is a symbol (Symbol_* categories); otherwise returns FALSE.
.SH "Joining QChar::joining () const"
\fBWarning:\fR This function is not supported (it may change to use Unicode character classes).
.PP
Returns information about the joining properties of the character (needed for example, for Arabic).
.SH "char QChar::latin1 () const"
Returns the Latin-1 value of this character, or 0 if it cannot be represented in Latin-1.
.SH "QChar QChar::lower () const"
Returns the lowercase equivalent if the character is uppercase; otherwise returns the character itself.
.SH "bool QChar::mirrored () const"
Returns TRUE if the character is a mirrored character (one that should be reversed if the text direction is reversed); otherwise returns FALSE.
.SH "QChar QChar::mirroredChar () const"
Returns the mirrored character if this character is a mirrored character, otherwise returns the character itself.
.SH "bool QChar::networkOrdered ()\fC [static]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Returns TRUE if this character is in network byte order (MSB first); otherwise returns FALSE. This is platform dependent.
.SH "QChar::operator char () const"
Returns the Latin-1 character equivalent to the QChar, or 0. This is mainly useful for non-internationalized software.
.PP
See also unicode().
.SH "uchar QChar::row () const"
Returns the row (most significant byte) of the Unicode character.
.SH "ushort QChar::unicode () const"
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.
.SH "ushort & QChar::unicode ()"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns a reference to the numeric Unicode value equal to the QChar.
.SH "QChar QChar::upper () const"
Returns the uppercase equivalent if the character is lowercase; otherwise returns the character itself.
.SH RELATED FUNCTION DOCUMENTATION
.SH "int operator!= ( QChar c1, QChar c2 )"
Returns TRUE if \fIc1\fR and \fIc2\fR are not the same Unicode character; otherwise returns FALSE.
.SH "int operator!= ( char ch, QChar c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if \fIc\fR is not the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "int operator!= ( QChar c, char ch )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if \fIc\fR is not the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "int operator< ( QChar c1, QChar c2 )"
Returns TRUE if the numeric Unicode value of \fIc1\fR is less than that of \fIc2\fR; otherwise returns FALSE.
.SH "int operator< ( QChar c, char ch )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of \fIc\fR is less than that of the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "int operator< ( char ch, QChar c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of the ASCII/Latin-1 character \fIch\fR is less than that of \fIc\fR; otherwise returns FALSE.
.SH "int operator<= ( QChar c1, QChar c2 )"
Returns TRUE if the numeric Unicode value of \fIc1\fR is less than that of \fIc2\fR, or they are the same Unicode character; otherwise returns FALSE.
.SH "int operator<= ( QChar c, char ch )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of \fIc\fR is less than or equal to that of the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "int operator<= ( char ch, QChar c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of the ASCII/Latin-1 character \fIch\fR is less than or equal to that of \fIc\fR; otherwise returns FALSE.
.SH "bool operator== ( QChar c1, QChar c2 )"
Returns TRUE if \fIc1\fR and \fIc2\fR are the same Unicode character; otherwise returns FALSE.
.SH "bool operator== ( char ch, QChar c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if \fIc\fR is the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "bool operator== ( QChar c, char ch )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if \fIc\fR is the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "int operator> ( QChar c1, QChar c2 )"
Returns TRUE if the numeric Unicode value of \fIc1\fR is greater than that of \fIc2\fR; otherwise returns FALSE.
.SH "int operator> ( QChar c, char ch )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of \fIc\fR is greater than that of the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "int operator> ( char ch, QChar c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of the ASCII/Latin-1 character \fIch\fR is greater than that of \fIc\fR; otherwise returns FALSE.
.SH "int operator>= ( QChar c1, QChar c2 )"
Returns TRUE if the numeric Unicode value of \fIc1\fR is greater than that of \fIc2\fR, or they are the same Unicode character; otherwise returns FALSE.
.SH "int operator>= ( QChar c, char ch )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of \fIc\fR is greater than or equal to that of the ASCII/Latin-1 character \fIch\fR; otherwise returns FALSE.
.SH "int operator>= ( char ch, QChar c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
character \fIch\fR is greater than or equal to that of \fIc\fR;
otherwise returns FALSE.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qchar.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qchar.3qt) and the Qt
version (3.3.8).