From c26764686718f46a22371ea16d683d6bf17b9e66 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 5 Nov 2015 11:03:28 +0400 Subject: [PATCH] Move CasexTraits from qstring.cpp to qunicodetables_p.h and implement TitlecaseTraits as well, to be re-used in the following commit. Change-Id: I5c0bff42fe3b9bc9c2454cc16916cc2be87f604f Reviewed-by: Lars Knoll --- src/corelib/tools/qstring.cpp | 24 --------------------- src/corelib/tools/qunicodetables_p.h | 32 ++++++++++++++++++++++++++++ util/unicode/main.cpp | 32 ++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 24 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index a88b48c767..6b15900031 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -5666,30 +5666,6 @@ QString QString::rightJustified(int width, QChar fill, bool truncate) const */ namespace QUnicodeTables { -struct LowercaseTraits -{ - static signed short caseDiff(const Properties *prop) - { return prop->lowerCaseDiff; } - static bool caseSpecial(const Properties *prop) - { return prop->lowerCaseSpecial; } -}; - -struct UppercaseTraits -{ - static signed short caseDiff(const Properties *prop) - { return prop->upperCaseDiff; } - static bool caseSpecial(const Properties *prop) - { return prop->upperCaseSpecial; } -}; - -struct CasefoldTraits -{ - static signed short caseDiff(const Properties *prop) - { return prop->caseFoldDiff; } - static bool caseSpecial(const Properties *prop) - { return prop->caseFoldSpecial; } -}; - template Q_NEVER_INLINE static QString detachAndConvertCase(T &str, QStringIterator it) diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index 1fbcc39666..6a2797be0e 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -82,6 +82,38 @@ struct Properties { Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW; Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW; +struct LowercaseTraits +{ + static inline signed short caseDiff(const Properties *prop) + { return prop->lowerCaseDiff; } + static inline bool caseSpecial(const Properties *prop) + { return prop->lowerCaseSpecial; } +}; + +struct UppercaseTraits +{ + static inline signed short caseDiff(const Properties *prop) + { return prop->upperCaseDiff; } + static inline bool caseSpecial(const Properties *prop) + { return prop->upperCaseSpecial; } +}; + +struct TitlecaseTraits +{ + static inline signed short caseDiff(const Properties *prop) + { return prop->titleCaseDiff; } + static inline bool caseSpecial(const Properties *prop) + { return prop->titleCaseSpecial; } +}; + +struct CasefoldTraits +{ + static inline signed short caseDiff(const Properties *prop) + { return prop->caseFoldDiff; } + static inline bool caseSpecial(const Properties *prop) + { return prop->caseFoldSpecial; } +}; + enum GraphemeBreakClass { GraphemeBreak_Other, GraphemeBreak_CR, diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index 35f5aa9d24..d1713795dd 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -765,6 +765,38 @@ static const char *property_string = "};\n\n" "Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW;\n" "Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW;\n" + "\n" + "struct LowercaseTraits\n" + "{\n" + " static inline signed short caseDiff(const Properties *prop)\n" + " { return prop->lowerCaseDiff; }\n" + " static inline bool caseSpecial(const Properties *prop)\n" + " { return prop->lowerCaseSpecial; }\n" + "};\n" + "\n" + "struct UppercaseTraits\n" + "{\n" + " static inline signed short caseDiff(const Properties *prop)\n" + " { return prop->upperCaseDiff; }\n" + " static inline bool caseSpecial(const Properties *prop)\n" + " { return prop->upperCaseSpecial; }\n" + "};\n" + "\n" + "struct TitlecaseTraits\n" + "{\n" + " static inline signed short caseDiff(const Properties *prop)\n" + " { return prop->titleCaseDiff; }\n" + " static inline bool caseSpecial(const Properties *prop)\n" + " { return prop->titleCaseSpecial; }\n" + "};\n" + "\n" + "struct CasefoldTraits\n" + "{\n" + " static inline signed short caseDiff(const Properties *prop)\n" + " { return prop->caseFoldDiff; }\n" + " static inline bool caseSpecial(const Properties *prop)\n" + " { return prop->caseFoldSpecial; }\n" + "};\n" "\n"; static const char *methods =