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/kdecore/kmacroexpander.sip

385 lines
9.7 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 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.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qmap.h>
#include <qstring.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 = sipConvertFromNewType(new QChar(acpp), sipType_QChar, sipTransferObj)) == 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;
SIP_SSIZE_T pos = 0;
QChar *cKey;
QString *sData;
while (PyDict_Next(sipPy, &pos, &key, &value))
{
int iserr = 0, cKey_state, sData_state;
cKey = (QChar *)sipForceConvertToType(key, sipType_QChar, sipTransferObj, SIP_NOT_NONE, &cKey_state, &iserr);
sData = (QString *)sipForceConvertToType(value, sipType_QString, sipTransferObj, SIP_NOT_NONE, &sData_state, &iserr);
if (iserr)
{
if (cKey)
sipReleaseType(cKey, sipType_QChar, cKey_state);
*sipIsErr = 1;
delete map;
return 0;
}
map->insert (*cKey, *sData);
sipReleaseType(cKey, sipType_QChar, cKey_state);
sipReleaseType(sData, sipType_QString, sData_state);
}
*sipCppPtr = map;
return 1;
%End
};
%MappedType QMap<QString,QStringList>
//converts a Python dict of QString:QStringList
{
%TypeHeaderCode
#include <qmap.h>
#include <qstring.h>
#include <qstringlist.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 = sipConvertFromNewType(new QStringList(bcpp), sipType_QStringList, sipTransferObj)) == 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;
SIP_SSIZE_T pos = 0;
QString *sKey;
QStringList *slData;
while (PyDict_Next(sipPy, &pos, &key, &value))
{
int iserr = 0, sKey_state, slData_state;
sKey = (QString *)sipForceConvertToType(key, sipType_QString, sipTransferObj, SIP_NOT_NONE, &sKey_state, &iserr);
slData = (QStringList *)sipForceConvertToType(value, sipType_QStringList, sipTransferObj, SIP_NOT_NONE, &slData_state, &iserr);
if (iserr)
{
if (sKey)
sipReleaseType(sKey, sipType_QString, sKey_state);
*sipIsErr = 1;
delete map;
return 0;
}
map->insert (*sKey, *slData);
sipReleaseType(sKey, sipType_QString, sKey_state);
sipReleaseType(slData, sipType_QStringList, slData_state);
}
*sipCppPtr = map;
return 1;
%End
};
%MappedType QMap<QChar,QStringList>
//converts a Python dict of QChar:QStringList
{
%TypeHeaderCode
#include <qmap.h>
#include <qstringlist.h>
#include <qstring.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 = sipConvertFromNewType(new QChar(acpp), sipType_QChar, sipTransferObj)) == NULL)
|| (binst = sipConvertFromNewType(new QStringList(bcpp), sipType_QStringList, sipTransferObj))
|| (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;
SIP_SSIZE_T pos = 0;
QChar *cKey;
QStringList *slData;
while (PyDict_Next(sipPy, &pos, &key, &value))
{
int iserr = 0, cKey_state, slData_state;
cKey = (QChar *)sipForceConvertToType(key, sipType_QChar, sipTransferObj, SIP_NOT_NONE, &cKey_state, &iserr);
slData = (QStringList *)sipForceConvertToType(value, sipType_QStringList, sipTransferObj, SIP_NOT_NONE, &slData_state, &iserr);
if (iserr)
{
if (cKey)
sipReleaseType(cKey, sipType_QChar, cKey_state);
*sipIsErr = 1;
delete map;
return 0;
}
map->insert (*cKey, *slData);
sipReleaseType(cKey, sipType_QChar, cKey_state);
sipReleaseType(slData, sipType_QStringList, slData_state);
}
*sipCppPtr = map;
return 1;
%End
};