summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qchar.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-01-26 02:42:37 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-29 23:19:47 +0100
commitb80fcbdba62ec2324fa9ad29cbc5ac1d9a9fe8a2 (patch)
tree97a78ec35d3e66e0f2539490d8e112322adde7ce /src/corelib/tools/qchar.cpp
parentb04d87b2263fd5d9b2b57799098a2eb5a3c91dfc (diff)
Introduce QChar::JoiningType enum and QChar::joiningType() method
This aimed to disctinct joining types "L", "T", and "U" from just "U". Unicode 6.3.0 has introduced a character with joining type "L" and Unicode 7.0 will add a few more characters of joining type "L", so we'll have to deal with it anyways. [ChangeLog][QtCore][QChar] Added JoiningType enum and joiningType() method that deprecates the old QChar::Joining enum and joining() method. Change-Id: I4be3a3f745d944e689feb9b62d4ca86d1cf371b0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qchar.cpp')
-rw-r--r--src/corelib/tools/qchar.cpp63
1 files changed, 60 insertions, 3 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index f7f425d594..eb59cc719f 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -127,9 +127,9 @@ QT_BEGIN_NAMESPACE
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
+ writing direction of this character. The joiningType() function
indicates how the character joins with it's neighbors (needed
- mostly for Arabic) and finally hasMirrored(), which indicates
+ mostly for Arabic or Syriac) and finally hasMirrored(), which indicates
whether the character needs to be mirrored when it is printed in
it's "unnatural" writing direction.
@@ -458,7 +458,29 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \enum QChar::JoiningType
+ since 5.3
+
+ This enum type defines the Unicode joining type attributes. See the
+ \l{http://www.unicode.org/}{Unicode Standard} for a description of the values.
+
+ In order to conform to C/C++ naming conventions "Joining_" is prepended
+ to the codes used in the Unicode Standard.
+
+ \value Joining_None
+ \value Joining_Causing
+ \value Joining_Dual
+ \value Joining_Right
+ \value Joining_Left
+ \value Joining_Transparent
+
+ \sa joiningType()
+*/
+
+#if QT_DEPRECATED_SINCE(5, 3)
+/*!
\enum QChar::Joining
+ \deprecated in 5.3, use JoiningType instead.
This enum type defines the Unicode joining attributes. See the
\l{http://www.unicode.org/}{Unicode Standard} for a description
@@ -471,6 +493,7 @@ QT_BEGIN_NAMESPACE
\sa joining()
*/
+#endif
/*!
\enum QChar::CombiningClass
@@ -1053,7 +1076,32 @@ QChar::Direction QChar::direction(uint ucs4)
}
/*!
+ \fn QChar::JoiningType QChar::joiningType() const
+ \since 5.3
+
+ Returns information about the joining type attributes of the character
+ (needed for certain languages such as Arabic or Syriac).
+*/
+
+/*!
+ \overload
+ \since 5.3
+
+ Returns information about the joining type attributes of the UCS-4-encoded
+ character specified by \a ucs4
+ (needed for certain languages such as Arabic or Syriac).
+*/
+QChar::JoiningType QChar::joiningType(uint ucs4)
+{
+ if (ucs4 > LastValidCodePoint)
+ return QChar::Joining_None;
+ return QChar::JoiningType(qGetProp(ucs4)->joining);
+}
+
+#if QT_DEPRECATED_SINCE(5, 3)
+/*!
\fn QChar::Joining QChar::joining() const
+ \deprecated in 5.3, use joiningType() instead.
Returns information about the joining properties of the character
(needed for certain languages such as Arabic).
@@ -1061,6 +1109,8 @@ QChar::Direction QChar::direction(uint ucs4)
/*!
\overload
+ \deprecated in 5.3, use joiningType() instead.
+
Returns information about the joining properties of the UCS-4-encoded
character specified by \a ucs4 (needed for certain languages such as Arabic).
*/
@@ -1068,8 +1118,15 @@ QChar::Joining QChar::joining(uint ucs4)
{
if (ucs4 > LastValidCodePoint)
return QChar::OtherJoining;
- return (QChar::Joining) qGetProp(ucs4)->joining;
+ switch (qGetProp(ucs4)->joining) {
+ case QChar::Joining_Causing: return QChar::Center;
+ case QChar::Joining_Dual: return QChar::Dual;
+ case QChar::Joining_Right: return QChar::Right;
+ default: break;
+ }
+ return QChar::OtherJoining;
}
+#endif
/*!
\fn bool QChar::hasMirrored() const