diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qunicodetables.cpp | 15 | ||||
-rw-r--r-- | src/corelib/tools/qunicodetables_p.h | 24 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp index 04031251e4..9a2a36cd49 100644 --- a/src/corelib/tools/qunicodetables.cpp +++ b/src/corelib/tools/qunicodetables.cpp @@ -4348,6 +4348,21 @@ Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) return qGetProp(ucs2); } +Q_CORE_EXPORT GraphemeBreak QT_FASTCALL graphemeBreakClass(uint ucs4) +{ + return (GraphemeBreak)qGetProp(ucs4)->graphemeBreak; +} + +Q_CORE_EXPORT WordBreak QT_FASTCALL wordBreakClass(uint ucs4) +{ + return (WordBreak)qGetProp(ucs4)->wordBreak; +} + +Q_CORE_EXPORT SentenceBreak QT_FASTCALL sentenceBreakClass(uint ucs4) +{ + return (SentenceBreak)qGetProp(ucs4)->sentenceBreak; +} + Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) { return (LineBreakClass)qGetProp(ucs4)->line_break_class; 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 |