QChar Class ReferenceThe QChar class provides a 16-bit Unicode character. Далее... #include <QChar> Замечание: Все функции в этом классе реентерабельны. Открытые типы
Открытые функции
Статические открытые члены
Связанные нечлены класса
Подробное описание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 chars. 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, and QLatin1Char. Описание типов-членовenum QChar::CategoryThis enum maps the Unicode character categories. The following characters are normative in Unicode:
The following categories are informative in Unicode:
See also category(). enum QChar::DecompositionThis enum type defines the Unicode decomposition attributes. See the Unicode Standard for a description of the values.
See also decomposition(). enum QChar::DirectionThis 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.
Сморите также direction(). enum QChar::JoiningThis enum type defines the Unicode joining attributes. See the Unicode Standard for a description of the values.
See also joining(). enum QChar::SpecialCharacter
enum QChar::UnicodeVersionSpecifies which version of the Unicode standard introduced a certain character.
See also unicodeVersion(). Описание функций-членовQChar::QChar ()Constructs a null QChar ('\0'). Смотрите также isNull(). QChar::QChar ( char ch )Constructs a QChar corresponding to ASCII/Latin-1 character ch. QChar::QChar ( uchar ch )Constructs a QChar corresponding to ASCII/Latin-1 character ch. QChar::QChar ( QLatin1Char ch )Constructs a QChar corresponding to ASCII/Latin-1 character ch. QChar::QChar ( uchar cell, uchar row )Constructs a QChar for Unicode cell cell in row row. QChar::QChar ( ushort code )Constructs a QChar for the character with Unicode code point code. QChar::QChar ( short code )Constructs a QChar for the character with Unicode code point code. QChar::QChar ( uint code )Constructs a QChar for the character with Unicode code point code. QChar::QChar ( int code )Constructs a QChar for the character with Unicode code point code. QChar::QChar ( SpecialCharacter ch )Constructs a QChar for the predefined character value ch. Category QChar::category () constReturns the character's category. Category QChar::category ( uint ucs4 ) [static]Это перегруженная функция. Returns the category of the UCS-4-encoded character specified by ucs4. Эта функция была введена в Qt 4.3. Category QChar::category ( ushort ucs2 ) [static]Это перегруженная функция. Returns the category of the UCS-2-encoded character specified by ucs2. uchar QChar::cell () constReturns the cell (least significant byte) of the Unicode character. See also row(). unsigned char QChar::combiningClass () constReturns 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. unsigned char QChar::combiningClass ( uint ucs4 ) [static]Это перегруженная функция. Returns the combining class for the UCS-4-encoded character specified by ucs4, as defined in the Unicode standard. unsigned char QChar::combiningClass ( ushort ucs2 ) [static]Это перегруженная функция. Returns the combining class for the UCS-2-encoded character specified by ucs2, as defined in the Unicode standard. QString QChar::decomposition () constDecomposes a character into its parts. Returns an empty string if no decomposition exists. QString QChar::decomposition ( uint ucs4 ) [static]Это перегруженная функция. Decomposes the UCS-4-encoded character specified by ucs4 into its constituent parts. Returns an empty string if no decomposition exists. Decomposition QChar::decompositionTag () constReturns the tag defining the composition of the character. Returns QChar::Single if no decomposition exists. Decomposition QChar::decompositionTag ( uint ucs4 ) [static]Это перегруженная функция. Returns the tag defining the composition of the UCS-4-encoded character specified by ucs4. Returns QChar::Single if no decomposition exists. int QChar::digitValue () constReturns the numeric value of the digit, or -1 if the character is not a digit. int QChar::digitValue ( ushort ucs2 ) [static]Это перегруженная функция. Returns the numeric value of the digit, specified by the UCS-2-encoded character, ucs2, or -1 if the character is not a digit. int QChar::digitValue ( uint ucs4 ) [static]Это перегруженная функция. Returns the numeric value of the digit specified by the UCS-4-encoded character, ucs4, or -1 if the character is not a digit. Direction QChar::direction () constReturns the character's direction. Direction QChar::direction ( uint ucs4 ) [static]Это перегруженная функция. Returns the direction of the UCS-4-encoded character specified by ucs4. Direction QChar::direction ( ushort ucs2 ) [static]Это перегруженная функция. Returns the direction of the UCS-2-encoded character specified by ucs2. 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(), and QTextCodec::codecForCStrings(). QChar QChar::fromLatin1 ( char c ) [static]Converts the Latin-1 character c to its equivalent QChar. This is mainly useful for non-internationalized software. See also fromAscii(), unicode(), and QTextCodec::codecForCStrings(). bool QChar::hasMirrored () constReturns true if the character should be reversed if the text direction is reversed; otherwise returns false. Same as (ch.mirroredChar() != ch). See also mirroredChar(). ushort QChar::highSurrogate ( uint ucs4 ) [static]Returns the high surrogate value of a ucs4 code point. The returned result is undefined if ucs4 is smaller than 0x10000. bool QChar::isDigit () constReturns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false. bool QChar::isHighSurrogate () constReturns true if the QChar is the high part of a utf16 surrogate (ie. if its code point is between 0xd800 and 0xdbff, inclusive). bool QChar::isHighSurrogate ( uint ucs4 ) [static]Returns true if the UCS-4-encoded character specified by ucs4 is the high part of a utf16 surrogate (ie. if its code point is between 0xd800 and 0xdbff, inclusive). Эта функция была введена в Qt 4.7. bool QChar::isLetter () constReturns true if the character is a letter (Letter_* categories); otherwise returns false. bool QChar::isLetterOrNumber () constReturns true if the character is a letter or number (Letter_* or Number_* categories); otherwise returns false. bool QChar::isLowSurrogate () constReturns true if the QChar is the low part of a utf16 surrogate (ie. if its code point is between 0xdc00 and 0xdfff, inclusive). bool QChar::isLowSurrogate ( uint ucs4 ) [static]Returns true if the UCS-4-encoded character specified by ucs4 is the high part of a utf16 surrogate (ie. if its code point is between 0xdc00 and 0xdfff, inclusive). Эта функция была введена в Qt 4.7. bool QChar::isLower () constReturns true if the character is a lowercase letter, i.e. category() is Letter_Lowercase. See also isUpper(), toLower(), and toUpper(). bool QChar::isMark () constReturns true if the character is a mark (Mark_* categories); otherwise returns false. See QChar::Category for more information regarding marks. bool QChar::isNull () constReturns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false. bool QChar::isNumber () constReturns true if the character is a number (Number_* categories, not just 0-9); otherwise returns false. See also isDigit(). bool QChar::isPrint () constReturns 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. bool QChar::isPunct () constReturns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns false. bool QChar::isSpace () constReturns true if the character is a separator character (Separator_* categories); otherwise returns false. bool QChar::isSymbol () constReturns true if the character is a symbol (Symbol_* categories); otherwise returns false. bool QChar::isTitleCase () constReturns true if the character is a titlecase letter, i.e. category() is Letter_Titlecase. Эта функция была введена в Qt 4.3. See also isLower(), toUpper(), toLower(), and toTitleCase(). bool QChar::isUpper () constReturns true if the character is an uppercase letter, i.e. category() is Letter_Uppercase. See also isLower(), toUpper(), and toLower(). Joining QChar::joining () constReturns information about the joining properties of the character (needed for certain languages such as Arabic). Joining QChar::joining ( uint ucs4 ) [static]Это перегруженная функция. Returns information about the joining properties of the UCS-4-encoded character specified by ucs4 (needed for certain languages such as Arabic). Joining QChar::joining ( ushort ucs2 ) [static]Это перегруженная функция. Returns information about the joining properties of the UCS-2-encoded character specified by ucs2 (needed for certain languages such as Arabic). ushort QChar::lowSurrogate ( uint ucs4 ) [static]Returns the low surrogate value of a ucs4 code point. The returned result is undefined if ucs4 is smaller than 0x10000. QChar QChar::mirroredChar () constReturns the mirrored character if this character is a mirrored character; otherwise returns the character itself. See also hasMirrored(). uint QChar::mirroredChar ( uint ucs4 ) [static]Это перегруженная функция. Returns the mirrored character if the UCS-4-encoded character specified by ucs4 is a mirrored character; otherwise returns the character itself. See also hasMirrored(). ushort QChar::mirroredChar ( ushort ucs2 ) [static]Это перегруженная функция. Returns the mirrored character if the UCS-2-encoded character specified by ucs2 is a mirrored character; otherwise returns the character itself. See also hasMirrored(). bool QChar::requiresSurrogates ( uint ucs4 ) [static]Returns true if the UCS-4-encoded character specified by ucs4 can be splited to the high and low parts of a utf16 surrogate (ie. if its code point is greater than or equals to 0x10000). Эта функция была введена в Qt 4.7. uchar QChar::row () constReturns the row (most significant byte) of the Unicode character. See also cell(). uint QChar::surrogateToUcs4 ( ushort high, ushort low ) [static]Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point. uint QChar::surrogateToUcs4 ( QChar high, QChar low ) [static]Converts a utf16 surrogate pair (high, low) to its ucs4 code point. char QChar::toAscii () constReturns 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(), and QTextCodec::codecForCStrings(). QChar QChar::toCaseFolded () constReturns the case folded equivalent of the character. Для большинства Unicode-символов это тоже самое, что и toLower(). uint QChar::toCaseFolded ( uint ucs4 ) [static]Это перегруженная функция. Returns the case folded equivalent of the UCS-4-encoded character specified by ucs4. Для большинства Unicode-символов это тоже самое, что и toLower(). ushort QChar::toCaseFolded ( ushort ucs2 ) [static]Это перегруженная функция. Returns the case folded equivalent of the UCS-2-encoded character specified by ucs2. Для большинства Unicode-символов это тоже самое, что и toLower(). char QChar::toLatin1 () constReturns the Latin-1 character equivalent to the QChar, or 0. This is mainly useful for non-internationalized software. See also toAscii(), unicode(), and QTextCodec::codecForCStrings(). QChar QChar::toLower () constReturns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the character itself. uint QChar::toLower ( uint ucs4 ) [static]Это перегруженная функция. Returns the lowercase equivalent of the UCS-4-encoded character specified by ucs4 if the character is uppercase or titlecase; otherwise returns the character itself. ushort QChar::toLower ( ushort ucs2 ) [static]Это перегруженная функция. Returns the lowercase equivalent of the UCS-2-encoded character specified by ucs2 if the character is uppercase or titlecase; otherwise returns the character itself. QChar QChar::toTitleCase () constReturns the title case equivalent if the character is lowercase or uppercase; otherwise returns the character itself. uint QChar::toTitleCase ( uint ucs4 ) [static]Это перегруженная функция. Returns the title case equivalent of the UCS-4-encoded character specified by ucs4 if the character is lowercase or uppercase; otherwise returns the character itself. ushort QChar::toTitleCase ( ushort ucs2 ) [static]Это перегруженная функция. Returns the title case equivalent of the UCS-2-encoded character specified by ucs2 if the character is lowercase or uppercase; otherwise returns the character itself. QChar QChar::toUpper () constReturns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the character itself. uint QChar::toUpper ( uint ucs4 ) [static]Это перегруженная функция. Returns the uppercase equivalent of the UCS-4-encoded character specified by ucs4 if the character is lowercase or titlecase; otherwise returns the character itself. ushort QChar::toUpper ( ushort ucs2 ) [static]Это перегруженная функция. Returns the uppercase equivalent of the UCS-2-encoded character specified by ucs2 if the character is lowercase or titlecase; otherwise returns the character itself. ushort & QChar::unicode ()Returns a reference to the numeric Unicode value of the QChar. ushort QChar::unicode () constЭто перегруженная функция. UnicodeVersion QChar::unicodeVersion () constReturns the Unicode version that introduced this character. UnicodeVersion QChar::unicodeVersion ( uint ucs4 ) [static]Это перегруженная функция. Returns the Unicode version that introduced the character specified in its UCS-4-encoded form as ucs4. UnicodeVersion QChar::unicodeVersion ( ushort ucs2 ) [static]Это перегруженная функция. Returns the Unicode version that introduced the character specified in its UCS-2-encoded form as ucs2. Связанные нечлены классаbool operator!= ( QChar c1, QChar c2 )Returns true if c1 and c2 are not the same Unicode character; otherwise returns false. bool operator< ( QChar c1, QChar c2 )Returns true if the numeric Unicode value of c1 is less than that of c2; otherwise returns false. QDataStream & operator<< ( QDataStream & out, const QChar & chr )Writes the char chr to the stream out. Смотрите также Преобразование типов данных Qt в последовательный вид. bool operator<= ( QChar c1, QChar c2 )Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false. bool operator== ( QChar c1, QChar c2 )Returns true if c1 and c2 are the same Unicode character; otherwise returns false. bool operator> ( QChar c1, QChar c2 )Returns true if the numeric Unicode value of c1 is greater than that of c2; otherwise returns false. bool operator>= ( QChar c1, QChar c2 )Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false. QDataStream & operator>> ( QDataStream & in, QChar & chr )Reads a char from the stream in into char chr. Смотрите также Преобразование типов данных Qt в последовательный вид. |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |