KDECore
ksystemtimezone.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #ifndef _KSYSTEMTIMEZONE_H
00028 #define _KSYSTEMTIMEZONE_H
00029
00030 #include <kdecore_export.h>
00031 #include "ktimezone.h"
00032
00033 #include <QtCore/QObject>
00034 #include <QtCore/QDateTime>
00035 #include <QtCore/QList>
00036 #include <QtCore/QString>
00037 #include <QtCore/QByteArray>
00038
00039 class KSystemTimeZoneSource;
00040 class KSystemTimeZonePrivate;
00041 class KSystemTimeZonesPrivate;
00042 class KSystemTimeZoneSourcePrivate;
00043 class KSystemTimeZoneDataPrivate;
00044
00082 class KDECORE_EXPORT KSystemTimeZones : public QObject
00083 {
00084 Q_OBJECT
00085 public:
00086 ~KSystemTimeZones();
00087
00094 static KTimeZones *timeZones();
00095
00101 static const KTimeZones::ZoneMap zones();
00102
00114 static KTimeZone zone(const QString &name);
00115
00126 static KTimeZone readZone(const QString &name);
00127
00150 static KTimeZone local();
00151
00157 static QString zoneinfoDir();
00158
00159 private Q_SLOTS:
00160
00161 void configChanged();
00162 void zonetabChanged(const QString &zonetab);
00163 void zoneDefinitionChanged(const QString &zone);
00164
00165 private:
00166 KSystemTimeZones();
00167
00168 KSystemTimeZonesPrivate * const d;
00169 friend class KSystemTimeZonesPrivate;
00170 };
00171
00194 class KDECORE_EXPORT KSystemTimeZone : public KTimeZone
00195 {
00196 public:
00197
00208 KSystemTimeZone(KSystemTimeZoneSource *source, const QString &name,
00209 const QString &countryCode = QString(), float latitude = UNKNOWN, float longitude = UNKNOWN,
00210 const QString &comment = QString());
00211
00212 ~KSystemTimeZone();
00213
00214 private:
00215
00216
00217 };
00218
00219
00233 class KDECORE_EXPORT KSystemTimeZoneBackend : public KTimeZoneBackend
00234 {
00235 public:
00237 KSystemTimeZoneBackend(KSystemTimeZoneSource *source, const QString &name,
00238 const QString &countryCode, float latitude, float longitude, const QString &comment);
00239
00240 ~KSystemTimeZoneBackend();
00241
00247 virtual KTimeZoneBackend *clone() const;
00248
00254 virtual QByteArray type() const;
00255
00276 virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const;
00277
00294 virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
00295
00309 virtual int offset(const KTimeZone *caller, time_t t) const;
00310
00324 virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
00325
00336 virtual bool isDst(const KTimeZone *caller, time_t t) const;
00337
00338 private:
00339 KSystemTimeZonePrivate *d;
00340 };
00341
00342
00353 class KDECORE_EXPORT KSystemTimeZoneSource : public KTimeZoneSource
00354 {
00355 public:
00359 KSystemTimeZoneSource();
00360 virtual ~KSystemTimeZoneSource();
00361
00371 virtual KTimeZoneData *parse(const KTimeZone &zone) const;
00372
00383 static void startParseBlock();
00384
00388 static void endParseBlock();
00389
00390 private:
00391 KSystemTimeZoneSourcePrivate * const d;
00392 };
00393
00394
00404 class KSystemTimeZoneData : public KTimeZoneData
00405 {
00406 friend class KSystemTimeZoneSource;
00407
00408 public:
00409 KSystemTimeZoneData();
00411 KSystemTimeZoneData(const KSystemTimeZoneData &);
00412 virtual ~KSystemTimeZoneData();
00413
00415 KSystemTimeZoneData &operator=(const KSystemTimeZoneData &);
00416
00425 virtual KTimeZoneData *clone() const;
00426
00432 virtual QList<QByteArray> abbreviations() const;
00433 virtual QByteArray abbreviation(const QDateTime &utcDateTime) const;
00434
00442 virtual QList<int> utcOffsets() const;
00443
00444 private:
00445 KSystemTimeZoneDataPrivate * const d;
00446 };
00447
00448 #endif