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

385 lines
9.9 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.
%ModuleHeaderCode
#include <kmacroexpander.h>
%End
%If ( KDE_3_2_0 - )
class KMacroExpanderBase
{
%TypeHeaderCode
#include <kmacroexpander.h>
%End
public:
KMacroExpanderBase (TQChar = '%');
void expandMacros (TQString&);
bool expandMacrosShellQuote (TQString&, uint& /In, Out/);
bool expandMacrosShellQuote (TQString&);
void setEscapeChar (TQChar);
TQChar escapeChar () const;
protected:
virtual int expandPlainMacro (const TQString&, uint, TQStringList&);
virtual int expandEscapedMacro (const TQString&, uint, TQStringList&);
}; // class KMacroExpanderBase
%End
%If ( KDE_3_3_0 - )
class KWordMacroExpander : KMacroExpanderBase
{
%TypeHeaderCode
#include <kmacroexpander.h>
%End
public:
KWordMacroExpander (TQChar = '%');
protected:
virtual int expandPlainMacro (const TQString&, uint, TQStringList&);
virtual int expandEscapedMacro (const TQString&, uint, TQStringList&);
virtual bool expandMacro (const TQString&, TQStringList&) = 0;
}; // class KWordMacroExpander
%End
%If ( KDE_3_3_0 - )
class KCharMacroExpander : KMacroExpanderBase
{
%TypeHeaderCode
#include <kmacroexpander.h>
%End
public:
KCharMacroExpander (TQChar = '%');
protected:
virtual int expandPlainMacro (const TQString&, uint, TQStringList&);
virtual int expandEscapedMacro (const TQString&, uint, TQStringList&);
virtual bool expandMacro (TQChar, TQStringList&) = 0;
}; // class KCharMacroExpander
%End
%If ( KDE_3_2_0 - )
namespace KMacroExpander
{
TQString expandMacros (const TQString&, const TQMap<TQChar,TQString>&, TQChar = '%');
TQString expandMacrosShellQuote (const TQString&, const TQMap<TQChar,TQString>&, TQChar = '%');
TQString expandMacros (const TQString&, const TQMap<TQString,TQString>&, TQChar = '%');
TQString expandMacrosShellQuote (const TQString&, const TQMap<TQString,TQString>&, TQChar = '%');
TQString expandMacros (const TQString&, const TQMap<TQChar,TQStringList>&, TQChar = '%');
TQString expandMacros (const TQString&, const TQMap<TQString,TQStringList>&, TQChar = '%');
TQString expandMacrosShellQuote (const TQString&, const TQMap<TQChar,TQStringList>&, TQChar = '%');
TQString expandMacrosShellQuote (const TQString&, const TQMap<TQString,TQStringList>&, TQChar = '%');
}; // namespace KMacroExpander
%End
%MappedType TQMap<TQChar,TQString>
//converts a Python dict of TQChar:TQString
{
%TypeHeaderCode
#include <tqmap.h>
#include <tqstring.h>
%End
%ConvertFromTypeCode
if (!sipCpp)
return PyDict_New();
PyObject *dict;
// Create the dictionary.
if ((dict = PyDict_New()) == NULL)
return NULL;
// Get it.
const TQMap<TQChar,TQString> map = *sipCpp;
TQMap<TQChar,TQString>::ConstIterator it;
for (it = map.begin (); it != map.end (); ++it)
{
TQChar acpp = it.key ();
PyObject *binst = PyBytes_FromString ((char *)((TQString *)&it.data ()));
PyObject *ainst;
if (((ainst = sipConvertFromNewType(new TQChar(acpp), sipType_TQChar, 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 TQMap<TQChar, TQString>
if (sipIsErr == NULL)
return PyDict_Check(sipPy);
TQMap<TQChar,TQString> *map = new TQMap<TQChar,TQString>;
PyObject *key, *value;
SIP_SSIZE_T pos = 0;
TQChar *cKey;
TQString *sData;
while (PyDict_Next(sipPy, &pos, &key, &value))
{
int iserr = 0, cKey_state, sData_state;
cKey = (TQChar *)sipForceConvertToType(key, sipType_TQChar, sipTransferObj, SIP_NOT_NONE, &cKey_state, &iserr);
sData = (TQString *)sipForceConvertToType(value, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &sData_state, &iserr);
if (iserr)
{
if (cKey)
sipReleaseType(cKey, sipType_TQChar, cKey_state);
*sipIsErr = 1;
delete map;
return 0;
}
map->insert (*cKey, *sData);
sipReleaseType(cKey, sipType_TQChar, cKey_state);
sipReleaseType(sData, sipType_TQString, sData_state);
}
*sipCppPtr = map;
return 1;
%End
};
%MappedType TQMap<TQString,TQStringList>
//converts a Python dict of TQString:TQStringList
{
%TypeHeaderCode
#include <tqmap.h>
#include <tqstring.h>
#include <tqstringlist.h>
%End
%ConvertFromTypeCode
if (!sipCpp)
return PyDict_New();
PyObject *dict;
// Create the dictionary.
if ((dict = PyDict_New()) == NULL)
return NULL;
// Get it.
const TQMap<TQString, TQStringList> map = *sipCpp;
TQMap<TQString, TQStringList>::ConstIterator it;
for (it = map.begin (); it != map.end (); ++it)
{
TQStringList bcpp = it.data ();
PyObject *ainst = PyBytes_FromString ((char *)((TQString *)&it.key ()));
PyObject *binst;
if (((binst = sipConvertFromNewType(new TQStringList(bcpp), sipType_TQStringList, 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 TQMap<TQString, TQStringList> on the heap.
if (sipIsErr == NULL)
return PyDict_Check(sipPy);
TQMap<TQString, TQStringList> *map = new TQMap<TQString, TQStringList>;
PyObject *key, *value;
SIP_SSIZE_T pos = 0;
TQString *sKey;
TQStringList *slData;
while (PyDict_Next(sipPy, &pos, &key, &value))
{
int iserr = 0, sKey_state, slData_state;
sKey = (TQString *)sipForceConvertToType(key, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &sKey_state, &iserr);
slData = (TQStringList *)sipForceConvertToType(value, sipType_TQStringList, sipTransferObj, SIP_NOT_NONE, &slData_state, &iserr);
if (iserr)
{
if (sKey)
sipReleaseType(sKey, sipType_TQString, sKey_state);
*sipIsErr = 1;
delete map;
return 0;
}
map->insert (*sKey, *slData);
sipReleaseType(sKey, sipType_TQString, sKey_state);
sipReleaseType(slData, sipType_TQStringList, slData_state);
}
*sipCppPtr = map;
return 1;
%End
};
%MappedType TQMap<TQChar,TQStringList>
//converts a Python dict of TQChar:TQStringList
{
%TypeHeaderCode
#include <tqmap.h>
#include <tqstringlist.h>
#include <tqstring.h>
%End
%ConvertFromTypeCode
if (!sipCpp)
return PyDict_New();
PyObject *dict;
// Create the dictionary.
if ((dict = PyDict_New()) == NULL)
return NULL;
// Get it.
const TQMap<TQChar,TQStringList> map = *sipCpp;
TQMap<TQChar,TQStringList>::ConstIterator it;
for (it = map.begin (); it != map.end (); ++it)
{
TQChar acpp = it.key ();
TQStringList bcpp = it.data ();
PyObject *binst;
PyObject *ainst;
if (((ainst = sipConvertFromNewType(new TQChar(acpp), sipType_TQChar, sipTransferObj)) == NULL)
|| (binst = sipConvertFromNewType(new TQStringList(bcpp), sipType_TQStringList, 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 TQMap<TQChar, TQStringList> on the heap.
if (sipIsErr == NULL)
return PyDict_Check(sipPy);
TQMap<TQChar,TQStringList> *map = new TQMap<TQChar,TQStringList>;
PyObject *key, *value;
SIP_SSIZE_T pos = 0;
TQChar *cKey;
TQStringList *slData;
while (PyDict_Next(sipPy, &pos, &key, &value))
{
int iserr = 0, cKey_state, slData_state;
cKey = (TQChar *)sipForceConvertToType(key, sipType_TQChar, sipTransferObj, SIP_NOT_NONE, &cKey_state, &iserr);
slData = (TQStringList *)sipForceConvertToType(value, sipType_TQStringList, sipTransferObj, SIP_NOT_NONE, &slData_state, &iserr);
if (iserr)
{
if (cKey)
sipReleaseType(cKey, sipType_TQChar, cKey_state);
*sipIsErr = 1;
delete map;
return 0;
}
map->insert (*cKey, *slData);
sipReleaseType(cKey, sipType_TQChar, cKey_state);
sipReleaseType(slData, sipType_TQStringList, slData_state);
}
*sipCppPtr = map;
return 1;
%End
};