make QChar::Unicode_Unassigned a constantly big value

this makes the version based checks a bit simpler (and thus faster)

Change-Id: I975c6d043d238a5c16a4b13f8379e87fbade23cc
Reviewed-on: http://codereview.qt.nokia.com/1586
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Ritt Konstantin 2011-07-08 18:28:09 +04:00 committed by Qt by Nokia
parent 46e2985379
commit ebfd24a20b
3 changed files with 5 additions and 4 deletions

2
dist/changes-5.0.0 vendored
View File

@ -40,6 +40,8 @@ QtCore
------
* drop a bogus QChar::NoCategory enum value; the proper QChar::Other_NotAssigned
value is returned for an unassigned codepoints now.
* QChar::Unicode_Unassigned value was moved to the end of enum in order to make
the version based checks more convenient and less error-prone in use.
QtGui
-----

View File

@ -2973,8 +2973,7 @@ void qt_nameprep(QString *source, int from)
}
}
if (!isUnassignedAllowed) {
QChar::UnicodeVersion version = QChar::unicodeVersion(uc);
if (version == QChar::Unicode_Unassigned || version > QChar::Unicode_3_2) {
if (QChar::unicodeVersion(uc) > QChar::Unicode_3_2) {
source->resize(from); // not allowed, clear the label
return;
}

View File

@ -190,7 +190,6 @@ public:
};
enum UnicodeVersion {
Unicode_Unassigned, // ### Qt 5: assign with some constantly big value
Unicode_1_1,
Unicode_2_0,
Unicode_2_1_2,
@ -199,7 +198,8 @@ public:
Unicode_3_2,
Unicode_4_0,
Unicode_4_1,
Unicode_5_0
Unicode_5_0,
Unicode_Unassigned = 0xff
};
// ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO