// // Copyright 2006 Jim Bublitz // 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 TDEConfig : TDEConfigBase { %TypeHeaderCode #include %End public: TDEConfig (const TQString& = TQString ::null , bool = 0, bool = 1, const char* = "config"); %If ( KDE_3_2_0 - ) TDEConfig (TDEConfigBackEnd*, bool = 0); %End virtual void rollback (bool = 1); virtual TQStringList groupList () const; virtual TQMap entryMap (const TQString&) const; virtual void reparseConfiguration (); void setFileWriteMode (int); void setForceGlobal (bool); bool forceGlobal () const; %If ( KDE_3_1_0 - ) void checkUpdate (const TQString&, const TQString&); %If ( KDE_3_2_0 - ) TDEConfig* copyTo (const TQString&, TDEConfig* = 0) const; %If ( KDE_3_3_0 - ) TDELockFile::Ptr lockFile (bool = 0); %End %End %End protected: virtual bool internalHasGroup (const TQCString&) const; virtual KEntryMap internalEntryMap (const TQString&) const; virtual KEntryMap internalEntryMap () const; virtual void putData (const KEntryKey&, const KEntry&, bool = 1); virtual KEntry lookupData (const KEntryKey&) const; private: TDEConfig (const TDEConfig&); protected: //igx virtual void virtual_hook (int, void*); }; // class TDEConfig %If ( KDE_3_2_0 - ) class TDESharedConfig : TDEConfig, TDEShared { %TypeHeaderCode #include %End public: //ig typedef TDESharedPtr Ptr; public: static TDESharedConfig::Ptr openConfig (const TQString&, bool = 0, bool = 1); private: TDESharedConfig (const TQString&, bool, bool); ~TDESharedConfig (); }; // class TDESharedConfig %End %MappedType TQMap //converts a Python dict of TQString:TQString { %TypeHeaderCode #include %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 TQMap cppmap = *sipCpp; TQMap::ConstIterator it; for (it = cppmap.begin (); it != cppmap.end (); ++it) { TQString acpp = it.key (); TQString bcpp = it.data (); PyObject *ainst; PyObject *binst = NULL; if (((ainst = sipConvertFromNewType(new TQString(acpp), sipType_TQString, sipTransferObj)) == NULL) || ((binst = sipConvertFromNewType(new TQString(bcpp), sipType_TQString, sipTransferObj)) == 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); TQMap *cppmap = new TQMap; PyObject *aelem, *belem; SIP_SSIZE_T pos = 0; TQString *acpp; TQString *bcpp; while (PyDict_Next(sipPy, &pos, &aelem, &belem)) { int iserr = 0, acpp_state, bcpp_state; acpp = (TQString *)sipForceConvertToType(aelem, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &acpp_state, &iserr); bcpp = (TQString *)sipForceConvertToType(belem, sipType_TQString, sipTransferObj, SIP_NOT_NONE, &bcpp_state, &iserr); if (iserr) { if (acpp) sipReleaseType(acpp, sipType_TQString, acpp_state); *sipIsErr = 1; delete cppmap; return 0; } cppmap->insert (*acpp, *bcpp); sipReleaseType(acpp, sipType_TQString, acpp_state); sipReleaseType(bcpp, sipType_TQString, bcpp_state); } *sipCppPtr = cppmap; return 1; %End }; %If (KDE_3_2_0 - ) %MappedType TDESharedConfig::Ptr //converts TDESharedConfig { %TypeHeaderCode #include #include %End %ConvertFromTypeCode // Convert to a Python instance if (!sipCpp) return NULL; TDESharedPtr *cPtr = new TDESharedPtr (*(TDESharedPtr *)sipCpp); TDESharedConfig *cpp = cPtr->data (); PyObject *obj = sipConvertFromInstance (cpp, sipClass_TDESharedConfig, sipTransferObj); return obj; %End %ConvertToTypeCode // Convert a Python instance to a Ptr on the heap. if (sipIsErr == NULL) return PyType_Check(sipPy); int iserr = 0; TDESharedConfig *cpp = (TDESharedConfig *)sipForceConvertToType(sipPy, sipType_TDESharedConfig, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr); if (iserr) { *sipIsErr = 1; return 0; } *sipCppPtr = new TDESharedPtr (cpp); return 1; %End }; %End