From 80d1e732d813c6101d1e7462b5685bd895807084 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Wed, 30 Mar 2016 18:25:32 +0300 Subject: QLocalePrivate: overload codeToCountry() 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: I22b08a054051e80e3f76bb543d860f3dcb6caa4f Reviewed-by: Marc Mutz --- src/corelib/tools/qlocale_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (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 a2cfecb933..edffcea3e5 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -355,7 +355,9 @@ public: static QString countryToCode(QLocale::Country country); static QLocale::Language codeToLanguage(const QString &code); static QLocale::Script codeToScript(const QString &code); - static QLocale::Country codeToCountry(const QString &code); + 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()); } static void getLangAndCountry(const QString &name, QLocale::Language &lang, QLocale::Script &script, QLocale::Country &cntry); -- cgit v1.2.3