summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtimezoneprivate_p.h
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-02-07 18:08:39 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-23 01:13:58 +0200
commit8af776d4140c19baccb8e2767ed8b57cc79ccb06 (patch)
tree1bebf823c2f8cd915ace4ee841d1b665481b6b59 /src/corelib/tools/qtimezoneprivate_p.h
parent7ed7d66b5a420f70d056a95a63c9be5de1af3191 (diff)
QTimeZone - Add Windows backend
Add backend implementation for Windows times zones. Change-Id: I30946f6672488c3f1d1d05754e9479aa62cce46f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qtimezoneprivate_p.h')
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index bc28e627a9..b4e4090c0b 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -69,6 +69,10 @@ class NSTimeZone;
#endif // __OBJC__
#endif // Q_OS_MAC
+#ifdef Q_OS_WIN
+#include <qt_windows.h>
+#endif // Q_OS_WIN
+
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QTimeZonePrivate : public QSharedData
@@ -357,6 +361,64 @@ private:
};
#endif // Q_OS_MAC
+#ifdef Q_OS_WIN
+class Q_AUTOTEST_EXPORT QWinTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
+{
+public:
+ struct QWinTransitionRule {
+ int startYear;
+ int standardTimeBias;
+ int daylightTimeBias;
+ SYSTEMTIME standardTimeRule;
+ SYSTEMTIME daylightTimeRule;
+ };
+
+ // Create default time zone
+ QWinTimeZonePrivate();
+ // Create named time zone
+ QWinTimeZonePrivate(const QByteArray &olsenId);
+ QWinTimeZonePrivate(const QWinTimeZonePrivate &other);
+ ~QWinTimeZonePrivate();
+
+ QTimeZonePrivate *clone();
+
+ QString comment() const Q_DECL_OVERRIDE;
+
+ QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
+ const QLocale &locale) const Q_DECL_OVERRIDE;
+ QString abbreviation(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+
+ int offsetFromUtc(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int standardTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int daylightTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+
+ bool hasDaylightTime() const Q_DECL_OVERRIDE;
+ bool isDaylightTime(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+
+ Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+
+ bool hasTransitions() const Q_DECL_OVERRIDE;
+ Data nextTransition(qint64 afterMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ Data previousTransition(qint64 beforeMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+
+ QByteArray systemTimeZoneId() const Q_DECL_OVERRIDE;
+
+ QSet<QByteArray> availableTimeZoneIds() const Q_DECL_OVERRIDE;
+
+private:
+ void init(const QByteArray &olsenId);
+ QWinTransitionRule ruleForYear(int year) const;
+ QTimeZonePrivate::Data ruleToData(const QWinTransitionRule &rule, qint64 atMSecsSinceEpoch,
+ QTimeZone::TimeType type) const;
+
+ QByteArray m_windowsId;
+ QString m_displayName;
+ QString m_standardName;
+ QString m_daylightName;
+ QList<QWinTransitionRule> m_tranRules;
+};
+#endif // Q_OS_WIN
+
QT_END_NAMESPACE
#endif // QTIMEZONEPRIVATE_P_H