1QChar(3qt) QChar(3qt)
2
3
4
6 QChar - Lightweight Unicode character
7
9 Almost all the functions in this class are reentrant when Qt is built
10 with thread support. The exception is decomposition(). </p>
11
12 #include <qstring.h>
13
14 Public Members
15 QChar ()
16 QChar ( char c )
17 QChar ( uchar c )
18 QChar ( uchar c, uchar r )
19 QChar ( const QChar & c )
20 QChar ( ushort rc )
21 QChar ( short rc )
22 QChar ( uint rc )
23 QChar ( int rc )
24 enum Category { NoCategory, Mark_NonSpacing, Mark_SpacingCombining,
25 Mark_Enclosing, Number_DecimalDigit, Number_Letter, Number_Other,
26 Separator_Space, Separator_Line, Separator_Paragraph,
27 Other_Control, Other_Format, Other_Surrogate, Other_PrivateUse,
28 Other_NotAssigned, Letter_Uppercase, Letter_Lowercase,
29 Letter_Titlecase, Letter_Modifier, Letter_Other,
30 Punctuation_Connector, Punctuation_Dash, Punctuation_Dask =
31 Punctuation_Dash, Punctuation_Open, Punctuation_Close,
32 Punctuation_InitialQuote, Punctuation_FinalQuote,
33 Punctuation_Other, Symbol_Math, Symbol_Currency, Symbol_Modifier,
34 Symbol_Other }
35 enum Direction { DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB,
36 DirS, DirWS, DirON, DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF,
37 DirNSM, DirBN }
38 enum Decomposition { Single, Canonical, Font, NoBreak, Initial, Medial,
39 Final, Isolated, Circle, Super, Sub, Vertical, Wide, Narrow, Small,
40 Square, Compat, Fraction }
41 enum Joining { OtherJoining, Dual, Right, Center }
42 enum CombiningClass { Combining_BelowLeftAttached = 200,
43 Combining_BelowAttached = 202, Combining_BelowRightAttached = 204,
44 Combining_LeftAttached = 208, Combining_RightAttached = 210,
45 Combining_AboveLeftAttached = 212, Combining_AboveAttached = 214,
46 Combining_AboveRightAttached = 216, Combining_BelowLeft = 218,
47 Combining_Below = 220, Combining_BelowRight = 222, Combining_Left =
48 224, Combining_Right = 226, Combining_AboveLeft = 228,
49 Combining_Above = 230, Combining_AboveRight = 232,
50 Combining_DoubleBelow = 233, Combining_DoubleAbove = 234,
51 Combining_IotaSubscript = 240 }
52 int digitValue () const
53 QChar lower () const
54 QChar upper () const
55 Category category () const
56 Direction direction () const
57 Joining joining () const
58 bool mirrored () const
59 QChar mirroredChar () const
60 const QString & decomposition () const
61 Decomposition decompositionTag () const
62 unsigned char combiningClass () const
63 char latin1 () const
64 ushort unicode () const
65 ushort & unicode ()
66 operator char () const
67 bool isNull () const
68 bool isPrint () const
69 bool isPunct () const
70 bool isSpace () const
71 bool isMark () const
72 bool isLetter () const
73 bool isNumber () const
74 bool isLetterOrNumber () const
75 bool isDigit () const
76 bool isSymbol () const
77 uchar cell () const
78 uchar row () const
79
80 Static Public Members
81 bool networkOrdered () (obsolete)
82
84 bool operator== ( QChar c1, QChar c2 )
85 bool operator== ( char ch, QChar c )
86 bool operator== ( QChar c, char ch )
87 int operator!= ( QChar c1, QChar c2 )
88 int operator!= ( char ch, QChar c )
89 int operator!= ( QChar c, char ch )
90 int operator<= ( QChar c1, QChar c2 )
91 int operator<= ( QChar c, char ch )
92 int operator<= ( char ch, QChar c )
93 int operator>= ( QChar c1, QChar c2 )
94 int operator>= ( QChar c, char ch )
95 int operator>= ( char ch, QChar c )
96 int operator< ( QChar c1, QChar c2 )
97 int operator< ( QChar c, char ch )
98 int operator< ( char ch, QChar c )
99 int operator> ( QChar c1, QChar c2 )
100 int operator> ( QChar c, char ch )
101 int operator> ( char ch, QChar c )
102
104 The QChar class provides a lightweight Unicode character.
105
106 Unicode characters are (so far) 16-bit entities without any markup or
107 structure. This class represents such an entity. It is lightweight, so
108 it can be used everywhere. Most compilers treat it like a "short int".
109 (In a few years it may be necessary to make QChar 32-bit when more than
110 65536 Unicode code points have been defined and come into use.)
111
112 QChar provides a full complement of testing/classification functions,
113 converting to and from other formats, converting from composed to
114 decomposed Unicode, and trying to compare and case-convert if you ask
115 it to.
116
117 The classification functions include functions like those in ctype.h,
118 but operating on the full range of Unicode characters. They all return
119 TRUE if the character is a certain type of character; otherwise they
120 return FALSE. These classification functions are isNull() (returns TRUE
121 if the character is U+0000), isPrint() (TRUE if the character is any
122 sort of printable character, including whitespace), isPunct() (any sort
123 of punctation), isMark() (Unicode Mark), isLetter (a letter),
124 isNumber() (any sort of numeric character), isLetterOrNumber(), and
125 isDigit() (decimal digits). All of these are wrappers around category()
126 which return the Unicode-defined category of each character.
127
128 QChar further provides direction(), which indicates the "natural"
129 writing direction of this character. The joining() function indicates
130 how the character joins with its neighbors (needed mostly for Arabic)
131 and finally mirrored(), which indicates whether the character needs to
132 be mirrored when it is printed in its" unnatural" writing direction.
133
134 Composed Unicode characters (like å) can be converted to
135 decomposed Unicode ("a" followed by "ring above") by using
136 decomposition().
137
138 In Unicode, comparison is not necessarily possible and case conversion
139 is very difficult at best. Unicode, covering the" entire" world, also
140 includes most of the world's case and sorting problems. Qt tries, but
141 not very hard: operator==() and friends will do comparison based purely
142 on the numeric Unicode value (code point) of the characters, and
143 upper() and lower() will do case changes when the character has a well-
144 defined upper/lower-case equivalent. There is no provision for locale-
145 dependent case folding rules or comparison; these functions are meant
146 to be fast so they can be used unambiguously in data structures. (See
147 QString::localeAwareCompare() though.)
148
149 The conversion functions include unicode() (to a scalar), latin1() (to
150 scalar, but converts all non-Latin-1 characters to 0), row() (gives the
151 Unicode row), cell() (gives the Unicode cell), digitValue() (gives the
152 integer value of any of the numerous digit characters), and a host of
153 constructors.
154
155 More information can be found in the document About Unicode.
156
157 See also QString, QCharRef, and Text Related Classes.
158
159 Member Type Documentation
161 This enum maps the Unicode character categories.
162
163 The following characters are normative in Unicode:
164
165 QChar::Mark_NonSpacing - Unicode class name Mn
166
167 QChar::Mark_SpacingCombining - Unicode class name Mc
168
169 QChar::Mark_Enclosing - Unicode class name Me
170
171 QChar::Number_DecimalDigit - Unicode class name Nd
172
173 QChar::Number_Letter - Unicode class name Nl
174
175 QChar::Number_Other - Unicode class name No
176
177 QChar::Separator_Space - Unicode class name Zs
178
179 QChar::Separator_Line - Unicode class name Zl
180
181 QChar::Separator_Paragraph - Unicode class name Zp
182
183 QChar::Other_Control - Unicode class name Cc
184
185 QChar::Other_Format - Unicode class name Cf
186
187 QChar::Other_Surrogate - Unicode class name Cs
188
189 QChar::Other_PrivateUse - Unicode class name Co
190
191 QChar::Other_NotAssigned - Unicode class name Cn
192
193 The following categories are informative in Unicode:
194
195 QChar::Letter_Uppercase - Unicode class name Lu
196
197 QChar::Letter_Lowercase - Unicode class name Ll
198
199 QChar::Letter_Titlecase - Unicode class name Lt
200
201 QChar::Letter_Modifier - Unicode class name Lm
202
203 QChar::Letter_Other - Unicode class name Lo
204
205 QChar::Punctuation_Connector - Unicode class name Pc
206
207 QChar::Punctuation_Dash - Unicode class name Pd
208
209 QChar::Punctuation_Open - Unicode class name Ps
210
211 QChar::Punctuation_Close - Unicode class name Pe
212
213 QChar::Punctuation_InitialQuote - Unicode class name Pi
214
215 QChar::Punctuation_FinalQuote - Unicode class name Pf
216
217 QChar::Punctuation_Other - Unicode class name Po
218
219 QChar::Symbol_Math - Unicode class name Sm
220
221 QChar::Symbol_Currency - Unicode class name Sc
222
223 QChar::Symbol_Modifier - Unicode class name Sk
224
225 QChar::Symbol_Other - Unicode class name So
226
227 There are two categories that are specific to Qt:
228
229 QChar::NoCategory - used when Qt is dazed and confused and cannot make
230 sense of anything.
231
232 QChar::Punctuation_Dask - old typo alias for Punctuation_Dash
233
235 This enum type defines names for some of the Unicode combining classes.
236 See the Unicode Standard for a description of the values.
237
239 This enum type defines the Unicode decomposition attributes. See the
240 Unicode Standard for a description of the values.
241
243 This enum type defines the Unicode direction attributes. See the
244 Unicode Standard for a description of the values.
245
246 In order to conform to C/C++ naming conventions "Dir" is prepended to
247 the codes used in the Unicode Standard.
248
250 This enum type defines the Unicode joining attributes. See the Unicode
251 Standard for a description of the values.
252
255 Constructs a null QChar (one that isNull()).
256
258 Constructs a QChar corresponding to ASCII/Latin-1 character c.
259
261 Constructs a QChar corresponding to ASCII/Latin-1 character c.
262
264 Constructs a QChar for Unicode cell c in row r.
265
267 Constructs a copy of c. This is a deep copy, if such a lightweight
268 object can be said to have deep copies.
269
271 Constructs a QChar for the character with Unicode code point rc.
272
274 Constructs a QChar for the character with Unicode code point rc.
275
277 Constructs a QChar for the character with Unicode code point rc.
278
280 Constructs a QChar for the character with Unicode code point rc.
281
283 Returns the character category.
284
285 See also Category.
286
288 Returns the cell (least significant byte) of the Unicode character.
289
291 Returns the combining class for the character as defined in the Unicode
292 standard. This is mainly useful as a positioning hint for marks
293 attached to a base character.
294
295 The Qt text rendering engine uses this information to correctly
296 position non spacing marks around a base character.
297
299 Warning: This function is not reentrant.</p>
300
301 Decomposes a character into its parts. Returns QString::null if no
302 decomposition exists.
303
305 Returns the tag defining the composition of the character. Returns
306 QChar::Single if no decomposition exists.
307
309 Returns the numeric value of the digit, or -1 if the character is not a
310 digit.
311
313 Returns the character's direction.
314
315 See also Direction.
316
318 Returns TRUE if the character is a decimal digit (Number_DecimalDigit);
319 otherwise returns FALSE.
320
322 Returns TRUE if the character is a letter (Letter_* categories);
323 otherwise returns FALSE.
324
326 Returns TRUE if the character is a letter or number (Letter_* or
327 Number_* categories); otherwise returns FALSE.
328
330 Returns TRUE if the character is a mark (Mark_* categories); otherwise
331 returns FALSE.
332
334 Returns TRUE if the character is the Unicode character 0x0000 (ASCII
335 NUL); otherwise returns FALSE.
336
338 Returns TRUE if the character is a number (of any sort - Number_*
339 categories); otherwise returns FALSE.
340
341 See also isDigit().
342
344 Returns TRUE if the character is a printable character; otherwise
345 returns FALSE. This is any character not of category Cc or Cn.
346
347 Note that this gives no indication of whether the character is
348 available in a particular font.
349
351 Returns TRUE if the character is a punctuation mark (Punctuation_*
352 categories); otherwise returns FALSE.
353
355 Returns TRUE if the character is a separator character (Separator_*
356 categories); otherwise returns FALSE.
357
359 Returns TRUE if the character is a symbol (Symbol_* categories);
360 otherwise returns FALSE.
361
363 Warning: This function is not supported (it may change to use Unicode
364 character classes).
365
366 Returns information about the joining properties of the character
367 (needed for example, for Arabic).
368
370 Returns the Latin-1 value of this character, or 0 if it cannot be
371 represented in Latin-1.
372
374 Returns the lowercase equivalent if the character is uppercase;
375 otherwise returns the character itself.
376
378 Returns TRUE if the character is a mirrored character (one that should
379 be reversed if the text direction is reversed); otherwise returns
380 FALSE.
381
383 Returns the mirrored character if this character is a mirrored
384 character, otherwise returns the character itself.
385
387 This function is obsolete. It is provided to keep old source working.
388 We strongly advise against using it in new code.
389
390 Returns TRUE if this character is in network byte order (MSB first);
391 otherwise returns FALSE. This is platform dependent.
392
394 Returns the Latin-1 character equivalent to the QChar, or 0. This is
395 mainly useful for non-internationalized software.
396
397 See also unicode().
398
400 Returns the row (most significant byte) of the Unicode character.
401
403 Returns the numeric Unicode value equal to the QChar. Normally, you
404 should use QChar objects as they are equivalent, but for some low-level
405 tasks (e.g. indexing into an array of Unicode information), this
406 function is useful.
407
409 This is an overloaded member function, provided for convenience. It
410 behaves essentially like the above function.
411
412 Returns a reference to the numeric Unicode value equal to the QChar.
413
415 Returns the uppercase equivalent if the character is lowercase;
416 otherwise returns the character itself.
417
420 Returns TRUE if c1 and c2 are not the same Unicode character; otherwise
421 returns FALSE.
422
424 This is an overloaded member function, provided for convenience. It
425 behaves essentially like the above function.
426
427 Returns TRUE if c is not the ASCII/Latin-1 character ch; otherwise
428 returns FALSE.
429
431 This is an overloaded member function, provided for convenience. It
432 behaves essentially like the above function.
433
434 Returns TRUE if c is not the ASCII/Latin-1 character ch; otherwise
435 returns FALSE.
436
438 Returns TRUE if the numeric Unicode value of c1 is less than that of
439 c2; otherwise returns FALSE.
440
442 This is an overloaded member function, provided for convenience. It
443 behaves essentially like the above function.
444
445 Returns TRUE if the numeric Unicode value of c is less than that of the
446 ASCII/Latin-1 character ch; otherwise returns FALSE.
447
449 This is an overloaded member function, provided for convenience. It
450 behaves essentially like the above function.
451
452 Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
453 character ch is less than that of c; otherwise returns FALSE.
454
456 Returns TRUE if the numeric Unicode value of c1 is less than that of
457 c2, or they are the same Unicode character; otherwise returns FALSE.
458
460 This is an overloaded member function, provided for convenience. It
461 behaves essentially like the above function.
462
463 Returns TRUE if the numeric Unicode value of c is less than or equal to
464 that of the ASCII/Latin-1 character ch; otherwise returns FALSE.
465
467 This is an overloaded member function, provided for convenience. It
468 behaves essentially like the above function.
469
470 Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
471 character ch is less than or equal to that of c; otherwise returns
472 FALSE.
473
475 Returns TRUE if c1 and c2 are the same Unicode character; otherwise
476 returns FALSE.
477
479 This is an overloaded member function, provided for convenience. It
480 behaves essentially like the above function.
481
482 Returns TRUE if c is the ASCII/Latin-1 character ch; otherwise returns
483 FALSE.
484
486 This is an overloaded member function, provided for convenience. It
487 behaves essentially like the above function.
488
489 Returns TRUE if c is the ASCII/Latin-1 character ch; otherwise returns
490 FALSE.
491
493 Returns TRUE if the numeric Unicode value of c1 is greater than that of
494 c2; otherwise returns FALSE.
495
497 This is an overloaded member function, provided for convenience. It
498 behaves essentially like the above function.
499
500 Returns TRUE if the numeric Unicode value of c is greater than that of
501 the ASCII/Latin-1 character ch; otherwise returns FALSE.
502
504 This is an overloaded member function, provided for convenience. It
505 behaves essentially like the above function.
506
507 Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
508 character ch is greater than that of c; otherwise returns FALSE.
509
511 Returns TRUE if the numeric Unicode value of c1 is greater than that of
512 c2, or they are the same Unicode character; otherwise returns FALSE.
513
515 This is an overloaded member function, provided for convenience. It
516 behaves essentially like the above function.
517
518 Returns TRUE if the numeric Unicode value of c is greater than or equal
519 to that of the ASCII/Latin-1 character ch; otherwise returns FALSE.
520
522 This is an overloaded member function, provided for convenience. It
523 behaves essentially like the above function.
524
525 Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
526 character ch is greater than or equal to that of c; otherwise returns
527 FALSE.
528
529
531 http://doc.trolltech.com/qchar.html
532 http://www.trolltech.com/faq/tech.html
533
535 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
536 license file included in the distribution for a complete license
537 statement.
538
540 Generated automatically from the source code.
541
543 If you find a bug in Qt, please report it as described in
544 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
545 help you. Thank you.
546
547 The definitive Qt documentation is provided in HTML format; it is
548 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
549 web browser. This man page is provided as a convenience for those users
550 who prefer man pages, although this format is not officially supported
551 by Trolltech.
552
553 If you find errors in this manual page, please report them to qt-
554 bugs@trolltech.com. Please include the name of the manual page
555 (qchar.3qt) and the Qt version (3.3.8).
556
557
558
559Trolltech AS 2 February 2007 QChar(3qt)