//
//     Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2007 Jim Bublitz also apply

//                 Generated by twine

// This file is part of PyKDE4.

// PyKDE4 is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.

// PyKDE4 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.


class KTimeZones
{
%TypeHeaderCode
#include <ktimezone.h>
%End


public:
                            KTimeZones ();
    KTimeZone               zone (const QString& name) const;
    typedef QMap<QString,KTimeZone> ZoneMap;

    const KTimeZones::ZoneMap  zones () const;
    bool                    add (const KTimeZone& zone);
    KTimeZone               remove (const KTimeZone& zone);
    KTimeZone               remove (const QString& name);
    void                    clear ();

private:
                            KTimeZones (const KTimeZones&);
};   // KTimeZones


class KTimeZone
{
%TypeHeaderCode
#include <ktimezone.h>
%End


public:

    class Phase
    {

    public:
                                Phase ();
                                Phase (int utcOffset, const QByteArray& abbreviations, bool dst, const QString& comment = QString());
                                Phase (int utcOffset, const QList<QByteArray>& abbreviations, bool dst, const QString& comment = QString());
                                Phase (const KTimeZone::Phase& rhs);
        bool                    operator == (const KTimeZone::Phase& rhs) const;
        bool                    operator != (const KTimeZone::Phase& rhs) const;
        int                     utcOffset () const;
        QList<QByteArray>       abbreviations () const;
        bool                    isDst () const;
        QString                 comment () const;
    };   // Phase


public:

    class Transition
    {

    public:
                                Transition ();
                                Transition (const QDateTime& dt, const KTimeZone::Phase& phase);
                                Transition (const KTimeZone::Transition& t);
        QDateTime               time () const;
        KTimeZone::Phase        phase () const;
        bool                    operator < (const KTimeZone::Transition& rhs) const;
    };   // Transition


public:

    class LeapSeconds
    {

    public:
                                LeapSeconds ();
                                LeapSeconds (const QDateTime& utcTime, int leapSeconds, const QString& comment = QString());
                                LeapSeconds (const KTimeZone::LeapSeconds& c);
        bool                    operator < (const KTimeZone::LeapSeconds& c) const;
        bool                    isValid () const;
        QDateTime               dateTime () const;
        int                     leapSeconds () const;
        QString                 comment () const;
    };   // LeapSeconds


public:
//ig                        KTimeZone ();
    explicit                KTimeZone (const QString& name);
                            KTimeZone (const KTimeZone& tz);
    bool                    operator == (const KTimeZone& rhs) const;
    bool                    operator != (const KTimeZone& rhs) const;
    QByteArray              type () const;
    bool                    isValid () const;
    QString                 name () const;
    QString                 countryCode () const;
    float                   latitude () const;
    float                   longitude () const;
    QString                 comment () const;
    QList<QByteArray>       abbreviations () const;
    QByteArray              abbreviation (const QDateTime& utcDateTime) const;
    QList<int>              utcOffsets () const;
    QDateTime               convert (const KTimeZone& newZone, const QDateTime& zoneDateTime) const;
    QDateTime               toUtc (const QDateTime& zoneDateTime) const;
    QDateTime               toZoneTime (const QDateTime& utcDateTime, bool* secondOccurrence /Out/ = 0) const;
    int                     currentOffset (Qt::TimeSpec basis = Qt::UTC) const;
    virtual int             offsetAtZoneTime (const QDateTime& zoneDateTime, int* secondOffset /Out/ = 0) const;
    virtual int             offsetAtUtc (const QDateTime& utcDateTime) const;
    virtual int             offset (time_t t) const;
    virtual bool            isDstAtUtc (const QDateTime& utcDateTime) const;
    virtual bool            isDst (time_t t) const;
    QList<KTimeZone::Phase>  phases () const;
    virtual bool            hasTransitions () const;
    QList<KTimeZone::Transition>  transitions (const QDateTime& start = QDateTime(), const QDateTime& end = QDateTime()) const;
//ig     const KTimeZone::Transition*  transition (const QDateTime& dt, const KTimeZone::Transition** secondTransition = 0, bool* validTime = 0) const;
    int                     transitionIndex (const QDateTime& dt, int* secondIndex /Out/ = 0, bool* validTime /Out/ = 0) const;
    QList<QDateTime>        transitionTimes (const KTimeZone::Phase& phase, const QDateTime& start = QDateTime(), const QDateTime& end = QDateTime()) const;
    QList<KTimeZone::LeapSeconds>  leapSecondChanges () const;
    KTimeZoneSource*        source () const;
    bool                    parse () const;
    const KTimeZoneData*    data (bool create = 0) const;
    bool                    updateBase (const KTimeZone& other);
    static QDateTime        fromTime_t (time_t t);
    static time_t           toTime_t (const QDateTime& utcDateTime);
    static KTimeZone        utc ();
//ig    const int InvalidOffset;
//ig    const time_t InvalidTime_t;
//ig    const float UNKNOWN;

protected:
                            KTimeZone (KTimeZoneBackend* impl);
    void                    setData (KTimeZoneData* data, KTimeZoneSource* source = 0);

//force

public:
    static const int InvalidOffset;
    static const time_t InvalidTime_t;
    static const float UNKNOWN;
//end

};   // KTimeZone


