You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pytde/sip/tdecore/ktimezones.sip

273 lines
6.6 KiB

//
// Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com>
// Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson
// may also apply
// Generated by preSip
// module tdecore 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.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%If ( KDE_3_5_0 - )
class KTimezoneSource : TDEShared
{
%TypeHeaderCode
#include <ktimezones.h>
%End
public:
KTimezoneSource (const TQString&);
virtual TQString db ();
virtual bool parse (const TQString&, 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 (TDESharedPtr<KTimezoneSource>, const TQString&, const TQString& = TQString (), float = KTimezone ::UNKNOWN , float = KTimezone ::UNKNOWN , const TQString& = TQString ());
TQString name () const;
TQString countryCode () const;
float latitude () const;
float longitude () const;
int offset (TQt::TimeSpec = TQt ::UTC ) const;
int offset (const TQDateTime&) const;
TQDateTime convert (const KTimezone*, const TQDateTime&) const;
TQString comment () const;
bool parse (KTimezoneDetails&) const;
private:
KTimezone (const KTimezone&);
public:
//force
typedef TDESharedPtr<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 TQString&);
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 TQString&);
typedef TQMap<TQString,KTimezone*> ZoneMap;
const KTimezones::ZoneMap allZones ();
void add (KTimezone*);
private:
KTimezones (const KTimezones&);
}; // class KTimezones
%End
%If (KDE_3_5_0 - )
%MappedType TDESharedPtr<KTimezoneSource>
//converts TDESharedPtr<KTimezoneSource>
{
%TypeHeaderCode
#include <ksharedptr.h>
#include <ktimezones.h>
%End
%ConvertFromTypeCode
// Convert to a Python instance
if (!sipCpp)
return NULL;
TDESharedPtr<KTimezoneSource> *cPtr = new TDESharedPtr<KTimezoneSource> (*(TDESharedPtr<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 PyType_Check(sipPy);
int iserr = 0;
KTimezoneSource *cpp = (KTimezoneSource *)sipForceConvertToType(sipPy, sipType_KTimezoneSource, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr);
if (iserr)
{
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new TDESharedPtr<KTimezoneSource> (cpp);
return 1;
%End
};
%End
%If (KDE_3_5_0 - )
%MappedType KTimezones::ZoneMap
//converts a Python dict of TQString:KTimezone
{
%TypeHeaderCode
#include <tqmap.h>
#include <tqstring.h>
#include <ktimezones.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 TQMap<TQString, KTimezone*> cppmap = *sipCpp;
TQMap<TQString, KTimezone*>::ConstIterator it;
for (it = cppmap.begin (); it != cppmap.end (); ++it)
{
TQString acpp = it.key ();
KTimezone *bcpp = it.data ();
PyObject *ainst;
PyObject *binst = NULL;
if (((ainst = sipConvertFromNewType(new TQString(acpp), sipType_TQString, sipTransferObj)) == NULL)
|| ((binst = sipConvertFromType(bcpp, sipType_KTimezone, sipTransferObj)) == 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 TQMap on the heap.
if (sipIsErr == NULL)
return PyDict_Check(sipPy);
TQMap<TQString, KTimezone*> *cppmap = new TQMap<TQString, KTimezone*>;
PyObject *aelem, *belem;
SIP_SSIZE_T pos = 0;
TQString *acpp;
KTimezone *bcpp;
while (PyDict_Next(sipPy, &pos, &aelem, &belem))
{
int iserr = 0, acpp_state;
acpp = (TQString *)sipForceConvertToType(aelem, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &acpp_state, &iserr);
bcpp = (KTimezone *)sipForceConvertToType(belem, sipType_KTimezone, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr);
if (iserr)
{
if (acpp)
sipReleaseType(acpp, sipType_TQString, acpp_state);
*sipIsErr = 1;
delete cppmap;
return 0;
}
cppmap->insert (*acpp, bcpp);
sipReleaseType(acpp, sipType_TQString, acpp_state);
}
*sipCppPtr = cppmap;
return 1;
%End
};
%End