diff options
Diffstat (limited to 'python/pykde/sip/kdecore/ktimezones.sip')
-rw-r--r-- | python/pykde/sip/kdecore/ktimezones.sip | 264 |
1 files changed, 264 insertions, 0 deletions
diff --git a/python/pykde/sip/kdecore/ktimezones.sip b/python/pykde/sip/kdecore/ktimezones.sip new file mode 100644 index 00000000..4abb0bad --- /dev/null +++ b/python/pykde/sip/kdecore/ktimezones.sip @@ -0,0 +1,264 @@ +// +// Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com> +// Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson +// may also apply + + +// Generated by preSip +// module kdecore version KDE 3.5.3 + + +// This software is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// This software 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 library; see the file COPYING. +// If not, write to the Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%If ( KDE_3_5_0 - ) + +class KTimezoneSource : KShared +{ +%TypeHeaderCode +#include <ktimezones.h> +%End + + +public: + KTimezoneSource (const QString&); + virtual QString db (); + virtual bool parse (const QString&, KTimezoneDetails&) const; + +}; // class KTimezoneSource + +%End + + +%If ( KDE_3_5_0 - ) + +class KTimezone +{ +%TypeHeaderCode +#include <ktimezones.h> +%End + + +public: + static const float UNKNOWN; + static bool isValidLatitude (float); + static bool isValidLongitude (float); + KTimezone (KSharedPtr<KTimezoneSource>, const QString&, const QString& = QString (), float = KTimezone ::UNKNOWN , float = KTimezone ::UNKNOWN , const QString& = QString ()); + QString name () const; + QString countryCode () const; + float latitude () const; + float longitude () const; + int offset (Qt::TimeSpec = Qt ::UTC ) const; + int offset (const QDateTime&) const; + QDateTime convert (const KTimezone*, const QDateTime&) const; + QString comment () const; + bool parse (KTimezoneDetails&) const; + +private: + KTimezone (const KTimezone&); + +public: +//force + typedef KSharedPtr<KTimezoneSource> TZSourcePtr; +//end + +}; // class KTimezone + +%End + + +%If ( KDE_3_5_0 - ) + +class KTimezoneDetails +{ +%TypeHeaderCode +#include <ktimezones.h> +%End + + +public: + KTimezoneDetails (); + virtual void parseEnded (); + virtual void parseStarted (); + virtual void gotHeader (uint, uint, uint, uint, uint, uint); + virtual void gotTransitionTime (int, uint); + virtual void gotLocalTimeIndex (int, uint); + virtual void gotLocalTime (int, int, bool, uint); + virtual void gotAbbreviation (int, const QString&); + virtual void gotLeapAdjustment (int, uint, uint); + virtual void gotIsStandard (int, bool); + virtual void gotIsUTC (int, bool); + +}; // class KTimezoneDetails + +%End + + +%If ( KDE_3_5_0 - ) + +class KTimezones +{ +%TypeHeaderCode +#include <ktimezones.h> +%End + + +public: + KTimezones (); + const KTimezone* local (); + const KTimezone* zone (const QString&); + typedef QMap<QString,KTimezone*> ZoneMap; + const KTimezones::ZoneMap allZones (); + void add (KTimezone*); + +private: + KTimezones (const KTimezones&); + +}; // class KTimezones + +%End + + + +%If (KDE_3_5_0 - ) +%MappedType KSharedPtr<KTimezoneSource> +//converts KSharedPtr<KTimezoneSource> +{ +%TypeHeaderCode +#include <ksharedptr.h> +#include <ktimezones.h> +#include <sipkdecoreKTimezoneSource.h> +%End + +%ConvertFromTypeCode + // Convert to a Python instance + + if (!sipCpp) + return NULL; + + KSharedPtr<KTimezoneSource> *cPtr = new KSharedPtr<KTimezoneSource> (*(KSharedPtr<KTimezoneSource> *)sipCpp); + KTimezoneSource *cpp = cPtr->data (); + PyObject *obj = sipConvertFromInstance (cpp, sipClass_KTimezoneSource, sipTransferObj); + + return obj; +%End + +%ConvertToTypeCode + // Convert a Python instance to a Ptr on the heap. + + if (sipIsErr == NULL) + return PyInstance_Check(sipPy); + + int iserr = 0; + KTimezoneSource *cpp = (KTimezoneSource *)sipForceConvertTo_KTimezoneSource (sipPy, &iserr); + + if (iserr) + { + *sipIsErr = 1; + return 0; + } + + *sipCppPtr = new KSharedPtr<KTimezoneSource> (cpp); + + return 1; +%End +}; +%End + + +%If (KDE_3_5_0 - ) +%MappedType KTimezones::ZoneMap +//converts a Python dict of QString:KTimezone +{ +%TypeHeaderCode +#include <qmap.h> +#include <qstring.h> +#include <ktimezones.h> +#include <sipqtQString.h> +#include <sipkdecoreKTimezone.h> +%End + +%ConvertFromTypeCode + // Convert to a Python dict + + if (!sipCpp) + return PyDict_New(); + + PyObject *dict; + + // Create the dictionary. + + if ((dict = PyDict_New()) == NULL) + return NULL; + + // Get it. + + const QMap<QString, KTimezone*> cppmap = *sipCpp; + QMap<QString, KTimezone*>::ConstIterator it; + + for (it = cppmap.begin (); it != cppmap.end (); ++it) + { + QString acpp = it.key (); + KTimezone *bcpp = it.data (); + PyObject *ainst; + PyObject *binst; + if (((ainst = sipBuildResult (NULL, "N", new QString (acpp), sipClass_QString)) == NULL) + || ((binst = sipBuildResult (NULL, "N", (KTimezone *) bcpp, sipClass_KTimezone)) == NULL) + || (PyDict_SetItem (dict, ainst, binst) < 0)) + { + Py_XDECREF (ainst); + Py_XDECREF (binst); + Py_DECREF (dict); + return NULL; + } + } + + return dict; +%End + + +%ConvertToTypeCode + // Convert a Python dictionary to a QMap on the heap. + + if (sipIsErr == NULL) + return PyDict_Check(sipPy); + + + QMap<QString, KTimezone*> *cppmap = new QMap<QString, KTimezone*>; + + PyObject *aelem, *belem; + int pos = 0; + QString *acpp; + KTimezone *bcpp; + + while (PyDict_Next(sipPy, &pos, &aelem, &belem)) + { + int iserr = 0; + + acpp = (QString *)sipForceConvertTo_QString (aelem, &iserr); + bcpp = (KTimezone *)sipForceConvertTo_KTimezone (aelem, &iserr); + + cppmap->insert (*acpp, bcpp); + } + + *sipCppPtr = cppmap; + + return 1; +%End +}; +%End + + |