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

kdecore

ktimezones.h
00001 /*
00002    This file is part of the KDE libraries
00003    Copyright (c) 2005 S.R.Haque <srhaque@iee.org>.
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef _KTIMEZONES_H
00021 #define _KTIMEZONES_H
00022 
00023 #include "kdelibs_export.h"
00024 #include <tqdatetime.h>
00025 #include <tqnamespace.h>
00026 #include <tqmap.h>
00027 #include <tqstring.h>
00028 #include <ksharedptr.h>
00029 
00030 class KTimezoneDetails;
00031 class KTimezoneDetailsPrivate;
00032 class KTimezonePrivate;
00033 class KTimezonesPrivate;
00034 
00051 class KDECORE_EXPORT KTimezoneSource :
00052     public KShared
00053 {
00054 public:
00055     KTimezoneSource(const TQString &db);
00056     virtual ~KTimezoneSource();
00057 
00062     virtual TQString db();
00063 
00069     virtual bool parse(const TQString &zone, KTimezoneDetails &dataReceiver) const;
00070 
00071 private:
00072     TQString m_db;
00073 };
00074 
00085 class KDECORE_EXPORT KTimezone
00086 {
00087 public:
00092     static const float UNKNOWN;
00093 
00098     static bool isValidLatitude(float latitude);
00099 
00104     static bool isValidLongitude(float longitude);
00105 
00116     KTimezone(
00117         KSharedPtr<KTimezoneSource> db, const TQString &name,
00118         const TQString &countryCode = TQString(), float latitude = UNKNOWN, float longitude = UNKNOWN,
00119         const TQString &comment = TQString());
00120     ~KTimezone();
00121 
00127     TQString name() const;
00128 
00134     TQString countryCode() const;
00135 
00141     float latitude() const;
00142 
00148     float longitude() const;
00149 
00159     int offset(Qt::TimeSpec basisSpec = Qt::UTC) const;
00160 
00167     int offset(const TQDateTime &dateTime) const;
00168 
00175     TQDateTime convert(const KTimezone *newZone, const TQDateTime &dateTime) const;
00176 
00182     TQString comment() const;
00183 
00188     bool parse(KTimezoneDetails &dataReceiver) const;
00189 
00190 private:
00191     KTimezone(const KTimezone&);
00192     KTimezone& operator=(const KTimezone&);
00193 
00194     KSharedPtr<KTimezoneSource> m_db;
00195     TQString m_name;
00196     TQString m_countryCode;
00197     float m_latitude;
00198     float m_longitude;
00199     TQString m_comment;
00200     KTimezonePrivate *d;
00201 };
00202 
00225 class KDECORE_EXPORT KTimezoneDetails
00226 {
00227 public:
00228     KTimezoneDetails();
00229     virtual ~KTimezoneDetails();
00230 
00234     virtual void parseEnded();
00235 
00239     virtual void parseStarted();
00240 
00244     virtual void gotHeader(
00245         unsigned ttIsGmtCnt, unsigned ttIsStdCnt, unsigned leapCnt,
00246         unsigned timeCnt, unsigned typeCnt, unsigned charCnt);
00247 
00251     virtual void gotTransitionTime(int index, unsigned transitionTime);
00252 
00256     virtual void gotLocalTimeIndex(int index, unsigned localTimeIndex);
00257 
00261     virtual void gotLocalTime(int index, int gmtOff, bool isDst, unsigned abbrIndex);
00262 
00268     virtual void gotAbbreviation(int index, const TQString &abbr);
00269 
00273     virtual void gotLeapAdjustment(int index, unsigned leapTime, unsigned leapSeconds);
00274 
00278     virtual void gotIsStandard(int index, bool isStandard);
00279 
00283     virtual void gotIsUTC(int index, bool isUTC);
00284 
00285 private:
00286     KTimezoneDetailsPrivate *d;
00287 };
00288 
00296 class KDECORE_EXPORT KTimezones
00297 {
00298 public:
00299     KTimezones();
00300     ~KTimezones();
00301 
00316     const KTimezone *local();
00317 
00324     const KTimezone *zone(const TQString &name);
00325 
00326     typedef TQMap<TQString, KTimezone *> ZoneMap;
00327 
00332     const ZoneMap allZones();
00333 
00337     void add(KTimezone *zone);
00338 
00339 private:
00340     KTimezones(const KTimezones&);
00341     KTimezones& operator=(const KTimezones&);
00342 
00343     float convertCoordinate(const TQString &coordinate);
00344 
00345     TQString m_zoneinfoDir;
00346     ZoneMap *m_zones;
00347     KTimezone *m_UTC;
00348     KTimezonesPrivate *d;
00349 };
00350 
00351 #endif

kdecore

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

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |