From 32006535461d05d48bb8c63d27ed7e08215d7165 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Thu, 31 Mar 2016 13:54:30 +0300 Subject: QLocalePrivate: add overloaded codeToScript() and codeToLanguage() ... for QStringRef and QChar array. Now we can use QStringRef arg or QChar array arg to avoid unnecessary allocations. Also mark these functions as Q_DECL_NOTHROW. Change-Id: Ibe75346d80cc413e303fad886ecb82dbdb89af24 Reviewed-by: Edward Welbourne Reviewed-by: Marc Mutz --- src/corelib/tools/qlocale_p.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools/qlocale_p.h') diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index edffcea3e5..f95edf4d14 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -353,8 +353,12 @@ public: static QString languageToCode(QLocale::Language language); static QString scriptToCode(QLocale::Script script); static QString countryToCode(QLocale::Country country); - static QLocale::Language codeToLanguage(const QString &code); - static QLocale::Script codeToScript(const QString &code); + static QLocale::Language codeToLanguage(const QChar *code, int len) Q_DECL_NOTHROW; + static QLocale::Language codeToLanguage(const QString &code) Q_DECL_NOTHROW { return codeToLanguage(code.data(), code.size()); } + static QLocale::Language codeToLanguage(const QStringRef &code) Q_DECL_NOTHROW { return codeToLanguage(code.data(), code.size()); } + static QLocale::Script codeToScript(const QChar *code, int len) Q_DECL_NOTHROW; + static QLocale::Script codeToScript(const QString &code) Q_DECL_NOTHROW { return codeToScript(code.data(), code.size()); } + static QLocale::Script codeToScript(const QStringRef &code) Q_DECL_NOTHROW { return codeToScript(code.data(), code.size()); } static QLocale::Country codeToCountry(const QChar *code, int len) Q_DECL_NOTHROW; static QLocale::Country codeToCountry(const QString &code) Q_DECL_NOTHROW { return codeToCountry(code.data(), code.size()); } static QLocale::Country codeToCountry(const QStringRef &code) Q_DECL_NOTHROW { return codeToCountry(code.data(), code.size()); } -- cgit v1.2.3