QChar Class Reference

#include <qchar.h>

List of all members.


Detailed Description

The QChar class provides a 16-bit Unicode character.

In Qt, Unicode characters are 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 {unsigned short}.

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 the standard C++ header <cctype> (formerly <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 '\0'), 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, not just 0-9), isLetterOrNumber(), and isDigit() (decimal digits). All of these are wrappers around category() which return the Unicode-defined category of each character.

QChar also 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 hasMirrored(), 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. operator==() and friends will do comparison based purely on the numeric Unicode value (code point) of the characters, and toUpper() and toLower() will do case changes when the character has a well-defined uppercase/lowercase equivalent. For locale-dependent comparisons, use QString::localeAwareCompare().

The conversion functions include unicode() (to a scalar), toLatin1() (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.

QChar provides constructors and cast operators that make it easy to convert to and from traditional 8-bit {char}s. If you defined QT_NO_CAST_FROM_ASCII and QT_NO_CAST_TO_ASCII, as explained in the QString documentation, you will need to explicitly call fromAscii() or fromLatin1(), or use QLatin1Char, to construct a QChar from an 8-bit char, and you will need to call toAscii() or toLatin1() to get the 8-bit value back.

See also:
QString, Unicode, QLatin1Char

Definition at line 47 of file qchar.h.

Public Types

enum  SpecialCharacter
enum  Category
enum  Direction
enum  Decomposition
enum  Joining
enum  CombiningClass
enum  UnicodeVersion

Public Member Functions

 QChar ()
QT_ASCII_CAST_WARN_CONSTRUCTOR QChar (char c)
QT_ASCII_CAST_WARN_CONSTRUCTOR QChar (uchar c)
 QChar (QLatin1Char ch)
 QChar (uchar c, uchar r)
 QChar (ushort rc)
 QChar (short rc)
 QChar (uint rc)
 QChar (int rc)
 QChar (SpecialCharacter sc)
int digitValue () const
QChar toLower () const
QChar toUpper () const
Category category () const
Direction direction () const
Joining joining () const
bool hasMirrored () const
bool isLower () const
bool isUpper () const
QChar mirroredChar () const
QString decomposition () const
Decomposition decompositionTag () const
unsigned char combiningClass () const
UnicodeVersion unicodeVersion () const
const char toAscii () const
const char toLatin1 () const
const ushort unicode () const
ushort & unicode ()
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
bool isSymbol () const
uchar cell () const
uchar row () const
void setCell (uchar cell)
void setRow (uchar row)

Static Public Member Functions

static QChar fromAscii (char c)
static QChar fromLatin1 (char c)

Private Attributes

ushort ucs

Related Functions

(Note that these are not member functions.)

QDataStreamoperator<< (QDataStream &out, const QChar &chr)
QDataStreamoperator>> (QDataStream &in, QChar &chr)
bool operator== (QChar c1, QChar c2)
int operator!= (QChar c1, QChar c2)
int operator<= (QChar c1, QChar c2)
int operator>= (QChar c1, QChar c2)
int operator< (QChar c1, QChar c2)
int operator> (QChar c1, QChar c2)


Member Enumeration Documentation

enum QChar::SpecialCharacter

Null A QChar with this value isNull(). Nbsp Non-breaking space. ReplacementCharacter ObjectReplacementCharacter ByteOrderMark ByteOrderSwapped ParagraphSeparator LineSeparator

null replacement byteOrderMark byteOrderSwapped nbsp

Definition at line 60 of file qchar.h.

00060                           {
00061         Null = 0x0000,
00062         Nbsp = 0x00a0,
00063         ReplacementCharacter = 0xfffd,
00064         ObjectReplacementCharacter = 0xfffc,
00065         ByteOrderMark = 0xfeff,
00066         ByteOrderSwapped = 0xfffe,
00067 #ifdef QT3_SUPPORT
00068         null = Null,
00069         replacement = ReplacementCharacter,
00070         byteOrderMark = ByteOrderMark,
00071         byteOrderSwapped = ByteOrderSwapped,
00072         nbsp = Nbsp,
00073 #endif
00074         ParagraphSeparator = 0x2029,
00075         LineSeparator = 0x2028
00076     };

enum QChar::Category

This enum maps the Unicode character categories.

The following characters are normative in Unicode:

Mark_NonSpacing Unicode class name Mn

Mark_SpacingCombining Unicode class name Mc

Mark_Enclosing Unicode class name Me

Number_DecimalDigit Unicode class name Nd

Number_Letter Unicode class name Nl

Number_Other Unicode class name No

Separator_Space Unicode class name Zs

Separator_Line Unicode class name Zl

Separator_Paragraph Unicode class name Zp

Other_Control Unicode class name Cc

Other_Format Unicode class name Cf

Other_Surrogate Unicode class name Cs

Other_PrivateUse Unicode class name Co

Other_NotAssigned Unicode class name Cn

The following categories are informative in Unicode:

Letter_Uppercase Unicode class name Lu

Letter_Lowercase Unicode class name Ll

Letter_Titlecase Unicode class name Lt

Letter_Modifier Unicode class name Lm

Letter_Other Unicode class name Lo

Punctuation_Connector Unicode class name Pc

Punctuation_Dash Unicode class name Pd

Punctuation_Open Unicode class name Ps

Punctuation_Close Unicode class name Pe

Punctuation_InitialQuote Unicode class name Pi

Punctuation_FinalQuote Unicode class name Pf

Punctuation_Other Unicode class name Po

Symbol_Math Unicode class name Sm

Symbol_Currency Unicode class name Sc

Symbol_Modifier Unicode class name Sk

Symbol_Other Unicode class name So

NoCategory Qt cannot find an appropriate category for the character.

Punctuation_Dask

See also:
category()

Definition at line 81 of file qchar.h.

00082     {
00083         NoCategory,
00084 
00085         Mark_NonSpacing,          //   Mn
00086         Mark_SpacingCombining,    //   Mc
00087         Mark_Enclosing,           //   Me
00088 
00089         Number_DecimalDigit,      //   Nd
00090         Number_Letter,            //   Nl
00091         Number_Other,             //   No
00092 
00093         Separator_Space,          //   Zs
00094         Separator_Line,           //   Zl
00095         Separator_Paragraph,      //   Zp
00096 
00097         Other_Control,            //   Cc
00098         Other_Format,             //   Cf
00099         Other_Surrogate,          //   Cs
00100         Other_PrivateUse,         //   Co
00101         Other_NotAssigned,        //   Cn
00102 
00103         Letter_Uppercase,         //   Lu
00104         Letter_Lowercase,         //   Ll
00105         Letter_Titlecase,         //   Lt
00106         Letter_Modifier,          //   Lm
00107         Letter_Other,             //   Lo
00108 
00109         Punctuation_Connector,    //   Pc
00110         Punctuation_Dash,         //   Pd
00111         Punctuation_Open,         //   Ps
00112         Punctuation_Close,        //   Pe
00113         Punctuation_InitialQuote, //   Pi
00114         Punctuation_FinalQuote,   //   Pf
00115         Punctuation_Other,        //   Po
00116 
00117         Symbol_Math,              //   Sm
00118         Symbol_Currency,          //   Sc
00119         Symbol_Modifier,          //   Sk
00120         Symbol_Other,             //   So
00121 
00122         Punctuation_Dask = Punctuation_Dash // oops
00123     };

enum QChar::Direction

This enum type defines the Unicode direction attributes. See the {http://www.unicode.org/}{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.

DirAL DirAN DirB DirBN DirCS DirEN DirES DirET DirL DirLRE DirLRO DirNSM DirON DirPDF DirR DirRLE DirRLO DirS DirWS

See also:
direction()

Definition at line 125 of file qchar.h.

00126     {
00127         DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
00128         DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
00129     };

enum QChar::Decomposition

This enum type defines the Unicode decomposition attributes. See the {http://www.unicode.org/}{Unicode Standard} for a description of the values.

NoDecomposition Canonical Circle Compat Final Font Fraction Initial Isolated Medial Narrow NoBreak Small Square Sub Super Vertical Wide

Single

See also:
decomposition()

Definition at line 131 of file qchar.h.

00132     {
00133         NoDecomposition,
00134         Canonical,
00135         Font,
00136         NoBreak,
00137         Initial,
00138         Medial,
00139         Final,
00140         Isolated,
00141         Circle,
00142         Super,
00143         Sub,
00144         Vertical,
00145         Wide,
00146         Narrow,
00147         Small,
00148         Square,
00149         Compat,
00150         Fraction
00151 
00152 #ifdef QT3_SUPPORT
00153         , Single = NoDecomposition
00154 #endif
00155     };

enum QChar::Joining

This enum type defines the Unicode joining attributes. See the {http://www.unicode.org/}{Unicode Standard} for a description of the values.

Center Dual OtherJoining Right

See also:
joining()

Definition at line 157 of file qchar.h.

00158     {
00159         OtherJoining, Dual, Right, Center
00160     };

enum QChar::CombiningClass

Definition at line 162 of file qchar.h.

00163     {
00164         Combining_BelowLeftAttached       = 200,
00165         Combining_BelowAttached           = 202,
00166         Combining_BelowRightAttached      = 204,
00167         Combining_LeftAttached            = 208,
00168         Combining_RightAttached           = 210,
00169         Combining_AboveLeftAttached       = 212,
00170         Combining_AboveAttached           = 214,
00171         Combining_AboveRightAttached      = 216,
00172 
00173         Combining_BelowLeft               = 218,
00174         Combining_Below                   = 220,
00175         Combining_BelowRight              = 222,
00176         Combining_Left                    = 224,
00177         Combining_Right                   = 226,
00178         Combining_AboveLeft               = 228,
00179         Combining_Above                   = 230,
00180         Combining_AboveRight              = 232,
00181 
00182         Combining_DoubleBelow             = 233,
00183         Combining_DoubleAbove             = 234,
00184         Combining_IotaSubscript           = 240
00185     };

enum QChar::UnicodeVersion

Specifies which version of the {http://www.unicode.org/}{Unicode standard} introduced a certain character.

Unicode_1_1 Version 1.1. Unicode_2_0 Version 2.0. Unicode_2_1_2 Version 2.1.2. Unicode_3_0 Version 3.0. Unicode_3_1 Version 3.1. Unicode_3_2 Version 3.2. Unicode_4_0 Version 4.0. Unicode_Unassigned The value is not assigned to any character in version 4.0 of Unicode.

See also:
unicodeVersion()

Definition at line 187 of file qchar.h.

00187                         {
00188         Unicode_Unassigned,
00189         Unicode_1_1,
00190         Unicode_2_0,
00191         Unicode_2_1_2,
00192         Unicode_3_0,
00193         Unicode_3_1,
00194         Unicode_3_2,
00195         Unicode_4_0
00196     };


Constructor & Destructor Documentation

QChar::QChar (  )  [inline]

Constructs a null QChar ('\0').

See also:
isNull()

Definition at line 268 of file qchar.h.

Referenced by fromAscii(), and fromLatin1().

00268 : ucs(0) {}

QChar::QChar ( char  ch  ) 

Constructs a QChar corresponding to ASCII/Latin-1 character ch.

Definition at line 403 of file qchar.cpp.

References QString::at(), QTextCodec::codecForCStrings(), QTextCodec::toUnicode(), ucs, and unicode().

00404 {
00405 #ifndef QT_NO_CODEC_FOR_C_STRINGS
00406     if (QTextCodec::codecForCStrings())
00407         // #####
00408         ucs =  QTextCodec::codecForCStrings()->toUnicode(&ch, 1).at(0).unicode();
00409     else
00410 #endif
00411         ucs = uchar(ch);
00412 }

Here is the call graph for this function:

QChar::QChar ( uchar  ch  ) 

Constructs a QChar corresponding to ASCII/Latin-1 character ch.

Definition at line 417 of file qchar.cpp.

References QString::at(), c, QTextCodec::codecForCStrings(), QTextCodec::toUnicode(), ucs, and unicode().

00418 {
00419 #ifndef QT_NO_CODEC_FOR_C_STRINGS
00420     if (QTextCodec::codecForCStrings()) {
00421         // #####
00422         char c = char(ch);
00423         ucs =  QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode();
00424     } else
00425 #endif
00426         ucs = ch;
00427 }

Here is the call graph for this function:

QChar::QChar ( QLatin1Char  ch  )  [inline]

Constructs a QChar corresponding to ASCII/Latin-1 character ch.

Definition at line 278 of file qchar.h.

00278 : ucs(ch.unicode()) {}

QChar::QChar ( uchar  cell,
uchar  row 
) [inline]

Constructs a QChar for Unicode cell cell in row row.

See also:
cell(), row()

Definition at line 273 of file qchar.h.

00273 : ucs((r << 8) | c){}

QChar::QChar ( ushort  code  )  [inline]

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

Definition at line 56 of file qchar.h.

00056 : ucs(rc){}

QChar::QChar ( short  code  )  [inline]

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

Definition at line 274 of file qchar.h.

00274 : ucs(ushort(rc)){}

QChar::QChar ( uint  code  )  [inline]

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

Definition at line 275 of file qchar.h.

00275 : ucs(ushort(rc & 0xffff)){}

QChar::QChar ( int  code  )  [inline]

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

Definition at line 276 of file qchar.h.

00276 : ucs(ushort(rc & 0xffff)){}

QChar::QChar ( SpecialCharacter  ch  )  [inline]

Constructs a QChar for the predefined character value ch.

Definition at line 277 of file qchar.h.

00277 : ucs(ushort(s)) {}


Member Function Documentation

int QChar::digitValue (  )  const

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

Definition at line 593 of file qchar.cpp.

References QUnicodeTables::digitValue(), and ucs.

Referenced by QTextStreamPrivate::getNumber(), hex2int(), Q3TextStream::input_bin(), Q3TextStream::input_dec(), and Q3TextStream::input_oct().

00594 {
00595     return QUnicodeTables::digitValue(ucs);
00596 }

Here is the call graph for this function:

QChar QChar::toLower (  )  const

Returns the lowercase equivalent if the character is uppercase; otherwise returns the character itself.

Definition at line 711 of file qchar.cpp.

References QUnicodeTables::lower().

Referenced by QDateTimeParser::findAmPm(), QTextStreamPrivate::getNumber(), Q3TextDocument::hasPrefix(), QRegExpMatchState::matchHere(), QCssScanner_Generated::next(), QLocalePrivate::numberToCLocale(), QTextHtmlParser::parseEntity(), qdesigner_internal::WidgetBoxTreeView::qtify(), qdesigner_internal::QDesignerResource::qtify(), and Driver::qtify().

00712 {
00713      return QUnicodeTables::lower(*this);
00714 }

Here is the call graph for this function:

QChar QChar::toUpper (  )  const

Returns the uppercase equivalent if the character is lowercase; otherwise returns the character itself.

Definition at line 720 of file qchar.cpp.

References QUnicodeTables::upper().

Referenced by QDateTimeParser::findAmPm(), getFmtString(), hasUnquotedAP(), QMenu::keyPressEvent(), qt_accHotKey(), qdesigner_internal::WidgetBoxTreeView::qtify(), qdesigner_internal::QDesignerResource::qtify(), and translateKeySym().

00721 {
00722      return QUnicodeTables::upper(*this);
00723 }

Here is the call graph for this function:

QChar::Category QChar::category (  )  const

Returns the character's category.

Definition at line 601 of file qchar.cpp.

References QUnicodeTables::category().

Referenced by fastDetermineNameChar(), QDateTimeParser::findAmPm(), and QRegExpCharClass::in().

00602 {
00603     return QUnicodeTables::category(*this);
00604 }

Here is the call graph for this function:

QChar::Direction QChar::direction (  )  const

Returns the character's direction.

Definition at line 609 of file qchar.cpp.

References QUnicodeTables::direction().

00610 {
00611      return QUnicodeTables::direction(*this);
00612 }

Here is the call graph for this function:

QChar::Joining QChar::joining (  )  const

Returns information about the joining properties of the character (needed for certain languages such as Arabic).

Definition at line 620 of file qchar.cpp.

References QUnicodeTables::joining().

00621 {
00622     return QUnicodeTables::joining(*this);
00623 }

Here is the call graph for this function:

bool QChar::hasMirrored (  )  const

Returns true if the character should be reversed if the text direction is reversed; otherwise returns false.

See also:
mirroredChar()

Definition at line 632 of file qchar.cpp.

References QUnicodeTables::mirrored().

00633 {
00634     return QUnicodeTables::mirrored(*this);
00635 }

Here is the call graph for this function:

bool QChar::isLower (  )  const [inline]

Returns true if the character is a lowercase letter, i.e. category() is Letter_Lowercase.

See also:
isUpper(), toLower(), toUpper()

Definition at line 207 of file qchar.h.

References QUnicodeTables::category().

00207 { return category() == Letter_Lowercase; }

Here is the call graph for this function:

bool QChar::isUpper (  )  const [inline]

Returns true if the character is an uppercase letter, i.e. category() is Letter_Uppercase.

See also:
isLower(), toUpper(), toLower()

Definition at line 208 of file qchar.h.

References QUnicodeTables::category().

Referenced by getFmtString(), QSettingsPrivate::iniUnescapedKey(), and qDBusGenerateMetaObjectXml().

00208 { return category() == Letter_Uppercase; }

Here is the call graph for this function:

QChar QChar::mirroredChar (  )  const

Returns the mirrored character if this character is a mirrored character; otherwise returns the character itself.

See also:
hasMirrored()

Definition at line 661 of file qchar.cpp.

References QUnicodeTables::mirroredChar().

Referenced by QCharRef::mirroredChar().

00662 {
00663     return QUnicodeTables::mirroredChar(*this);
00664 }

Here is the call graph for this function:

QString QChar::decomposition (  )  const

Decomposes a character into its parts. Returns an empty string if no decomposition exists.

Definition at line 670 of file qchar.cpp.

References QUnicodeTables::decomposition(), and ucs.

00671 {
00672     return QUnicodeTables::decomposition(ucs);
00673 }

Here is the call graph for this function:

QChar::Decomposition QChar::decompositionTag (  )  const

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

Definition at line 679 of file qchar.cpp.

References QUnicodeTables::decompositionTag(), and ucs.

00680 {
00681     return QUnicodeTables::decompositionTag(ucs);
00682 }

Here is the call graph for this function:

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.

The Qt text rendering engine uses this information to correctly position non-spacing marks around a base character.

Definition at line 692 of file qchar.cpp.

References QUnicodeTables::combiningClass().

00693 {
00694     return QUnicodeTables::combiningClass(*this);
00695 }

Here is the call graph for this function:

QChar::UnicodeVersion QChar::unicodeVersion (  )  const

Returns the Unicode version that introduced this character.

Definition at line 701 of file qchar.cpp.

References ucs, and QUnicodeTables::unicodeVersion().

00702 {
00703     return QUnicodeTables::unicodeVersion(ucs);
00704 }

Here is the call graph for this function:

const char QChar::toAscii (  )  const

Returns the character value of the QChar obtained using the current codec used to read C strings, or 0 if the character is not representable using this codec. The default codec handles Latin-1 encoded text, but this can be changed to assist developers writing source code using other encodings.

The main purpose of this function is to preserve ASCII characters used in C strings. This is mainly useful for developers of non-internationalized software.

See also:
toLatin1(), unicode(), QTextCodec::codecForCStrings()

Definition at line 759 of file qchar.cpp.

References QByteArray::at(), QTextCodec::codecForCStrings(), QTextCodec::fromUnicode(), and ucs.

00760 {
00761 #ifndef QT_NO_CODEC_FOR_C_STRINGS
00762     if (QTextCodec::codecForCStrings())
00763         // #####
00764         return QTextCodec::codecForCStrings()->fromUnicode(QString(*this)).at(0);
00765 #endif
00766     return ucs > 0xff ? 0 : char(ucs);
00767 }

Here is the call graph for this function:

const char QChar::toLatin1 (  )  const [inline]

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

See also:
toAscii(), unicode(), QTextCodec::codecForCStrings()

Definition at line 270 of file qchar.h.

References ucs.

Referenced by decode_pos(), QRegExp::escape(), QDesignerMenu::handleKeyPressEvent(), QDesignerMenuBar::handleKeyPressEvent(), Q3TextStream::input_hex(), Q3TextStream::input_int(), QTest::keyClicks(), main(), QLocalePrivate::numberToCLocale(), QTextStream::operator>>(), Q3TextStream::operator>>(), parseCmdLine(), QDateTimeParser::parseFormat(), parsePathDataFast(), QCss::Scanner::preprocess(), and toDouble().

00270 { return ucs > 0xff ? '\0' : char(ucs); }

ushort QChar::unicode (  )  const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 222 of file qchar.h.

Referenced by QString::append(), QXmlSimpleReaderPrivate::atEnd(), QLineEdit::backspace(), Q3TextFormatter::bidiReorderLine(), calcLineBreaks(), QUnicodeTables::combiningClass(), QSimpleTextCodec::convertFromUnicode(), QUtf8Codec::convertFromUnicode(), QLatin15Codec::convertFromUnicode(), QLatin15Codec::convertToUnicode(), QUtf16Codec::convertToUnicode(), QAbstractFormBuilder::createProperty(), QRegExpEngine::createState(), QTextCursor::deletePreviousChar(), QLocalePrivate::doubleToString(), QPdfBaseEnginePrivate::drawTextItem(), fastDetermineNameChar(), fromAscii(), QRegExpEngine::getChar(), getChar(), getKhmerCharClass(), getMessage(), getMyanmarCharClass(), QTextStreamPrivate::getNumber(), hangul_nextSyllableBoundary(), hangul_shape_syllable(), heuristicSetGlyphAttributes(), QRegExpCharClass::in(), QSettingsPrivate::iniEscapedString(), QString::insert(), is_S(), isBidirectionalL(), isMappedToNothing(), QUnicodeTables::isMark(), QUnicodeTables::isSpace(), khmer_nextSyllableBoundary(), QCssScanner_Generated::lex(), QUnicodeTables::lineBreakClass(), mappedToLowerCase(), myanmar_nextSyllableBoundary(), myanmar_shape_syllable(), QXmlSimpleReaderPrivate::next(), QLocalePrivate::numberToCLocale(), operator!=(), operator<(), operator<<(), operator<=(), operator==(), operator>(), operator>=(), operator>>(), Q3TextParagraph::paint(), parsePathDataFast(), QKeyMapper::possibleKeys(), QKeyMapperPrivate::possibleKeysCore(), QKeyMapperPrivate::possibleKeysXKB(), QChar(), QString::QString(), qulltoa(), QUnicodeTables::script(), QUrlPrivate::setAuthority(), PathDeformRenderer::setText(), strippedOfProhibitedOutput(), timeFormatContainsAP(), QUrl::toPunycode(), QKeyMapperPrivate::translateKeyEvent(), translateKeySym(), QCharRef::unicode(), QLocalePrivate::updateSystemPrivate(), Q3TextFormat::width(), and xpmHash().

00222 { return ucs; }

ushort & QChar::unicode (  )  [inline]

Returns a reference to the numberic Unicode value of the QChar.

Definition at line 226 of file qchar.h.

00226 { return ucs; }

QChar QChar::fromAscii ( char  c  )  [static]

Converts the ASCII character c to its equivalent QChar. This is mainly useful for non-internationalized software.

An alternative is to use QLatin1Char.

See also:
fromLatin1(), unicode(), QTextCodec::codecForCStrings()

Definition at line 786 of file qchar.cpp.

References QString::at(), QTextCodec::codecForCStrings(), QChar(), QTextCodec::toUnicode(), and unicode().

Referenced by convert(), operator+(), QString::operator+=(), QTextStream::operator<<(), QCharRef::operator=(), and QString::operator=().

00787 {
00788 #ifndef QT_NO_CODEC_FOR_C_STRINGS
00789     if (QTextCodec::codecForCStrings())
00790         // #####
00791         return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode();
00792 #endif
00793     return QChar(ushort((uchar)c));
00794 }

Here is the call graph for this function:

QChar QChar::fromLatin1 ( char  c  )  [inline, static]

Converts the Latin-1 character c to its equivalent QChar. This is mainly useful for non-internationalized software.

See also:
fromAscii(), unicode(), QTextCodec::codecForCStrings()

Definition at line 271 of file qchar.h.

References QChar().

Referenced by QTest::sendKeyEvent().

00271 { return QChar(ushort(uchar(c))); }

Here is the call graph for this function:

bool QChar::isNull (  )  const [inline]

Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false.

Definition at line 232 of file qchar.h.

Referenced by QUrlPrivate::createErrorString(), QLineEditPrivate::findInMask(), QTextHtmlParser::parseEntity(), QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate(), qt_accHotKey(), and QDateTimeParser::sectionFormat().

00232 { return ucs == 0; }

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.

Note that this gives no indication of whether the character is available in a particular font.

Definition at line 500 of file qchar.cpp.

References c, QUnicodeTables::category(), Other_Control, and Other_NotAssigned.

Referenced by QTextControlPrivate::keyPressEvent(), and QDoubleSpinBoxPrivate::validateAndInterpret().

00501 {
00502     Category c = QUnicodeTables::category(*this);
00503     return c != Other_Control && c != Other_NotAssigned;
00504 }

Here is the call graph for this function:

bool QChar::isPunct (  )  const

Returns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns false.

Definition at line 529 of file qchar.cpp.

References c, QUnicodeTables::category(), Punctuation_Connector, and Punctuation_Other.

00530 {
00531     Category c = QUnicodeTables::category(*this);
00532     return (c >= Punctuation_Connector && c <= Punctuation_Other);
00533 }

Here is the call graph for this function:

bool QChar::isSpace (  )  const

Returns true if the character is a separator character (Separator_* categories); otherwise returns false.

Definition at line 510 of file qchar.cpp.

References QUnicodeTables::isSpace().

Referenced by Q3TextFormatter::bidiReorderLine(), QTextHtmlParser::eatSpace(), QDateTimeParser::findDay(), QSqlDriver::formatValue(), Qt::mightBeRichText(), QTextHtmlParser::parse(), parseCombinedArgString(), parseNumbersList(), parsePercentageList(), QDateTimeParser::parseSection(), QTextHtmlParser::parseTag(), parseTransformationMatrix(), QString::simplified(), and QDoubleSpinBoxPrivate::validateAndInterpret().

00511 {
00512     return QUnicodeTables::isSpace(*this);
00513 }

Here is the call graph for this function:

bool QChar::isMark (  )  const

Returns true if the character is a mark (Mark_* categories); otherwise returns false.

Definition at line 519 of file qchar.cpp.

References c, QUnicodeTables::category(), Mark_Enclosing, and Mark_NonSpacing.

Referenced by indic_shape_syllable(), and isWord().

00520 {
00521     Category c = QUnicodeTables::category(*this);
00522     return c >= Mark_NonSpacing && c <= Mark_Enclosing;
00523 }

Here is the call graph for this function:

bool QChar::isLetter (  )  const

Returns true if the character is a letter (Letter_* categories); otherwise returns false.

Definition at line 539 of file qchar.cpp.

References c, QUnicodeTables::category(), Letter_Other, and Letter_Uppercase.

Referenced by indic_shape_syllable().

00540 {
00541     Category c = QUnicodeTables::category(*this);
00542     return (c >= Letter_Uppercase && c <= Letter_Other);
00543 }

Here is the call graph for this function:

bool QChar::isNumber (  )  const

Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns false.

See also:
isDigit()

Definition at line 551 of file qchar.cpp.

References c, QUnicodeTables::category(), Number_DecimalDigit, and Number_Other.

00552 {
00553     Category c = QUnicodeTables::category(*this);
00554     return c >= Number_DecimalDigit && c <= Number_Other;
00555 }

Here is the call graph for this function:

bool QChar::isLetterOrNumber (  )  const

Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise returns false.

Definition at line 561 of file qchar.cpp.

References c, QUnicodeTables::category(), Letter_Other, Letter_Uppercase, Number_DecimalDigit, and Number_Other.

Referenced by isWord(), QFileListBox::keyPressEvent(), and Q3FileDialogQFileListView::keyPressEvent().

00562 {
00563     Category c = QUnicodeTables::category(*this);
00564     return (c >= Letter_Uppercase && c <= Letter_Other)
00565         || (c >= Number_DecimalDigit && c <= Number_Other);
00566 }

Here is the call graph for this function:

bool QChar::isDigit (  )  const

Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false.

Definition at line 573 of file qchar.cpp.

References QUnicodeTables::category(), and Number_DecimalDigit.

Referenced by QTextStreamPrivate::getNumber(), Driver::headerFileName(), and hex2int().

00574 {
00575     return (QUnicodeTables::category(*this) == Number_DecimalDigit);
00576 }

Here is the call graph for this function:

bool QChar::isSymbol (  )  const

Returns true if the character is a symbol (Symbol_* categories); otherwise returns false.

Definition at line 583 of file qchar.cpp.

References c, QUnicodeTables::category(), Symbol_Math, and Symbol_Other.

00584 {
00585     Category c = QUnicodeTables::category(*this);
00586     return c >= Symbol_Math && c <= Symbol_Other;
00587 }

Here is the call graph for this function:

uchar QChar::cell (  )  const [inline]

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

See also:
row()

Definition at line 243 of file qchar.h.

Referenced by bm_find(), bm_init_skiptable(), heuristicSetGlyphAttributes(), hex2int(), operator<<(), QXmlSimpleReaderPrivate::parseContent(), QXmlSimpleReaderPrivate::parseReference(), shapedString(), and Q3AccelManager::tryComposeUnicode().

00243 { return uchar(ucs & 0xff); }

uchar QChar::row (  )  const [inline]

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

See also:
cell()

Definition at line 244 of file qchar.h.

Referenced by operator<<(), QXmlSimpleReaderPrivate::parseContent(), QXmlSimpleReaderPrivate::parseReference(), shapedString(), and Q3AccelManager::tryComposeUnicode().

00244 { return uchar((ucs>>8)&0xff); }

void QChar::setCell ( uchar  cell  )  [inline]

Definition at line 280 of file qchar.h.

References ucs.

Referenced by QUtf16Codec::convertToUnicode().

00281 { ucs = (ucs & 0xff00) + acell; }

void QChar::setRow ( uchar  row  )  [inline]

Definition at line 282 of file qchar.h.

References ucs.

Referenced by QUtf16Codec::convertToUnicode().

00283 { ucs = (ushort(arow)<<8) + (ucs&0xff); }


Friends And Related Function Documentation

QDataStream & operator<< ( QDataStream out,
const QChar chr 
) [related]

Writes the char chr to the stream out.

See also:
{Format of the QDataStream operators}

Definition at line 805 of file qchar.cpp.

References unicode().

00806 {
00807     out << quint16(chr.unicode());
00808     return out;
00809 }

Here is the call graph for this function:

QDataStream & operator>> ( QDataStream in,
QChar chr 
) [related]

Reads a char from the stream in into char chr.

See also:
{Format of the QDataStream operators}

Definition at line 820 of file qchar.cpp.

References u, and unicode().

00821 {
00822     quint16 u;
00823     in >> u;
00824     chr.unicode() = ushort(u);
00825     return in;
00826 }

Here is the call graph for this function:

bool operator== ( QChar  c1,
QChar  c2 
) [related]

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Definition at line 285 of file qchar.h.

00285 { return c1.unicode() == c2.unicode(); }

int operator!= ( QChar  c1,
QChar  c2 
) [related]

Returns true if c1 and c2 are not the same Unicode character; otherwise returns false.

Definition at line 286 of file qchar.h.

00286 { return c1.unicode() != c2.unicode(); }

int operator<= ( QChar  c1,
QChar  c2 
) [related]

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

Definition at line 287 of file qchar.h.

00287 { return c1.unicode() <= c2.unicode(); }

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

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

Definition at line 288 of file qchar.h.

00288 { return c1.unicode() >= c2.unicode(); }

int operator< ( QChar  c1,
QChar  c2 
) [related]

Returns true if the numeric Unicode value of c1 is less than that of c2; otherwise returns false.

Definition at line 289 of file qchar.h.

00289 { return c1.unicode() < c2.unicode(); }

int operator> ( QChar  c1,
QChar  c2 
) [related]

Returns true if the numeric Unicode value of c1 is greater than that of c2; otherwise returns false.

Definition at line 290 of file qchar.h.

00290 { return c1.unicode() > c2.unicode(); }


Member Data Documentation

ushort QChar::ucs [private]

Definition at line 263 of file qchar.h.

Referenced by decomposition(), decompositionTag(), digitValue(), QChar(), setCell(), setRow(), toAscii(), toLatin1(), and unicodeVersion().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 16:58:10 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1