diff options
Diffstat (limited to 'python/pykde/sip/kdecore/kmacroexpander.sip')
-rw-r--r-- | python/pykde/sip/kdecore/kmacroexpander.sip | 364 |
1 files changed, 364 insertions, 0 deletions
diff --git a/python/pykde/sip/kdecore/kmacroexpander.sip b/python/pykde/sip/kdecore/kmacroexpander.sip new file mode 100644 index 00000000..c5dcefd3 --- /dev/null +++ b/python/pykde/sip/kdecore/kmacroexpander.sip @@ -0,0 +1,364 @@ +// +// 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. + +%ModuleHeaderCode +#include <kmacroexpander.h> +%End + + +%If ( KDE_3_2_0 - ) + +class KMacroExpanderBase +{ +%TypeHeaderCode +#include <kmacroexpander.h> +%End + + +public: + KMacroExpanderBase (QChar = '%'); + void expandMacros (QString&); + bool expandMacrosShellQuote (QString&, uint& /In, Out/); + bool expandMacrosShellQuote (QString&); + void setEscapeChar (QChar); + QChar escapeChar () const; + +protected: + virtual int expandPlainMacro (const QString&, uint, QStringList&); + virtual int expandEscapedMacro (const QString&, uint, QStringList&); + +}; // class KMacroExpanderBase + +%End + + +%If ( KDE_3_3_0 - ) + +class KWordMacroExpander : KMacroExpanderBase +{ +%TypeHeaderCode +#include <kmacroexpander.h> +%End + + +public: + KWordMacroExpander (QChar = '%'); + +protected: + virtual int expandPlainMacro (const QString&, uint, QStringList&); + virtual int expandEscapedMacro (const QString&, uint, QStringList&); + virtual bool expandMacro (const QString&, QStringList&) = 0; + +}; // class KWordMacroExpander + +%End + + +%If ( KDE_3_3_0 - ) + +class KCharMacroExpander : KMacroExpanderBase +{ +%TypeHeaderCode +#include <kmacroexpander.h> +%End + + +public: + KCharMacroExpander (QChar = '%'); + +protected: + virtual int expandPlainMacro (const QString&, uint, QStringList&); + virtual int expandEscapedMacro (const QString&, uint, QStringList&); + virtual bool expandMacro (QChar, QStringList&) = 0; + +}; // class KCharMacroExpander + +%End + + +%If ( KDE_3_2_0 - ) +namespace KMacroExpander +{ +QString expandMacros (const QString&, const QMap<QChar,QString>&, QChar = '%'); +QString expandMacrosShellQuote (const QString&, const QMap<QChar,QString>&, QChar = '%'); +QString expandMacros (const QString&, const QMap<QString,QString>&, QChar = '%'); +QString expandMacrosShellQuote (const QString&, const QMap<QString,QString>&, QChar = '%'); +QString expandMacros (const QString&, const QMap<QChar,QStringList>&, QChar = '%'); +QString expandMacros (const QString&, const QMap<QString,QStringList>&, QChar = '%'); +QString expandMacrosShellQuote (const QString&, const QMap<QChar,QStringList>&, QChar = '%'); +QString expandMacrosShellQuote (const QString&, const QMap<QString,QStringList>&, QChar = '%'); +}; // namespace KMacroExpander + +%End + + + +%MappedType QMap<QChar,QString> +//converts a Python dict of QChar:QString +{ +%TypeHeaderCode +#include <sipqtQString.h> +#include <sipqtQChar.h> +%End + +%ConvertFromTypeCode + + if (!sipCpp) + return PyDict_New(); + + PyObject *dict; + + // Create the dictionary. + + if ((dict = PyDict_New()) == NULL) + return NULL; + + // Get it. + + const QMap<QChar,QString> map = *sipCpp; + QMap<QChar,QString>::ConstIterator it; + + for (it = map.begin (); it != map.end (); ++it) + { + QChar acpp = it.key (); + PyObject *binst = PyString_FromString ((char *)((QString *)&it.data ())); + PyObject *ainst; + if (((ainst = sipBuildResult (NULL, "N", new QChar (acpp), sipClass_QChar)) == NULL) + || (binst == 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<QChar, QString> + + if (sipIsErr == NULL) + return PyDict_Check(sipPy); + + QMap<QChar,QString> *map = new QMap<QChar,QString>; + + PyObject *key, *value; + int pos = 0; + QChar *cKey; + QString *sData; + + while (PyDict_Next(sipPy, &pos, &key, &value)) + { + int iserr = 0; + + cKey = (QChar *)sipForceConvertTo_QChar (key, &iserr); + sData = (QString *)sipForceConvertTo_QString (value, &iserr); + + if (iserr) + { + *sipIsErr = 1; + delete map; + return 0; + } + + map->insert (*cKey, *sData); + } + + *sipCppPtr = map; + + return 1; +%End +}; + + +%MappedType QMap<QString,QStringList> +//converts a Python dict of QString:QStringList +{ +%TypeHeaderCode +#include <sipqtQString.h> +#include <sipqtQStringList.h> +%End + +%ConvertFromTypeCode + + if (!sipCpp) + return PyDict_New(); + + PyObject *dict; + + // Create the dictionary. + + if ((dict = PyDict_New()) == NULL) + return NULL; + + // Get it. + + const QMap<QString, QStringList> map = *sipCpp; + QMap<QString, QStringList>::ConstIterator it; + + for (it = map.begin (); it != map.end (); ++it) + { + QStringList bcpp = it.data (); + PyObject *ainst = PyString_FromString ((char *)((QString *)&it.key ())); + PyObject *binst; + if (((binst = sipBuildResult (NULL, "N", new QStringList (bcpp), sipClass_QStringList)) == NULL) + || (ainst == 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<QString, QStringList> on the heap. + + if (sipIsErr == NULL) + return PyDict_Check(sipPy); + + QMap<QString, QStringList> *map = new QMap<QString, QStringList>; + + PyObject *key, *value; + int pos = 0; + QString *sKey; + QStringList *slData; + + while (PyDict_Next(sipPy, &pos, &key, &value)) + { + int iserr = 0; + + sKey = (QString *)sipForceConvertTo_QString (value, &iserr); + slData = (QStringList *)sipForceConvertTo_QStringList (value, &iserr); + + if (iserr) + { + *sipIsErr = 1; + delete map; + return 0; + } + + map->insert (*sKey, *slData); + } + + *sipCppPtr = map; + + return 1; +%End +}; + + +%MappedType QMap<QChar,QStringList> +//converts a Python dict of QChar:QStringList +{ +%TypeHeaderCode +#include <sipqtQStringList.h> +#include <sipqtQChar.h> +%End + +%ConvertFromTypeCode + + if (!sipCpp) + return PyDict_New(); + + PyObject *dict; + + // Create the dictionary. + + if ((dict = PyDict_New()) == NULL) + return NULL; + + // Get it. + + const QMap<QChar,QStringList> map = *sipCpp; + QMap<QChar,QStringList>::ConstIterator it; + + for (it = map.begin (); it != map.end (); ++it) + { + QChar acpp = it.key (); + QStringList bcpp = it.data (); + PyObject *binst; + PyObject *ainst; + if (((ainst = sipBuildResult (NULL, "N", new QChar (acpp), sipClass_QChar)) == NULL) + || (binst = sipBuildResult (NULL, "N", new QStringList (bcpp), sipClass_QStringList)) + || (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<QChar, QStringList> on the heap. + + if (sipIsErr == NULL) + return PyDict_Check(sipPy); + + QMap<QChar,QStringList> *map = new QMap<QChar,QStringList>; + + PyObject *key, *value; + int pos = 0; + QChar *cKey; + QStringList *slData; + + while (PyDict_Next(sipPy, &pos, &key, &value)) + { + int iserr = 0; + + cKey = (QChar *)sipForceConvertTo_QChar (key, &iserr); + slData = (QStringList *)sipForceConvertTo_QStringList (value, &iserr); + + if (iserr) + { + *sipIsErr = 1; + delete map; + return 0; + } + + map->insert (*cKey, *slData); + } + + *sipCppPtr = map; + + return 1; +%End +}; + + |