summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qunicodetables_p.h
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-05-09 16:44:36 +0300
committerQt by Nokia <qt-info@nokia.com>2012-05-10 11:34:25 +0200
commit8c0048a377568b646b3b87be0b02322fce68b780 (patch)
tree575e79f7191060be29ba17989bc9676b272e3370 /src/corelib/tools/qunicodetables_p.h
parent2d23374a6f88bac2f5f2d7f0528e9e554b4a4cbb (diff)
add some useful methods to QUnicodeTables::
in order to reduce code duplication and prepare the ground for upcoming changes Change-Id: I980244149f65384c9484bbec4682de8b7b848b08 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/tools/qunicodetables_p.h')
-rw-r--r--src/corelib/tools/qunicodetables_p.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index 50afebdd9c..15d5415b0b 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -217,6 +217,18 @@ namespace QUnicodeTables {
};
+ Q_CORE_EXPORT GraphemeBreak QT_FASTCALL graphemeBreakClass(uint ucs4);
+ inline int graphemeBreakClass(QChar ch)
+ { return graphemeBreakClass(ch.unicode()); }
+
+ Q_CORE_EXPORT WordBreak QT_FASTCALL wordBreakClass(uint ucs4);
+ inline int wordBreakClass(QChar ch)
+ { return wordBreakClass(ch.unicode()); }
+
+ Q_CORE_EXPORT SentenceBreak QT_FASTCALL sentenceBreakClass(uint ucs4);
+ inline int sentenceBreakClass(QChar ch)
+ { return sentenceBreakClass(ch.unicode()); }
+
Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4);
inline int lineBreakClass(QChar ch)
{ return lineBreakClass(ch.unicode()); }
@@ -225,6 +237,18 @@ namespace QUnicodeTables {
inline int script(QChar ch)
{ return script(ch.unicode()); }
+
+ inline bool isNonCharacter(uint ucs4)
+ {
+ // Noncharacter_Code_Point:
+ // Unicode has a couple of "non-characters" that one can use internally,
+ // but are not allowed to be used for text interchange.
+ // Those are the last two entries each Unicode Plane (U+FFFE..U+FFFF,
+ // U+1FFFE..U+1FFFF, etc.) as well as the entries in range U+FDD0..U+FDEF
+
+ return ucs4 >= 0xfdd0 && (ucs4 <= 0xfdef || (ucs4 & 0xfffe) == 0xfffe);
+ }
+
} // namespace QUnicodeTables
QT_END_NAMESPACE