summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qchar.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-04-16 12:04:34 +0200
committerLars Knoll <lars.knoll@nokia.com>2012-04-16 12:04:34 +0200
commit9bd032355163d92cda5e7e59ecd21214b131f187 (patch)
tree002fa12558505683143c7eb08949a3d225bf0712 /src/corelib/tools/qchar.cpp
parentd037d25c3d5236623371cf051aaf6a9e59792ba7 (diff)
parent41673c45dde2eb95ee21dd918235218399f2be2c (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
Diffstat (limited to 'src/corelib/tools/qchar.cpp')
-rw-r--r--src/corelib/tools/qchar.cpp42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 0261843a3ae..ef229fc0fca 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -50,19 +50,12 @@
#include "qchar.h"
#include "qdatastream.h"
-#include "qtextcodec.h"
#include "qunicodetables_p.h"
#include "qunicodetables.cpp"
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_CODEC_FOR_C_STRINGS
-# ifdef QT_NO_TEXTCODEC
-# define QT_NO_CODEC_FOR_C_STRINGS
-# endif
-#endif
-
#define FLAG(x) (1 << (x))
/*!
@@ -71,8 +64,7 @@ QT_BEGIN_NAMESPACE
\ingroup string-processing
- This class is only useful to avoid the codec for C strings business
- in the QChar(ch) constructor. You can avoid it by writing QChar(ch, 0).
+ This class is only useful to construct a QChar with 8-bit character.
\sa QChar, QLatin1String, QString
*/
@@ -565,17 +557,24 @@ bool QChar::isLetter(ushort ucs2)
}
/*!
+ \fn bool QChar::isNumber() const
+
Returns true if the character is a number (Number_* categories,
not just 0-9); otherwise returns false.
\sa isDigit()
*/
-bool QChar::isNumber() const
+
+/*!
+ \internal
+ \overload
+*/
+bool QChar::isNumber(ushort ucs2)
{
const int test = FLAG(Number_DecimalDigit) |
FLAG(Number_Letter) |
FLAG(Number_Other);
- return FLAG(qGetProp(ucs)->category) & test;
+ return FLAG(qGetProp(ucs2)->category) & test;
}
/*!
@@ -725,7 +724,7 @@ int QChar::digitValue(ushort ucs2)
int QChar::digitValue(uint ucs4)
{
if (ucs4 > UNICODE_LAST_CODEPOINT)
- return 0;
+ return -1;
return qGetProp(ucs4)->digitValue;
}
@@ -1239,10 +1238,24 @@ ushort QChar::toCaseFolded(ushort ucs2)
Returns the Latin-1 character equivalent to the QChar, or 0. This
is mainly useful for non-internationalized software.
+ \note It is not possible to distinguish a non-Latin-1 character from a Latin-1 0
+ (NUL) character. Prefer to use unicode(), which does not have this ambiguity.
+
\sa toAscii(), unicode()
*/
/*!
+ \fn QChar QChar::fromLatin1(char)
+
+ Converts the Latin-1 character \a c to its equivalent QChar. This
+ is mainly useful for non-internationalized software.
+
+ An alternative is to use QLatin1Char.
+
+ \sa fromAscii(), unicode()
+*/
+
+/*!
\fn char QChar::toAscii() const
Returns the Latin-1 character value of the QChar, or 0 if the character is not
@@ -1255,6 +1268,9 @@ ushort QChar::toCaseFolded(ushort ucs2)
\note It is not possible to distinguish a non-Latin 1 character from an ASCII 0
(NUL) character. Prefer to use unicode(), which does not have this ambiguity.
+ \note This function does not check whether the character value is inside
+ the valid range of US-ASCII.
+
\sa toLatin1(), unicode()
*/
@@ -1308,7 +1324,7 @@ QDataStream &operator>>(QDataStream &in, QChar &chr)
/*!
\fn ushort QChar::unicode() const
- \overload
+ Returns the numeric Unicode value of the QChar.
*/
/*****************************************************************************