diff options
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 24 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_mac.mm | 8 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_p.h | 14 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_unix.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_win.cpp | 6 |
5 files changed, 28 insertions, 28 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 2a5522a..e264a64 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -232,7 +232,7 @@ QString QLocalePrivate::bcp47Name() const return name; } -const QLocalePrivate *findLocale(QLocale::Language language, QLocale::Script script, QLocale::Country country) +const QLocalePrivate *QLocalePrivate::findLocale(QLocale::Language language, QLocale::Script script, QLocale::Country country) { const unsigned language_id = language; const unsigned script_id = script; @@ -293,7 +293,7 @@ static bool parse_locale_tag(const QString &input, int &i, QString *result, cons return true; } -bool splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry) +bool qt_splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry) { const int length = name.length(); @@ -358,7 +358,7 @@ void QLocalePrivate::getLangAndCountry(const QString &name, QLocale::Language &l QString lang_code; QString script_code; QString cntry_code; - if (!splitLocaleName(name, lang_code, script_code, cntry_code)) + if (!qt_splitLocaleName(name, lang_code, script_code, cntry_code)) return; lang = QLocalePrivate::codeToLanguage(lang_code); @@ -368,17 +368,17 @@ void QLocalePrivate::getLangAndCountry(const QString &name, QLocale::Language &l cntry = QLocalePrivate::codeToCountry(cntry_code); } -const QLocalePrivate *findLocale(const QString &name) +static const QLocalePrivate *findLocale(const QString &name) { QLocale::Language lang; QLocale::Script script; QLocale::Country cntry; QLocalePrivate::getLangAndCountry(name, lang, script, cntry); - return findLocale(lang, script, cntry); + return QLocalePrivate::findLocale(lang, script, cntry); } -QString readEscapedFormatString(const QString &format, int *idx) +QString qt_readEscapedFormatString(const QString &format, int *idx) { int &i = *idx; @@ -412,7 +412,7 @@ QString readEscapedFormatString(const QString &format, int *idx) return result; } -int repeatCount(const QString &s, int i) +int qt_repeatCount(const QString &s, int i) { QChar c = s.at(i); int j = i + 1; @@ -686,7 +686,7 @@ QLocale::QLocale() QLocale::QLocale(Language language, Country country) : v(0) { - const QLocalePrivate *d = findLocale(language, QLocale::AnyScript, country); + const QLocalePrivate *d = QLocalePrivate::findLocale(language, QLocale::AnyScript, country); // If not found, should default to system if (d->languageId() == QLocale::C && language != QLocale::C) { @@ -725,7 +725,7 @@ QLocale::QLocale(Language language, Country country) QLocale::QLocale(Language language, Script script, Country country) : v(0) { - const QLocalePrivate *d = findLocale(language, script, country); + const QLocalePrivate *d = QLocalePrivate::findLocale(language, script, country); // If not found, should default to system if (d->languageId() == QLocale::C && language != QLocale::C) { @@ -1304,7 +1304,7 @@ static bool timeFormatContainsAP(const QString &format) int i = 0; while (i < format.size()) { if (format.at(i).unicode() == '\'') { - readEscapedFormatString(format, &i); + qt_readEscapedFormatString(format, &i); continue; } @@ -2226,12 +2226,12 @@ QString QLocalePrivate::dateTimeToString(const QString &format, const QDate *dat int i = 0; while (i < format.size()) { if (format.at(i).unicode() == '\'') { - result.append(readEscapedFormatString(format, &i)); + result.append(qt_readEscapedFormatString(format, &i)); continue; } const QChar c = format.at(i); - int repeat = repeatCount(format, i); + int repeat = qt_repeatCount(format, i); bool used = false; if (date) { switch (c.unicode()) { diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index ba7ca7d..c824ec0 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -75,7 +75,7 @@ static QByteArray getMacLocaleName() QString lang, script, cntry; if (result.isEmpty() || result != "C" - && !splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry)) { + && !qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry)) { QCFType<CFLocaleRef> l = CFLocaleCopyCurrent(); CFStringRef locale = CFLocaleGetIdentifier(l); result = QCFString::toQString(locale).toUtf8(); @@ -173,7 +173,7 @@ static QString macToQtFormat(const QString &sys_fmt) while (i < sys_fmt.size()) { if (sys_fmt.at(i).unicode() == '\'') { - QString text = readEscapedFormatString(sys_fmt, &i); + QString text = qt_readEscapedFormatString(sys_fmt, &i); if (text == QLatin1String("'")) result += QLatin1String("''"); else @@ -182,7 +182,7 @@ static QString macToQtFormat(const QString &sys_fmt) } QChar c = sys_fmt.at(i); - int repeat = repeatCount(sys_fmt, i); + int repeat = qt_repeatCount(sys_fmt, i); switch (c.unicode()) { case 'G': // Qt doesn't support these :( @@ -439,7 +439,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const getMacPreferredLanguageAndCountry(&preferredLanguage, &preferredCountry); QLocale::Language languageCode = (preferredLanguage.isEmpty() ? QLocale::C : QLocalePrivate::codeToLanguage(preferredLanguage)); QLocale::Country countryCode = (preferredCountry.isEmpty() ? QLocale::AnyCountry : QLocalePrivate::codeToCountry(preferredCountry)); - const QLocalePrivate *d = findLocale(languageCode, QLocale::AnyScript, countryCode); + const QLocalePrivate *d = QLocalePrivate::findLocale(languageCode, QLocale::AnyScript, countryCode); if (type == LanguageId) return (QLocale::Language)d->languageId(); return (QLocale::Country)d->countryId(); diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 5326a77..e600807 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -91,6 +91,10 @@ public: static QLocale::Country codeToCountry(const QString &code); static void getLangAndCountry(const QString &name, QLocale::Language &lang, QLocale::Script &script, QLocale::Country &cntry); + static const QLocalePrivate *findLocale(QLocale::Language language, + QLocale::Script script, + QLocale::Country country); + QLocale::MeasurementSystem measurementSystem() const; @@ -264,13 +268,9 @@ private: }; #endif -const QLocalePrivate *findLocale(QLocale::Language language, - QLocale::Script script, - QLocale::Country country); -const QLocalePrivate *findLocale(const QString &name); -QString readEscapedFormatString(const QString &format, int *idx); -bool splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry); -int repeatCount(const QString &s, int i); +QString qt_readEscapedFormatString(const QString &format, int *idx); +bool qt_splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry); +int qt_repeatCount(const QString &s, int i); QT_END_NAMESPACE diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp index 117e2e4..21097bf 100644 --- a/src/corelib/tools/qlocale_unix.cpp +++ b/src/corelib/tools/qlocale_unix.cpp @@ -192,7 +192,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const for (int i = 0; i < lst.size();) { const QString &name = lst.at(i); QString lang, script, cntry; - if (name.isEmpty() || !splitLocaleName(name, lang, script, cntry)) + if (name.isEmpty() || !qt_splitLocaleName(name, lang, script, cntry)) lst.removeAt(i); else ++i; @@ -201,7 +201,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const } if (!d->lc_messages_var.isEmpty()) { QString lang, script, cntry; - if (splitLocaleName(QString::fromLatin1(d->lc_messages_var.constData(), d->lc_messages_var.size()), + if (qt_splitLocaleName(QString::fromLatin1(d->lc_messages_var.constData(), d->lc_messages_var.size()), lang, script, cntry)) { if (!cntry.length() && lang.length()) return QStringList(lang); diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index c892e04..0c2d039 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -573,7 +573,7 @@ QString QSystemLocalePrivate::winToQtFormat(const QString &sys_fmt) while (i < sys_fmt.size()) { if (sys_fmt.at(i).unicode() == QLatin1Char('\'')) { - QString text = readEscapedFormatString(sys_fmt, &i); + QString text = qt_readEscapedFormatString(sys_fmt, &i); if (text == QLatin1String("'")) result += QLatin1String("''"); else @@ -582,7 +582,7 @@ QString QSystemLocalePrivate::winToQtFormat(const QString &sys_fmt) } QChar c = sys_fmt.at(i); - int repeat = repeatCount(sys_fmt, i); + int repeat = qt_repeatCount(sys_fmt, i); switch (c.unicode()) { // Date @@ -925,7 +925,7 @@ static QByteArray getWinLocaleName(LCID id) result = langEnvVar; QString lang, script, cntry; if ( result == "C" || (!result.isEmpty() - && splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry)) ) { + && qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry)) ) { long id = 0; bool ok = false; id = qstrtoll(result.data(), 0, 0, &ok); |