class KTimeZoneBackend
{
%TypeHeaderCode
#include <ktimezone.h>
%End


public:
                            KTimeZoneBackend ();
    explicit                KTimeZoneBackend (const QString& name);
                            KTimeZoneBackend (const KTimeZoneBackend& other);
    virtual KTimeZoneBackend*  clone () const;
    virtual QByteArray      type () const;
    virtual int             offsetAtZoneTime (const KTimeZone* caller, const QDateTime& zoneDateTime, int* secondOffset /Out/) const;
    virtual int             offsetAtUtc (const KTimeZone* caller, const QDateTime& utcDateTime) const;
    virtual int             offset (const KTimeZone* caller, time_t t) const;
    virtual bool            isDstAtUtc (const KTimeZone* caller, const QDateTime& utcDateTime) const;
    virtual bool            isDst (const KTimeZone* caller, time_t t) const;
    virtual bool            hasTransitions (const KTimeZone* caller) const;

protected:
                            KTimeZoneBackend (KTimeZoneSource* source, const QString& name, const QString& countryCode = QString(), float latitude = KTimeZone::UNKNOWN, float longitude = KTimeZone::UNKNOWN, const QString& comment = QString());
};   // KTimeZoneBackend


class KTimeZoneSource
{
%TypeHeaderCode
#include <ktimezone.h>
%End


public:
                            KTimeZoneSource ();
    virtual KTimeZoneData*  parse (const KTimeZone& zone) const;
    bool                    useZoneParse () const;

protected:
    explicit                KTimeZoneSource (bool useZoneParse);
private:
                            KTimeZoneSource (const KTimeZoneSource &other);

};   // KTimeZoneSource


class KTimeZoneData
{
%TypeHeaderCode
#include <ktimezone.h>
%End


public:
                            KTimeZoneData ();
                            KTimeZoneData (const KTimeZoneData& c);
    virtual KTimeZoneData*  clone () const;
    virtual QList<QByteArray>  abbreviations () const;
    virtual QByteArray      abbreviation (const QDateTime& utcDateTime) const;
    virtual QList<int>      utcOffsets () const;
    int                     previousUtcOffset () const;
    QList<KTimeZone::Phase>  phases () const;
    virtual bool            hasTransitions () const;
    QList<KTimeZone::Transition>  transitions (const QDateTime& start = QDateTime(), const QDateTime& end = QDateTime()) const;
//ig     const KTimeZone::Transition*  transition (const QDateTime& dt, const KTimeZone::Transition** secondTransition = 0, bool* validTime = 0) const;
    int                     transitionIndex (const QDateTime& dt, int* secondIndex /Out/ = 0, bool* validTime /Out/ = 0) const;
    QList<QDateTime>        transitionTimes (const KTimeZone::Phase& phase, const QDateTime& start = QDateTime(), const QDateTime& end = QDateTime()) const;
    QList<KTimeZone::LeapSeconds>  leapSecondChanges () const;
    KTimeZone::LeapSeconds  leapSecondChange (const QDateTime& utc) const;

protected:
    void                    setPhases (const QList<KTimeZone::Phase>& phases, int previousUtcOffset);
    void                    setTransitions (const QList<KTimeZone::Transition>& transitions);
    void                    setLeapSecondChanges (const QList<KTimeZone::LeapSeconds>& adjusts);
};   // KTimeZoneData


