diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-04-16 11:26:41 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-17 18:44:13 +0200 |
commit | 087cda285f8a743427fa40d12e354e9ab7d1d84e (patch) | |
tree | cb25fca010ba4f622d34e9c4d73a4a1a606e6855 /src/corelib/tools | |
parent | b8d1abe65b666dd49e2fbd0859070e32e304458e (diff) |
fix QChar::isPrint() returns an incorrect result.
results are now equals to results of ICU's u_isprint() for the entire set
of the Unicode code points
Change-Id: I763f4b37cccd285eb01543d486f25bd7ea011241
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qchar.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index ef229fc0fc..80233b430a 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -108,8 +108,8 @@ QT_BEGIN_NAMESPACE 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; + operating on the full range of Unicode characters, not just for the ASCII + range. 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, @@ -118,7 +118,9 @@ QT_BEGIN_NAMESPACE 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. + character. Some of these also calculate the derived properties + (i.e. isSpace() returns true if the character is of category + Separator_* or an exceptional code point from Other_Control category). QChar also provides direction(), which indicates the "natural" writing direction of this character. The joining() function @@ -153,6 +155,9 @@ QT_BEGIN_NAMESPACE to construct a QChar from an 8-bit \c char, and you will need to call toAscii() or toLatin1() to get the 8-bit value back. + For more information see + \l{http://www.unicode.org/ucd/}{"About the Unicode Character Database"}. + \sa Unicode, QString, QLatin1Char */ @@ -473,7 +478,7 @@ QT_BEGIN_NAMESPACE /*! Returns true if the character is a printable character; otherwise - returns false. This is any character not of category Cc or Cn. + returns false. This is any character not of category Other_*. Note that this gives no indication of whether the character is available in a particular font. @@ -481,6 +486,9 @@ QT_BEGIN_NAMESPACE bool QChar::isPrint() const { const int test = FLAG(Other_Control) | + FLAG(Other_Format) | + FLAG(Other_Surrogate) | + FLAG(Other_PrivateUse) | FLAG(Other_NotAssigned); return !(FLAG(qGetProp(ucs)->category) & test); } |