• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
ktimezones.h
1 /*
2  This file is part of the KDE libraries
3  Copyright (c) 2005 S.R.Haque <srhaque@iee.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 version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef _KTIMEZONES_H
21 #define _KTIMEZONES_H
22 
23 #include "tdelibs_export.h"
24 #include <tqdatetime.h>
25 #include <tqnamespace.h>
26 #include <tqmap.h>
27 #include <tqstring.h>
28 #include <ksharedptr.h>
29 
30 class KTimezoneDetails;
31 class KTimezoneDetailsPrivate;
32 class KTimezonePrivate;
33 class KTimezonesPrivate;
34 
51 class TDECORE_EXPORT KTimezoneSource :
52  public TDEShared
53 {
54 public:
55  KTimezoneSource(const TQString &db);
56  virtual ~KTimezoneSource();
57 
62  virtual TQString db();
63 
69  virtual bool parse(const TQString &zone, KTimezoneDetails &dataReceiver) const;
70 
71 private:
72  TQString m_db;
73 };
74 
85 class TDECORE_EXPORT KTimezone
86 {
87 public:
92  static const float UNKNOWN;
93 
98  static bool isValidLatitude(float latitude);
99 
104  static bool isValidLongitude(float longitude);
105 
116  KTimezone(
117  TDESharedPtr<KTimezoneSource> db, const TQString &name,
118  const TQString &countryCode = TQString(), float latitude = UNKNOWN, float longitude = UNKNOWN,
119  const TQString &comment = TQString());
120  ~KTimezone();
121 
127  TQString name() const;
128 
134  TQString countryCode() const;
135 
141  float latitude() const;
142 
148  float longitude() const;
149 
159  int offset(TQt::TimeSpec basisSpec = TQt::UTC) const;
160 
167  int offset(const TQDateTime &dateTime) const;
168 
175  TQDateTime convert(const KTimezone *newZone, const TQDateTime &dateTime) const;
176 
182  TQString comment() const;
183 
188  bool parse(KTimezoneDetails &dataReceiver) const;
189 
190 private:
191  KTimezone(const KTimezone&);
192  KTimezone& operator=(const KTimezone&);
193 
194  TDESharedPtr<KTimezoneSource> m_db;
195  TQString m_name;
196  TQString m_countryCode;
197  float m_latitude;
198  float m_longitude;
199  TQString m_comment;
200  KTimezonePrivate *d;
201 };
202 
225 class TDECORE_EXPORT KTimezoneDetails
226 {
227 public:
228  KTimezoneDetails();
229  virtual ~KTimezoneDetails();
230 
234  virtual void parseEnded();
235 
239  virtual void parseStarted();
240 
244  virtual void gotHeader(
245  unsigned ttIsGmtCnt, unsigned ttIsStdCnt, unsigned leapCnt,
246  unsigned timeCnt, unsigned typeCnt, unsigned charCnt);
247 
251  virtual void gotTransitionTime(int index, unsigned transitionTime);
252 
256  virtual void gotLocalTimeIndex(int index, unsigned localTimeIndex);
257 
261  virtual void gotLocalTime(int index, int gmtOff, bool isDst, unsigned abbrIndex);
262 
268  virtual void gotAbbreviation(int index, const TQString &abbr);
269 
273  virtual void gotLeapAdjustment(int index, unsigned leapTime, unsigned leapSeconds);
274 
278  virtual void gotIsStandard(int index, bool isStandard);
279 
283  virtual void gotIsUTC(int index, bool isUTC);
284 
285 private:
286  KTimezoneDetailsPrivate *d;
287 };
288 
296 class TDECORE_EXPORT KTimezones
297 {
298 public:
299  KTimezones();
300  ~KTimezones();
301 
316  const KTimezone *local();
317 
324  const KTimezone *zone(const TQString &name);
325 
326  typedef TQMap<TQString, KTimezone *> ZoneMap;
327 
332  const ZoneMap allZones();
333 
337  void add(KTimezone *zone);
338 
339 private:
340  KTimezones(const KTimezones&);
341  KTimezones& operator=(const KTimezones&);
342 
343  float convertCoordinate(const TQString &coordinate);
344 
345  TQString m_zoneinfoDir;
346  ZoneMap *m_zones;
347  KTimezone *m_UTC;
348  KTimezonesPrivate *d;
349 };
350 
351 #endif
KTimezoneDetails
The KTimezoneDetails class contains extended functions related to a timezone.
Definition: ktimezones.h:226
KTimezoneSource
The KTimezoneSource class contains information source-dependent functions related to a timezone.
Definition: ktimezones.h:53
KTimezone
The KTimezone class contains core functions related to a timezone.
Definition: ktimezones.h:86
KTimezone::UNKNOWN
static const float UNKNOWN
A representation for unknown locations; this is a float that does not represent a real latitude or lo...
Definition: ktimezones.h:92
KTimezones
The KTimezones class models a timezone database.
Definition: ktimezones.h:297
TDESharedPtr< KTimezoneSource >
TDEShared
Reference counting for shared objects.
Definition: ksharedptr.h:40
TDEShared::operator=
TDEShared & operator=(const TDEShared &)
Overloaded assignment operator.
Definition: ksharedptr.h:57

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.