• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • date
ksystemtimezone.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3  Copyright (c) 2005-2007,2009-2012 David Jarvie <djarvie@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
27 #ifndef _KSYSTEMTIMEZONE_H
28 #define _KSYSTEMTIMEZONE_H
29 
30 #include <kdecore_export.h>
31 #include "ktimezone.h"
32 
33 #include <QtCore/QObject>
34 #include <QtCore/QDateTime>
35 #include <QtCore/QList>
36 #include <QtCore/QString>
37 #include <QtCore/QByteArray>
38 
39 class KSystemTimeZoneSource;
40 class KSystemTimeZonePrivate;
41 class KSystemTimeZonesPrivate;
42 class KSystemTimeZoneSourcePrivate;
43 class KSystemTimeZoneDataPrivate;
44 
94 class KDECORE_EXPORT KSystemTimeZones : public QObject
95 {
96  Q_OBJECT
97 public:
98  ~KSystemTimeZones();
99 
106  static KTimeZones *timeZones();
107 
113  static const KTimeZones::ZoneMap zones();
114 
126  static KTimeZone zone(const QString &name);
127 
138  static KTimeZone readZone(const QString &name);
139 
167  static KTimeZone local();
168 
187  static KTimeZone realLocalZone();
188 
208  static void setLocalZone(const KTimeZone& tz);
209 
230  static bool isSimulated();
231 
237  static QString zoneinfoDir();
238 
245  static bool isTimeZoneDaemonAvailable();
246 
247 private Q_SLOTS:
248  // Connected to D-Bus signals
249  void configChanged();
250  void zonetabChanged(const QString &zonetab);
251  void zoneDefinitionChanged(const QString &zone);
252 
253 private:
254  KSystemTimeZones();
255 
256  KSystemTimeZonesPrivate * const d;
257  friend class KSystemTimeZonesPrivate;
258 };
259 
282 class KDECORE_EXPORT KSystemTimeZone : public KTimeZone //krazy:exclude=dpointer (no d-pointer for KTimeZone derived classes)
283 {
284 public:
285 
296  KSystemTimeZone(KSystemTimeZoneSource *source, const QString &name,
297  const QString &countryCode = QString(), float latitude = UNKNOWN, float longitude = UNKNOWN,
298  const QString &comment = QString());
299 
300  ~KSystemTimeZone();
301 
302 private:
303  // d-pointer is in KSystemTimeZoneBackend.
304  // This is a requirement for classes inherited from KTimeZone.
305 };
306 
307 
321 class KDECORE_EXPORT KSystemTimeZoneBackend : public KTimeZoneBackend //krazy:exclude=dpointer (non-const d-pointer for KTimeZoneBackend-derived classes)
322 {
323 public:
325  KSystemTimeZoneBackend(KSystemTimeZoneSource *source, const QString &name,
326  const QString &countryCode, float latitude, float longitude, const QString &comment);
327 
328  ~KSystemTimeZoneBackend();
329 
335  virtual KTimeZoneBackend *clone() const;
336 
342  virtual QByteArray type() const;
343 
364  virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const;
365 
382  virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
383 
397  virtual int offset(const KTimeZone *caller, time_t t) const;
398 
412  virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
413 
424  virtual bool isDst(const KTimeZone *caller, time_t t) const;
425 
426 private:
427  KSystemTimeZonePrivate *d; // non-const
428 };
429 
430 
441 class KDECORE_EXPORT KSystemTimeZoneSource : public KTimeZoneSource
442 {
443 public:
447  KSystemTimeZoneSource();
448  virtual ~KSystemTimeZoneSource();
449 
459  virtual KTimeZoneData *parse(const KTimeZone &zone) const;
460 
471  static void startParseBlock();
472 
476  static void endParseBlock();
477 
478 private:
479  KSystemTimeZoneSourcePrivate * const d;
480 };
481 
482 
492 class KSystemTimeZoneData : public KTimeZoneData
493 {
494  friend class KSystemTimeZoneSource;
495 
496 public:
497  KSystemTimeZoneData();
499  KSystemTimeZoneData(const KSystemTimeZoneData &);
500  virtual ~KSystemTimeZoneData();
501 
503  KSystemTimeZoneData &operator=(const KSystemTimeZoneData &);
504 
513  virtual KTimeZoneData *clone() const;
514 
520  virtual QList<QByteArray> abbreviations() const;
521  virtual QByteArray abbreviation(const QDateTime &utcDateTime) const;
522 
530  virtual QList<int> utcOffsets() const;
531 
532 private:
533  KSystemTimeZoneDataPrivate * const d;
534 };
535 
536 #endif
KSystemTimeZoneData::~KSystemTimeZoneData
virtual ~KSystemTimeZoneData()
Definition: ksystemtimezone.cpp:830
KSystemTimeZoneData::abbreviation
virtual QByteArray abbreviation(const QDateTime &utcDateTime) const
Returns the time zone abbreviation current at a specified time.
Definition: ksystemtimezone.cpp:852
KTimeZoneBackend::type
virtual QByteArray type() const
Returns the class name of the data represented by this instance.
Definition: ktimezone.cpp:457
kdecore_export.h
QByteArray
KTimeZoneData
Base class for the parsed data returned by a KTimeZoneSource class.
Definition: ktimezone.h:1302
KTimeZoneBackend::offsetAtZoneTime
virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const
Implements KTimeZone::offsetAtZoneTime().
Definition: ktimezone.cpp:467
QMap
KSystemTimeZoneData::clone
virtual KTimeZoneData * clone() const
Creates a new copy of this object.
Definition: ksystemtimezone.cpp:842
KTimeZoneSource::parse
virtual KTimeZoneData * parse(const KTimeZone &zone) const
Extracts detail information for one time zone from the source database.
Definition: ktimezone.cpp:976
KTimeZones
The KTimeZones class represents a time zone database which consists of a collection of individual tim...
Definition: ktimezone.h:308
KSystemTimeZone
The KSystemTimeZone class represents a time zone in the system database.
Definition: ksystemtimezone.h:282
KSystemTimeZoneData::operator=
KSystemTimeZoneData & operator=(const KSystemTimeZoneData &)
Assignment; no special ownership assumed.
Definition: ksystemtimezone.cpp:835
QObject
KSystemTimeZoneBackend
Backend class for KSystemTimeZone class.
Definition: ksystemtimezone.h:321
KTimeZoneBackend::clone
virtual KTimeZoneBackend * clone() const
Creates a copy of this instance.
Definition: ktimezone.cpp:462
KSystemTimeZoneData::utcOffsets
virtual QList< int > utcOffsets() const
Returns the complete list of UTC offsets for the time zone.
Definition: ksystemtimezone.cpp:888
KTimeZoneBackend::isDst
virtual bool isDst(const KTimeZone *caller, time_t t) const
Implements KTimeZone::isDst().
Definition: ktimezone.cpp:577
ktimezone.h
Time zone functions.
KSystemTimeZoneData::abbreviations
virtual QList< QByteArray > abbreviations() const
Returns the complete list of time zone abbreviations.
Definition: ksystemtimezone.cpp:847
QString
QList< QByteArray >
KSystemTimeZoneSource
A class to read and parse system time zone data.
Definition: ksystemtimezone.h:441
KTimeZone
Base class representing a time zone.
Definition: ktimezone.h:416
KSystemTimeZoneData::KSystemTimeZoneData
KSystemTimeZoneData()
Definition: ksystemtimezone.cpp:819
KTimeZoneBackend::offsetAtUtc
virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const
Implements KTimeZone::offsetAtUtc().
Definition: ktimezone.cpp:530
KTimeZoneBackend::offset
virtual int offset(const KTimeZone *caller, time_t t) const
Implements KTimeZone::offset().
Definition: ktimezone.cpp:562
KTimeZoneSource
Base class representing a source of time zone information.
Definition: ktimezone.h:1230
KTimeZoneBackend::isDstAtUtc
virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const
Implements KTimeZone::isDstAtUtc().
Definition: ktimezone.cpp:567
KSystemTimeZoneData
Parsed system time zone data.
Definition: ksystemtimezone.h:492
KSystemTimeZones
The KSystemTimeZones class represents the system time zone database, consisting of a collection of in...
Definition: ksystemtimezone.h:94
QDateTime
KTimeZoneBackend
Base backend class for KTimeZone classes.
Definition: ktimezone.h:1120
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal