diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qcommandlineoption.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qcommandlineparser.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 80 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.h | 18 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime_p.h | 14 | ||||
-rw-r--r-- | src/corelib/tools/qlist.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_mac.mm | 40 | ||||
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qtimezone.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_mac.mm | 20 | ||||
-rw-r--r-- | src/corelib/tools/qvector.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/tools.pri | 52 |
12 files changed, 132 insertions, 105 deletions
diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h index 6ebaab3d48..4dcae03ad9 100644 --- a/src/corelib/tools/qcommandlineoption.h +++ b/src/corelib/tools/qcommandlineoption.h @@ -43,6 +43,8 @@ #include <QtCore/qstringlist.h> #include <QtCore/qshareddata.h> +QT_REQUIRE_CONFIG(commandlineparser); + QT_BEGIN_NAMESPACE class QCommandLineOptionPrivate; diff --git a/src/corelib/tools/qcommandlineparser.h b/src/corelib/tools/qcommandlineparser.h index 51bab66ca7..4584c384cc 100644 --- a/src/corelib/tools/qcommandlineparser.h +++ b/src/corelib/tools/qcommandlineparser.h @@ -45,6 +45,8 @@ #include <QtCore/qcoreapplication.h> #include <QtCore/qcommandlineoption.h> +QT_REQUIRE_CONFIG(commandlineparser); + QT_BEGIN_NAMESPACE class QCommandLineParserPrivate; diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index ac8054ce82..50b9f0decb 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -46,7 +46,9 @@ #include "qset.h" #include "qlocale.h" #include "qdatetime.h" +#if QT_CONFIG(timezone) #include "qtimezoneprivate_p.h" +#endif #include "qregexp.h" #include "qdebug.h" #ifndef Q_OS_WIN @@ -1328,7 +1330,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format) QDate QDate::fromString(const QString &string, const QString &format) { QDate date; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 if (dt.parseFormat(format)) @@ -2017,7 +2019,7 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format) QTime QTime::fromString(const QString &string, const QString &format) { QTime time; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString); // dt.setDefaultLocale(QLocale::c()); ### Qt 6 if (dt.parseFormat(format)) @@ -2576,7 +2578,7 @@ static void refreshDateTime(QDateTimeData &d) QTime testTime; Q_ASSERT(spec == Qt::TimeZone || spec == Qt::LocalTime); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) // If not valid time zone then is invalid if (spec == Qt::TimeZone) { if (!d->m_timeZone.isValid()) @@ -2584,7 +2586,7 @@ static void refreshDateTime(QDateTimeData &d) else epochMSecs = QDateTimePrivate::zoneMSecsToEpochMSecs(msecs, d->m_timeZone, &testDate, &testTime); } -#endif // QT_BOOTSTRAPPED +#endif // timezone // If not valid date and time then is invalid if (!(status & QDateTimePrivate::ValidDate) || !(status & QDateTimePrivate::ValidTime)) { @@ -2676,9 +2678,9 @@ static void setTimeSpec(QDateTimeData &d, Qt::TimeSpec spec, int offsetSeconds) d.detach(); d->m_status = status & ~QDateTimePrivate::ShortData; d->m_offsetFromUtc = offsetSeconds; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) d->m_timeZone = QTimeZone(); -#endif // QT_BOOTSTRAPPED +#endif // timezone } } @@ -2889,7 +2891,7 @@ QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime &toTim return result; } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) inline QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime &toTime, const QTimeZone &toTimeZone) { @@ -2918,7 +2920,7 @@ inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QT return zoneMSecs - (data.standardTimeOffset * 1000); } } -#endif // QT_BOOTSTRAPPED +#endif // timezone /***************************************************************************** QDateTime member functions @@ -3112,7 +3114,7 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec, in { } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) /*! \since 5.2 @@ -3128,7 +3130,7 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, const QTimeZone &time : d(QDateTimePrivate::create(date, time, timeZone)) { } -#endif // QT_BOOTSTRAPPED +#endif // timezone /*! Constructs a copy of the \a other datetime. @@ -3248,7 +3250,7 @@ Qt::TimeSpec QDateTime::timeSpec() const return getSpec(d); } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) /*! \since 5.2 @@ -3276,7 +3278,7 @@ QTimeZone QDateTime::timeZone() const } return QTimeZone(); } -#endif // QT_BOOTSTRAPPED +#endif // timezone /*! \since 5.2 @@ -3339,15 +3341,15 @@ QString QDateTime::timeZoneAbbreviation() const { switch (getSpec(d)) { case Qt::UTC: - return QTimeZonePrivate::utcQString(); + return QLatin1String("UTC"); case Qt::OffsetFromUTC: - return QTimeZonePrivate::utcQString() + toOffsetString(Qt::ISODate, d->m_offsetFromUtc); + return QLatin1String("UTC") + toOffsetString(Qt::ISODate, d->m_offsetFromUtc); case Qt::TimeZone: -#ifdef QT_BOOTSTRAPPED +#if !QT_CONFIG(timezone) break; #else return d->m_timeZone.d->abbreviation(toMSecsSinceEpoch()); -#endif // QT_BOOTSTRAPPED +#endif // timezone case Qt::LocalTime: { QString abbrev; auto status = extractDaylightStatus(getStatus(d)); @@ -3376,11 +3378,11 @@ bool QDateTime::isDaylightTime() const case Qt::OffsetFromUTC: return false; case Qt::TimeZone: -#ifdef QT_BOOTSTRAPPED +#if !QT_CONFIG(timezone) break; #else return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch()); -#endif // QT_BOOTSTRAPPED +#endif // timezone case Qt::LocalTime: { auto status = extractDaylightStatus(getStatus(d)); if (status == QDateTimePrivate::UnknownDaylightTime) @@ -3464,7 +3466,7 @@ void QDateTime::setOffsetFromUtc(int offsetSeconds) checkValidDateTime(d); } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) /*! \since 5.2 @@ -3484,7 +3486,7 @@ void QDateTime::setTimeZone(const QTimeZone &toZone) d->m_timeZone = toZone; refreshDateTime(d); } -#endif // QT_BOOTSTRAPPED +#endif // timezone /*! \since 4.7 @@ -3517,7 +3519,7 @@ qint64 QDateTime::toMSecsSinceEpoch() const } case Qt::TimeZone: -#ifdef QT_BOOTSTRAPPED +#if !QT_CONFIG(timezone) return 0; #else return QDateTimePrivate::zoneMSecsToEpochMSecs(d->m_msecs, d->m_timeZone); @@ -3615,7 +3617,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) break; case Qt::TimeZone: Q_ASSERT(!d.isShort()); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) // Docs state any LocalTime before 1970-01-01 will *not* have any DST applied // but all affected times afterwards will have DST applied. d.detach(); @@ -3628,7 +3630,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) | QDateTimePrivate::ValidDate | QDateTimePrivate::ValidTime | QDateTimePrivate::ValidDateTime; -#endif // QT_BOOTSTRAPPED +#endif // timezone break; case Qt::LocalTime: { QDate dt; @@ -3905,10 +3907,10 @@ static inline void massageAdjustedDateTime(const QDateTimeData &d, QDate *date, if (spec == Qt::LocalTime) { QDateTimePrivate::DaylightStatus status = QDateTimePrivate::UnknownDaylightTime; localMSecsToEpochMSecs(timeToMSecs(*date, *time), &status, date, time); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) } else if (spec == Qt::TimeZone) { QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(*date, *time), d->m_timeZone, date, time); -#endif // QT_BOOTSTRAPPED +#endif // timezone } } @@ -4168,7 +4170,7 @@ QDateTime QDateTime::toOffsetFromUtc(int offsetSeconds) const return fromMSecsSinceEpoch(toMSecsSinceEpoch(), Qt::OffsetFromUTC, offsetSeconds); } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) /*! \since 5.2 @@ -4190,7 +4192,7 @@ QDateTime QDateTime::toTimeZone(const QTimeZone &timeZone) const return fromMSecsSinceEpoch(toMSecsSinceEpoch(), timeZone); } -#endif // QT_BOOTSTRAPPED +#endif // timezone /*! Returns \c true if this datetime is equal to the \a other datetime; @@ -4449,7 +4451,7 @@ QDateTime QDateTime::fromTime_t(uint seconds, Qt::TimeSpec spec, int offsetSecon return fromMSecsSinceEpoch((qint64)seconds * 1000, spec, offsetSeconds); } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) /*! \since 5.2 \deprecated @@ -4542,7 +4544,7 @@ QDateTime QDateTime::fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec, int offs return fromMSecsSinceEpoch(secs * 1000, spec, offsetSeconds); } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) /*! \since 5.2 @@ -4931,7 +4933,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) QDateTime QDateTime::fromString(const QString &string, const QString &format) { -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QTime time; QDate date; @@ -5075,10 +5077,10 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime) out << dateAndTime << qint8(dateTime.timeSpec()); if (dateTime.timeSpec() == Qt::OffsetFromUTC) out << qint32(dateTime.offsetFromUtc()); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) else if (dateTime.timeSpec() == Qt::TimeZone) out << dateTime.timeZone(); -#endif // QT_BOOTSTRAPPED +#endif // timezone } else if (out.version() == QDataStream::Qt_5_0) { @@ -5135,9 +5137,9 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime) qint8 ts = 0; Qt::TimeSpec spec = Qt::LocalTime; qint32 offset = 0; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QTimeZone tz; -#endif // QT_BOOTSTRAPPED +#endif // timezone if (in.version() >= QDataStream::Qt_5_2) { @@ -5147,11 +5149,11 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime) if (spec == Qt::OffsetFromUTC) { in >> offset; dateTime = QDateTime(dt, tm, spec, offset); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) } else if (spec == Qt::TimeZone) { in >> tz; dateTime = QDateTime(dt, tm, tz); -#endif // QT_BOOTSTRAPPED +#endif // timezone } else { dateTime = QDateTime(dt, tm, spec); } @@ -5177,7 +5179,7 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime) break; case QDateTimePrivate::TimeZone: spec = Qt::TimeZone; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) // FIXME: need to use a different constructor ! #endif break; @@ -5234,9 +5236,9 @@ QDebug operator<<(QDebug dbg, const QDateTime &date) dbg << ' ' << date.offsetFromUtc() << 's'; break; case Qt::TimeZone: -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) dbg << ' ' << date.timeZone().id(); -#endif // QT_BOOTSTRAPPED +#endif // timezone break; case Qt::LocalTime: break; diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index ebf9b45570..c7f14ed40a 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -253,9 +253,9 @@ public: QDateTime(const QDate &, const QTime &, Qt::TimeSpec spec = Qt::LocalTime); // ### Qt 6: Merge with above with default offsetSeconds = 0 QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec, int offsetSeconds); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QDateTime(const QDate &date, const QTime &time, const QTimeZone &timeZone); -#endif // QT_BOOTSTRAPPED +#endif // timezone QDateTime(const QDateTime &other) Q_DECL_NOTHROW; QDateTime(QDateTime &&other) Q_DECL_NOTHROW; ~QDateTime(); @@ -274,9 +274,9 @@ public: QTime time() const; Qt::TimeSpec timeSpec() const; int offsetFromUtc() const; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QTimeZone timeZone() const; -#endif // QT_BOOTSTRAPPED +#endif // timezone QString timeZoneAbbreviation() const; bool isDaylightTime() const; @@ -287,9 +287,9 @@ public: void setTime(const QTime &time); void setTimeSpec(Qt::TimeSpec spec); void setOffsetFromUtc(int offsetSeconds); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) void setTimeZone(const QTimeZone &toZone); -#endif // QT_BOOTSTRAPPED +#endif // timezone void setMSecsSinceEpoch(qint64 msecs); void setSecsSinceEpoch(qint64 secs); @@ -307,9 +307,9 @@ public: inline QDateTime toLocalTime() const { return toTimeSpec(Qt::LocalTime); } inline QDateTime toUTC() const { return toTimeSpec(Qt::UTC); } QDateTime toOffsetFromUtc(int offsetSeconds) const; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QDateTime toTimeZone(const QTimeZone &toZone) const; -#endif // QT_BOOTSTRAPPED +#endif // timezone qint64 daysTo(const QDateTime &) const; qint64 secsTo(const QDateTime &) const; @@ -348,7 +348,7 @@ public: static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetFromUtc = 0); static QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spe = Qt::LocalTime, int offsetFromUtc = 0); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone); static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone); #endif diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h index 38a084b257..eb33dddbb7 100644 --- a/src/corelib/tools/qdatetime_p.h +++ b/src/corelib/tools/qdatetime_p.h @@ -58,7 +58,9 @@ #include "QtCore/qdatetime.h" #include "QtCore/qpair.h" +#if QT_CONFIG(timezone) #include "qtimezone.h" +#endif QT_BEGIN_NAMESPACE @@ -118,22 +120,22 @@ public: static QDateTime::Data create(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec, int offsetSeconds); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) static QDateTime::Data create(const QDate &toDate, const QTime &toTime, const QTimeZone & timeZone); -#endif // QT_BOOTSTRAPPED +#endif // timezone qint64 m_msecs; StatusFlags m_status; int m_offsetFromUtc; mutable QAtomicInt ref; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) QTimeZone m_timeZone; -#endif // QT_BOOTSTRAPPED +#endif // timezone -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(timezone) static qint64 zoneMSecsToEpochMSecs(qint64 msecs, const QTimeZone &zone, QDate *localDate = 0, QTime *localTime = 0); -#endif // QT_BOOTSTRAPPED +#endif // timezone static inline qint64 minJd() { return QDate::minJd(); } static inline qint64 maxJd() { return QDate::maxJd(); } diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 1762da2c8f..5f26e704c4 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -370,7 +370,7 @@ void **QListData::erase(void **xi) application must interface with a C API. \note Iterators into a QLinkedList and references into - heap-allocating QLists remain valid long as the referenced items + heap-allocating QLists remain valid as long as the referenced items remain in the container. This is not true for iterators and references into a QVector and non-heap-allocating QLists. diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index 4f6efc8832..8587716446 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -76,7 +76,7 @@ static QByteArray getMacLocaleName() || (result != "C" && !qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry))) { QCFType<CFLocaleRef> l = CFLocaleCopyCurrent(); CFStringRef locale = CFLocaleGetIdentifier(l); - result = QCFString::toQString(locale).toUtf8(); + result = QString::fromCFString(locale).toUtf8(); } return result; } @@ -96,7 +96,7 @@ static QString macMonthName(int month, bool short_format) : kCFDateFormatterMonthSymbols)); if (values != 0) { CFStringRef cfstring = static_cast<CFStringRef>(CFArrayGetValueAtIndex(values, month)); - return QCFString::toQString(cfstring); + return QString::fromCFString(cfstring); } return QString(); } @@ -114,7 +114,7 @@ static QString macDayName(int day, bool short_format) : kCFDateFormatterWeekdaySymbols)); if (values != 0) { CFStringRef cfstring = static_cast<CFStringRef>(CFArrayGetValueAtIndex(values, day % 7)); - return QCFString::toQString(cfstring); + return QString::fromCFString(cfstring); } return QString(); } @@ -293,7 +293,7 @@ QString getMacDateFormat(CFDateFormatterStyle style) QCFType<CFLocaleRef> l = CFLocaleCopyCurrent(); QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(kCFAllocatorDefault, l, style, kCFDateFormatterNoStyle); - return macToQtFormat(QCFString::toQString(CFDateFormatterGetFormat(formatter))); + return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter))); } static QString getMacTimeFormat(CFDateFormatterStyle style) @@ -301,21 +301,21 @@ static QString getMacTimeFormat(CFDateFormatterStyle style) QCFType<CFLocaleRef> l = CFLocaleCopyCurrent(); QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(kCFAllocatorDefault, l, kCFDateFormatterNoStyle, style); - return macToQtFormat(QCFString::toQString(CFDateFormatterGetFormat(formatter))); + return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter))); } static QString getCFLocaleValue(CFStringRef key) { QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent(); CFTypeRef value = CFLocaleGetValue(locale, key); - return QCFString::toQString(CFStringRef(static_cast<CFTypeRef>(value))); + return QString::fromCFString(CFStringRef(static_cast<CFTypeRef>(value))); } static QLocale::MeasurementSystem macMeasurementSystem() { QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent(); CFStringRef system = static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleMeasurementSystem)); - if (QCFString::toQString(system) == QLatin1String("Metric")) { + if (QString::fromCFString(system) == QLatin1String("Metric")) { return QLocale::MetricSystem; } else { return QLocale::ImperialSystem; @@ -337,13 +337,13 @@ static QString macCurrencySymbol(QLocale::CurrencySymbolFormat format) QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent(); switch (format) { case QLocale::CurrencyIsoCode: - return QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode))); + return QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode))); case QLocale::CurrencySymbol: - return QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencySymbol))); + return QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencySymbol))); case QLocale::CurrencyDisplayName: { CFStringRef code = static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode)); QCFType<CFStringRef> value = CFLocaleCopyDisplayNameForPropertyValue(locale, kCFLocaleCurrencyCode, code); - return QCFString::toQString(value); + return QString::fromCFString(value); } default: break; @@ -382,10 +382,10 @@ static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument & CFNumberFormatterCreate(NULL, locale, kCFNumberFormatterCurrencyStyle); if (!arg.symbol.isEmpty()) { CFNumberFormatterSetProperty(currencyFormatter, kCFNumberFormatterCurrencySymbol, - QCFString::toCFStringRef(arg.symbol)); + arg.symbol.toCFString()); } QCFType<CFStringRef> result = CFNumberFormatterCreateStringWithNumber(NULL, currencyFormatter, value); - return QCFString::toQString(result); + return QString::fromCFString(result); } static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str) @@ -394,12 +394,12 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef & QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent(); switch (type) { case QSystemLocale::StringToStandardQuotation: - begin = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationBeginDelimiterKey))); - end = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationEndDelimiterKey))); + begin = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationBeginDelimiterKey))); + end = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationEndDelimiterKey))); return QString(begin % str % end); case QSystemLocale::StringToAlternateQuotation: - begin = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationBeginDelimiterKey))); - end = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationEndDelimiterKey))); + begin = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationBeginDelimiterKey))); + end = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationEndDelimiterKey))); return QString(begin % str % end); default: break; @@ -468,7 +468,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterLongStyle, kCFDateFormatterLongStyle); QCFType<CFStringRef> value = static_cast<CFStringRef>(CFDateFormatterCopyProperty(formatter, (type == AMText ? kCFDateFormatterAMSymbol : kCFDateFormatterPMSymbol))); - return QCFString::toQString(value); + return QString::fromCFString(value); } case FirstDayOfWeek: return QVariant(macFirstDayOfWeek()); @@ -491,15 +491,15 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const const int cnt = CFArrayGetCount(languages.as<CFArrayRef>()); result.reserve(cnt); for (int i = 0; i < cnt; ++i) { - const QString lang = QCFString::toQString( + const QString lang = QString::fromCFString( static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages.as<CFArrayRef>(), i))); result.append(lang); } } else if (typeId == CFStringGetTypeID()) { - result = QStringList(QCFString::toQString(languages.as<CFStringRef>())); + result = QStringList(QString::fromCFString(languages.as<CFStringRef>())); } else { qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt.io", - qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId)))); + qPrintable(QString::fromCFString(CFCopyTypeIDDescription(typeId)))); } return QVariant(result); } diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 2fd4be00a5..3b6c85ca8a 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -471,6 +471,9 @@ static inline quint64 qCpuFeatures() #define ALIGNMENT_PROLOGUE_32BYTES(ptr, i, length) \ for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((8 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x7)) & 0x7))); ++i) +#define SIMD_EPILOGUE(i, length, max) \ + for (int _i = 0; _i < max && i < length; ++i, ++_i) + QT_END_NAMESPACE #endif // QSIMD_P_H diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index db99f07f44..083f87f39f 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -45,6 +45,8 @@ #include <QtCore/qlocale.h> #include <QtCore/qdatetime.h> +QT_REQUIRE_CONFIG(timezone); + QT_BEGIN_NAMESPACE class QTimeZonePrivate; diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm index 77c04ac20c..5dfffeaf36 100644 --- a/src/corelib/tools/qtimezoneprivate_mac.mm +++ b/src/corelib/tools/qtimezoneprivate_mac.mm @@ -90,7 +90,7 @@ QTimeZonePrivate *QMacTimeZonePrivate::clone() void QMacTimeZonePrivate::init(const QByteArray &ianaId) { if (availableTimeZoneIds().contains(ianaId)) { - m_nstz = [[NSTimeZone timeZoneWithName:QCFString::toNSString(QString::fromUtf8(ianaId))] retain]; + m_nstz = [[NSTimeZone timeZoneWithName:QString::fromUtf8(ianaId).toNSString()] retain]; if (m_nstz) m_id = ianaId; } @@ -98,7 +98,7 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId) QString QMacTimeZonePrivate::comment() const { - return QCFString::toQString([m_nstz description]); + return QString::fromNSString([m_nstz description]); } QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType, @@ -140,9 +140,9 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType, break; } - NSString *macLocaleCode = QCFString::toNSString(locale.name()); + NSString *macLocaleCode = locale.name().toNSString(); NSLocale *macLocale = [[NSLocale alloc] initWithLocaleIdentifier:macLocaleCode]; - const QString result = QCFString::toQString([m_nstz localizedName:style locale:macLocale]); + const QString result = QString::fromNSString([m_nstz localizedName:style locale:macLocale]); [macLocale release]; return result; } @@ -150,7 +150,7 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType, QString QMacTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const { const NSTimeInterval seconds = atMSecsSinceEpoch / 1000.0; - return QCFString::toQString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]); + return QString::fromNSString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]); } int QMacTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const @@ -191,7 +191,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons data.offsetFromUtc = [m_nstz secondsFromGMTForDate:date]; data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:date]; data.standardTimeOffset = data.offsetFromUtc - data.daylightTimeOffset; - data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]); + data.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:date]); return data; } @@ -220,7 +220,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc tran.offsetFromUtc = [m_nstz secondsFromGMTForDate:nextDate]; tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:nextDate]; tran.standardTimeOffset = tran.offsetFromUtc - tran.daylightTimeOffset; - tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:nextDate]); + tran.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:nextDate]); return tran; } @@ -253,18 +253,18 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const { // Reset the cached system tz then return the name [NSTimeZone resetSystemTimeZone]; - return QCFString::toQString([[NSTimeZone systemTimeZone] name]).toUtf8(); + return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8(); } QList<QByteArray> QMacTimeZonePrivate::availableTimeZoneIds() const { NSEnumerator *enumerator = [[NSTimeZone knownTimeZoneNames] objectEnumerator]; - QByteArray tzid = QCFString::toQString([enumerator nextObject]).toUtf8(); + QByteArray tzid = QString::fromNSString([enumerator nextObject]).toUtf8(); QList<QByteArray> list; while (!tzid.isEmpty()) { list << tzid; - tzid = QCFString::toQString([enumerator nextObject]).toUtf8(); + tzid = QString::fromNSString([enumerator nextObject]).toUtf8(); } std::sort(list.begin(), list.end()); diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index ef1c9c17b0..0ea47b1a1a 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -77,7 +77,7 @@ application must interface with a C API. \note Iterators into a QLinkedList and references into - heap-allocating QLists remain valid long as the referenced items + heap-allocating QLists remain valid as long as the referenced items remain in the container. This is not true for iterators and references into a QVector and non-heap-allocating QLists. diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index e3d89651e4..47b0b2d4be 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -15,8 +15,6 @@ HEADERS += \ tools/qbytedata_p.h \ tools/qcache.h \ tools/qchar.h \ - tools/qcommandlineoption.h \ - tools/qcommandlineparser.h \ tools/qcollator.h \ tools/qcollator_p.h \ tools/qcontainerfwd.h \ @@ -67,9 +65,6 @@ HEADERS += \ tools/qstringmatcher.h \ tools/qtextboundaryfinder.h \ tools/qtimeline.h \ - tools/qtimezone.h \ - tools/qtimezoneprivate_p.h \ - tools/qtimezoneprivate_data_p.h \ tools/qtools_p.h \ tools/qunicodetables_p.h \ tools/qunicodetools_p.h \ @@ -85,8 +80,6 @@ SOURCES += \ tools/qbytearraylist.cpp \ tools/qbytearraymatcher.cpp \ tools/qcollator.cpp \ - tools/qcommandlineoption.cpp \ - tools/qcommandlineparser.cpp \ tools/qcryptographichash.cpp \ tools/qdatetime.cpp \ tools/qdatetimeparser.cpp \ @@ -116,8 +109,6 @@ SOURCES += \ tools/qstringlist.cpp \ tools/qtextboundaryfinder.cpp \ tools/qtimeline.cpp \ - tools/qtimezone.cpp \ - tools/qtimezoneprivate.cpp \ tools/qunicodetools.cpp \ tools/qvector.cpp \ tools/qvsnprintf.cpp \ @@ -128,18 +119,13 @@ msvc: NO_PCH_SOURCES += tools/qvector_msvc.cpp false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator !nacl:mac: { - OBJECTIVE_SOURCES += tools/qlocale_mac.mm \ - tools/qtimezoneprivate_mac.mm \ -} -else:android { - SOURCES += tools/qlocale_unix.cpp tools/qtimezoneprivate_android.cpp + SOURCES += tools/qlocale_mac.mm } else:unix { - SOURCES += tools/qlocale_unix.cpp tools/qtimezoneprivate_tz.cpp + SOURCES += tools/qlocale_unix.cpp } else:win32 { - SOURCES += tools/qlocale_win.cpp \ - tools/qtimezoneprivate_win.cpp + SOURCES += tools/qlocale_win.cpp winphone: LIBS_PRIVATE += -lWindowsPhoneGlobalizationUtil winrt-*-msvc2013: LIBS += advapi32.lib } else:integrity { @@ -157,8 +143,7 @@ qtConfig(icu) { include($$PWD/../../3rdparty/icu_dependency.pri) SOURCES += tools/qlocale_icu.cpp \ - tools/qcollator_icu.cpp \ - tools/qtimezoneprivate_icu.cpp + tools/qcollator_icu.cpp DEFINES += QT_USE_ICU } else: win32 { SOURCES += tools/qcollator_win.cpp @@ -168,6 +153,26 @@ qtConfig(icu) { SOURCES += tools/qcollator_posix.cpp } +qtConfig(timezone) { + HEADERS += \ + tools/qtimezone.h \ + tools/qtimezoneprivate_p.h \ + tools/qtimezoneprivate_data_p.h + SOURCES += \ + tools/qtimezone.cpp \ + tools/qtimezoneprivate.cpp + !nacl:darwin: \ + SOURCES += tools/qtimezoneprivate_mac.mm + else: android: \ + SOURCES += tools/qtimezoneprivate_android.cpp + else: unix: \ + SOURCES += tools/qtimezoneprivate_tz.cpp + else: win32: \ + SOURCES += tools/qtimezoneprivate_win.cpp + qtConfig(icu): \ + SOURCES += tools/qtimezoneprivate_icu.cpp +} + qtConfig(regularexpression) { include($$PWD/../../3rdparty/pcre_dependency.pri) @@ -175,6 +180,15 @@ qtConfig(regularexpression) { SOURCES += tools/qregularexpression.cpp } +qtConfig(commandlineparser) { + HEADERS += \ + tools/qcommandlineoption.h \ + tools/qcommandlineparser.h + SOURCES += \ + tools/qcommandlineoption.cpp \ + tools/qcommandlineparser.cpp +} + INCLUDEPATH += ../3rdparty/harfbuzz/src HEADERS += ../3rdparty/harfbuzz/src/harfbuzz.h SOURCES += ../3rdparty/harfbuzz/src/harfbuzz-buffer.c \ |