From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- python/pykde/sip/kdecore/bytearray.sip | 812 +++++++++++++++++++++++++++++++++ 1 file changed, 812 insertions(+) create mode 100644 python/pykde/sip/kdecore/bytearray.sip (limited to 'python/pykde/sip/kdecore/bytearray.sip') diff --git a/python/pykde/sip/kdecore/bytearray.sip b/python/pykde/sip/kdecore/bytearray.sip new file mode 100644 index 00000000..455f0519 --- /dev/null +++ b/python/pykde/sip/kdecore/bytearray.sip @@ -0,0 +1,812 @@ +// +// Copyright 2004 Jim Bublitz +// Earlier copyrights 1998 - 2003 Jim Bublitz and/or Phil Thompson +// may also apply + +// module kdecore version KDE_3_2_2 + + +// 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. + +%ModuleHeaderCode +#include +#include +%End + + +void dcop_add (QDataStream&, int /Constrained/, const QCString& = "int"); +//void dcop_add (QDataStream&, longlong); +//void dcop_add (QDataStream&, ulonglong); +void dcop_add (QDataStream&, double, const QCString& = "double"); +void dcop_add (QDataStream&, QString); +void dcop_add (QDataStream&, QStringList); +void dcop_add (QDataStream&, QCString); +void dcop_add (QDataStream&, KURL); +void dcop_add (QDataStream&, KURL::List); +void dcop_add (QDataStream&, QSize); +void dcop_add (QDataStream&, QRect); +void dcop_add (QDataStream&, QRegion); +void dcop_add (QDataStream&, QPoint); +void dcop_add (QDataStream&, QFont); +void dcop_add (QDataStream&, QCursor); +void dcop_add (QDataStream&, QPixmap); +void dcop_add (QDataStream&, QColor); +void dcop_add (QDataStream&, QColorGroup); +void dcop_add (QDataStream&, QPalette); +void dcop_add (QDataStream&, QBrush); +void dcop_add (QDataStream&, QWidget::FocusPolicy); +void dcop_add (QDataStream&, DCOPRef); +void dcop_add (QDataStream&, QVariant); +void dcop_add (QDataStream&, QDate); +void dcop_add (QDataStream&, QTime); +void dcop_add (QDataStream&, QDateTime); +void dcop_add (QDataStream&, QImage); +void dcop_add (QDataStream&, QKeySequence); +void dcop_add (QDataStream&, QPen); +void dcop_add (QDataStream&, QPicture); +void dcop_add (QDataStream&, QPointArray); + +void dcop_add (QDataStream&, SIP_PYDICT, QCString); +%MethodCode + int iserr = 0; + if (*a2 == "QMap") + { + QMap *map = (QMap *)sipForceConvertTo_QMap_0200QCString_0200DCOPRef(a1, &iserr); + + if (iserr) + { + sipIsErr = 1; + return 0; + } + *a0 << *map; + } + else if (*a2 == "QMap") + { + QMap *map = (QMap *)sipForceConvertTo_QMap_0200QString_0200DCOPRef(a1, &iserr); + + if (iserr) + { + sipIsErr = 1; + return 0; + } + *a0 << *map; + } +%End + + +void dcop_add (QDataStream&, SIP_PYLIST, QCString); +%MethodCode + int iserr = 0; + if (*a2 == "QValueList") + { + QValueList *list = (QValueList *)sipForceConvertTo_QValueList_0200QCString (a1, &iserr); + + if (iserr) + { + sipIsErr = 1; + return 0; + } + *a0 << *list; + } + else if (*a2 == "QValueList") + { + QValueList *list = (QValueList *)sipForceConvertTo_QValueList_0200DCOPRef (a1, &iserr); + + if (iserr) + { + sipIsErr = 1; + return 0; + } + *a0 << *list; + } +%End + + +void dcop_next (QDataStream&, QCString&); +%MethodCode + if (*a1 == "char") + { + Q_INT8 res; + *a0 >> res; + return PyInt_FromLong ((long)res); + } + else if (*a1 == "bool") + { + bool res; + *a0 >> res; + return PyBool_FromLong ((long)res); + } + else if (*a1 == "int") + { + int res; + *a0 >> res; + return PyInt_FromLong ((long)res); + } + else if (*a1 == "long") + { + long res; + *a0 >> res; + return PyLong_FromLong (res); + } + else if (*a1 == "short") + { + short res; + *a0 >> res; + return PyInt_FromLong ((long)res); + } + if (*a1 == "uchar" || *a1 == "unsigned char") + { + Q_UINT8 res; + *a0 >> res; + return PyInt_FromLong ((long)res); + } + else if (*a1 == "uint" || *a1 == "unsigned int") + { + unsigned int res; + *a0 >> res; + return PyInt_FromLong ((long)res); + } + else if (*a1 == "ulong" || *a1 == "unsigned long") + { + unsigned long res; + *a0 >> res; + return PyLong_FromLong (res); + } + else if (*a1 == "Q_INT32") + { + Q_INT32 res; + *a0 >> res; + return PyLong_FromLong ((long)res); + } + else if (*a1 == "pid_t") + { + pid_t res; + *a0 >> res; + return PyLong_FromLong ((long)res); + } + else if (*a1 == "ushort" || *a1 == "unsigned short") + { + unsigned short res; + *a0 >> res; + return PyInt_FromLong ((long)res); + } + else if (*a1 == "float") + { + float res; + *a0 >> res; + return PyFloat_FromDouble ((double)res); + } + else if (*a1 == "double") + { + double res; + *a0 >> res; + return PyFloat_FromDouble (res); + } + else if (*a1 == "QString") + { + QString res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QString (res),sipClass_QString); + } + else if (*a1 == "QStringList") + { + QStringList res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QStringList (res),sipClass_QStringList); + } + else if (*a1 == "QCString") + { + QCString res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QCString (res),sipClass_QCString); + } + else if (*a1 == "KURL") + { + KURL res; + *a0 >> res; + return sipBuildResult (NULL, "N", new KURL (res),sipClass_KURL); + } + else if (*a1 == "KURL::List") + { + KURL::List res; + *a0 >> res; + return sipBuildResult (NULL, "N", new KURL::List (res),sipClass_KURL_List); + } + else if (*a1 == "QSize") + { + QSize res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QSize (res),sipClass_QSize); + } + else if (*a1 == "QRect") + { + QRect res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QRect (res),sipClass_QRect); + } + else if (*a1 == "QRegion") + { + QRect res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QRegion (res),sipClass_QRegion); + } + else if (*a1 == "QPoint") + { + QPoint res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QPoint (res),sipClass_QPoint); + } + else if (*a1 == "QFont") + { + QFont res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QFont (res),sipClass_QFont); + } + else if (*a1 == "QCursor") + { + QCursor res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QCursor (res),sipClass_QCursor); + } + else if (*a1 == "QPixmap") + { + QPixmap res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QPixmap (res),sipClass_QPixmap); + } + else if (*a1 == "QColor") + { + QColor res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QColor (res),sipClass_QColor); + } + else if (*a1 == "QColorGroup") + { + QColorGroup res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QColorGroup (res),sipClass_QColorGroup); + } + else if (*a1 == "QPalette") + { + QPalette res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QPalette (res),sipClass_QPalette); + } + else if (*a1 == "QBrush") + { + QBrush res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QBrush (res),sipClass_QBrush); + } + else if (*a1 == "FocusPolicy") + { + unsigned int res; + *a0 >> res; + return PyInt_FromLong ((long)res); + } + else if (*a1 == "DCOPRef") + { + DCOPRef res; + *a0 >> res; + return sipBuildResult (NULL, "N", new DCOPRef (res),sipClass_DCOPRef); + } + else if (*a1 == "QVariant") + { + QVariant res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QVariant (res),sipClass_QVariant); + } + else if (*a1 == "QDate") + { + QDate res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QDate (res),sipClass_QDate); + } + else if (*a1 == "QTime") + { + QTime res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QTime (res),sipClass_QTime); + } + else if (*a1 == "QDateTime") + { + QDateTime res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QDateTime (res),sipClass_QDateTime); + } + else if (*a1 == "QImage") + { + QImage res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QImage (res),sipClass_QImage); + } + else if (*a1 == "QKeySequence") + { + QKeySequence res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QKeySequence (res),sipClass_QKeySequence); + } + else if (*a1 == "QPen") + { + QPen res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QPen (res),sipClass_QPen); + } + else if (*a1 == "QPicture") + { + QPicture res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QPicture (res),sipClass_QPicture); + } + else if (*a1 == "QPointArray") + { + QPointArray res; + *a0 >> res; + return sipBuildResult (NULL, "N", new QPointArray (res),sipClass_QPointArray); + } + else if (*a1 == "QMap") + { + QMap res; + *a0 >> res; +// return sipConvertFrom_QMap_0200QCString_0200DCOPRef (&res); + return sipConvertFromMappedType (&res, &sipMappedTypeDef_QMap_0200QCString_0200DCOPRef, NULL); + } + else if (*a1 == "QMap") + { + QMap res; + *a0 >> res; +// return sipConvertFrom_QMap_0200QString_0200DCOPRef (&res); + return sipConvertFromMappedType (&res, &sipMappedTypeDef_QMap_0200QString_0200DCOPRef, NULL); + } + else if (*a1 == "QValueList") + { + QValueList res; + *a0 >> res; +// return sipConvertFrom_QValueList_0200QCString (&res); + return sipConvertFromMappedType (&res, (sipMappedType *) sipFindMappedType ("sipMappedTypeDef_QValueList_0200QCString"), NULL); + } + else if (*a1 == "QValueList" || *a1 == "QCStringList") + { + QValueList res; + *a0 >> res; +// return sipConvertFrom_QValueList_0200DCOPRef (&res); + return sipConvertFromMappedType (&res, &sipMappedTypeDef_QValueList_0200DCOPRef, NULL); + } + +%End + +%ModuleHeaderCode +#include +#include +#include +%End + +%ModuleCode + +void dcop_add (QDataStream& s, int value, const QCString& type_) +{ + if (type_ == "char") + s << (Q_INT8)value; + else if (type_ == "bool") + s << (bool)value; + else if (type_ == "short") + s << (short)value; + else if (type_ == "int") + s << (int)value; + else if (type_ == "long") + s << (long)value; + else if (type_== "uchar" || type_ == "unsigned char") + s << (Q_UINT8)value; + else if (type_ == "ushort" || type_ == "unsigned short") + s << (ushort)value; + else if (type_ == "uint" || type_ == "unsigned int") + s << (uint)value; + else if (type_ == "ulong" || type_ == "unsigned long") + s << (long)value; +} + +/*void dcop_add (QDataStream& s, longlong value) +{ + s << value; +} + +void dcop_add (QDataStream& s, ulonglong value) +{ + s << value; +}*/ + +void dcop_add (QDataStream& s, double value, const QCString& type_) +{ + if (type_ == "double") + s << value; + else if (type_ == "float") + s << (float)value; +} + +void dcop_add (QDataStream& s, QString value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QStringList value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QCString value) +{ + s << value; +} + +void dcop_add (QDataStream& s, KURL value) +{ + s << value; +} + +void dcop_add (QDataStream& s, KURL::List value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QSize value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QRect value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QRegion value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QPoint value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QFont value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QCursor value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QPixmap value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QColor value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QColorGroup value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QPalette value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QBrush value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QWidget::FocusPolicy value) +{ + s << value; +} + +void dcop_add (QDataStream& s, DCOPRef value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QVariant value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QDate value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QTime value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QDateTime value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QImage value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QKeySequence value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QPen value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QPicture value) +{ + s << value; +} + +void dcop_add (QDataStream& s, QPointArray value) +{ + s << value; +} + +%End + + +%MappedType QMap +//converts a Python dict of QCString:DCOPRef +{ +%TypeHeaderCode +#include +#include +#include +//typedef QMap DCOPRefMap; +%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 cppmap = *sipCpp; + QMap::ConstIterator it; + + for (it = cppmap.begin (); it != cppmap.end (); ++it) + { + QCString acpp = it.key (); + DCOPRef bcpp = it.data (); + PyObject *ainst; + PyObject *binst; + if (((ainst = sipBuildResult (NULL, "N", new QCString (acpp), sipClass_QCString)) == NULL) + || ((binst = sipBuildResult (NULL, "N", new DCOPRef (bcpp), sipClass_DCOPRef)) == 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 *cppmap = new QMap; + + PyObject *aelem, *belem; + int pos = 0; + QCString *acpp; + DCOPRef *bcpp; + + while (PyDict_Next(sipPy, &pos, &aelem, &belem)) + { + int iserr = 0; + + if (iserr) + { + *sipIsErr = 1; + delete cppmap; + return 0; + } + acpp = (QCString *)sipForceConvertTo_QCString (aelem, &iserr); + bcpp = (DCOPRef *)sipForceConvertTo_DCOPRef (belem, &iserr); + cppmap->insert (*acpp, *bcpp); + } + + *sipCppPtr = cppmap; + + return 1; +%End +}; + +%MappedType QMap +//converts a Python dict of QString:DCOPRef +{ +%TypeHeaderCode +#include +#include +#include +//typedef QMap DCOPRefMap; +%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 cppmap = *sipCpp; + QMap::ConstIterator it; + + for (it = cppmap.begin (); it != cppmap.end (); ++it) + { + QString acpp = it.key (); + DCOPRef bcpp = it.data (); + PyObject *ainst; + PyObject *binst; + if (((ainst = sipBuildResult (NULL, "N", new QString (acpp), sipClass_QString)) == NULL) + || ((binst = sipBuildResult (NULL, "N", new DCOPRef (bcpp), sipClass_DCOPRef)) == 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 *cppmap = new QMap; + + PyObject *aelem, *belem; + int pos = 0; + QString *acpp; + DCOPRef *bcpp; + + while (PyDict_Next(sipPy, &pos, &aelem, &belem)) + { + int iserr = 0; + + if (iserr) + { + *sipIsErr = 1; + delete cppmap; + return 0; + } + + acpp = (QString *)sipForceConvertTo_QString (aelem, &iserr); + bcpp = (DCOPRef *)sipForceConvertTo_DCOPRef (belem, &iserr); + + cppmap->insert (*acpp, *bcpp); + } + + *sipCppPtr = cppmap; + + return 1; +%End +}; + + +%MappedType QValueList +//converts a Python list of DCOPRef +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + if (!sipCpp) + return PyList_New(0); + + // Create the list + PyObject *pylist; + if ((pylist = PyList_New(0)) == NULL) + return NULL; + + QValueList *cpplist = (QValueList *)sipCpp; + PyObject *inst; + + // Get it. + QValueList::Iterator it; + for( it = cpplist->begin(); it != cpplist->end(); ++it ) + { + if (((inst = sipBuildResult (NULL, "N", new DCOPRef (*it), sipClass_DCOPRef)) == NULL) + || PyList_Append (pylist, inst) < 0) + { + Py_DECREF (pylist); + return NULL; + } + } + + return pylist; +%End + + +%ConvertToTypeCode + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + QValueList *cpplist = new QValueList; + + PyObject *elem; + DCOPRef *cpp; + int iserr = 0; + + for (int i = 0; i < PyList_Size (sipPy); i++) + { + elem = PyList_GET_ITEM (sipPy, i); + cpp = (DCOPRef *)sipForceConvertTo_DCOPRef (elem, &iserr); + if (iserr) + { + *sipIsErr = 1; + delete cpplist; + return 0; + } + + cpplist->append (*cpp); + } + + *sipCppPtr = cpplist; + + return 1; +%End +}; + -- cgit v1.2.1