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

173 lines
4.1 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.
class KEntry
{
%TypeHeaderCode
#include <kconfigdata.h>
%End
public:
KEntry ();
TQCString mValue;
bool bDirty;
bool bNLS;
bool bGlobal;
bool bImmutable;
bool bDeleted;
%If ( KDE_3_1_0 - )
bool bExpand;
%End
}; // class KEntry
class KEntryKey
{
%TypeHeaderCode
#include <kconfigdata.h>
%End
public:
KEntryKey (const TQCString& = TQCString ("" ), const TQCString& = TQCString ("" ));
TQCString mGroup;
TQCString mKey;
bool bLocal;
bool bDefault;
const char* c_key;
}; // class KEntryKey
//ig typedef TQMap<KEntryKey,KEntry>::Iterator KEntryMapIterator;
//ig typedef TQMap<KEntryKey,KEntry>::ConstIterator KEntryMapConstIterator;
//force
KEntryMap testKEntryMap (SIP_PYOBJECT) [KEntryMap (KEntryMap)];
%MethodCode
//takes dict | (KEntryMap)
//returns (TQMap<KEntryKey,KEntry)
int isErr = 0;
KEntryMap *map = (KEntryMap *)sipForceConvertToType(a0, sipType_KEntryMap, NULL, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &isErr);
if (isErr)
sipRes = NULL;
else
sipRes = map;
%End
//end
%MappedType KEntryMap
//converts a Python dict of KEntryKey:KEntry
{
%TypeHeaderCode
#include <tqmap.h>
#include <kconfigdata.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 KEntryMap cppmap = *sipCpp;
KEntryMap::ConstIterator it;
for (it = cppmap.begin (); it != cppmap.end (); ++it)
{
KEntryKey acpp = it.key ();
KEntry bcpp = it.data ();
PyObject *ainst;
PyObject *binst = NULL;
if (((ainst = sipConvertFromNewType(new KEntryKey(acpp), sipType_KEntryKey, NULL)) == NULL)
|| ((binst = sipConvertFromNewType(new KEntry(bcpp), sipType_KEntry, NULL)) == 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);
KEntryMap *cppmap = new KEntryMap;
PyObject *aelem, *belem;
SIP_SSIZE_T pos = 0;
KEntryKey *acpp;
KEntry *bcpp;
while (PyDict_Next(sipPy, &pos, &aelem, &belem))
{
int iserr = 0;
acpp = (KEntryKey *)sipForceConvertToType(aelem, sipType_KEntryKey, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
bcpp = (KEntry *)sipForceConvertToType(belem, sipType_KEntry, sipTransferObj, SIP_NOT_NONE|SIP_NO_CONVERTORS, NULL, &iserr);
if (iserr)
{
*sipIsErr = 1;
delete cppmap;
return 0;
}
cppmap->insert (*acpp, *bcpp);
}
*sipCppPtr = cppmap;
return 1;
%End
};