diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-04-10 23:36:21 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-11 15:57:32 +0200 |
commit | 3ddd768504f9f55c04bec9beb8eb9bac9a7e5edc (patch) | |
tree | c9862091ee484ee676a8e0f915181637405c690e /src/corelib/tools/qchar.cpp | |
parent | 7386ab17df94e58efeb2f2fba91b9f816834c077 (diff) |
QChar: optimize some methods a bit for general case
by reordering and regrouping conditions so that they lead to result earlier
in most-common usecases (l.letters, spaces and puncts, u.letters, other);
there are no title cased letters in range [0..127] -> use this in isTitleCase();
test for 0xa0 (nbsp) early in isSpace() as it is quite common in HTML, etc.;
add early test to isNumber().
Change-Id: Ib415f34cb1212d9ccf8753de2d1beaece1aa2243
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/corelib/tools/qchar.cpp')
-rw-r--r-- | src/corelib/tools/qchar.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 1ce19ec911..165bda7b05 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -557,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; } /*! |