// // Copyright 2006 Jim Bublitz // Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson // may also apply // Generated by preSip // module kio 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 KServiceOffer { %TypeHeaderCode #include %End public: KServiceOffer (); KServiceOffer (const KServiceOffer&); KServiceOffer (KService::Ptr, int, bool); %If ( KDE_3_1_4 - ) bool operator < (const KServiceOffer&) const; %End bool allowAsDefault () const; int preference () const; KService::Ptr service () const; bool isValid () const; }; // class KServiceOffer class KServiceTypeProfile { %TypeHeaderCode #include %End public: typedef QValueList OfferList; int preference (const QString&) const; bool allowAsDefault (const QString&) const; KServiceTypeProfile::OfferList offers () const; static KService::Ptr preferredService (const QString&, const QString&); static KServiceTypeProfile* serviceTypeProfile (const QString&, const QString&); static KServiceTypeProfile::OfferList offers (const QString&, const QString&); static const QPtrList& serviceTypeProfiles (); static void clear (); static void setConfigurationMode (); static bool configurationMode (); protected: KServiceTypeProfile (const QString&, const QString& = QString ::null ); void addService (const QString&, int = 1, bool = 1); }; // class KServiceTypeProfile %MappedType KServiceTypeProfile::OfferList //converts a Python list of KServiceOffer { %TypeHeaderCode #include #include #include #include %End %ConvertFromTypeCode if (!sipCpp) return PyList_New(0); // Create the list PyObject *pylist; if ((pylist = PyList_New(0)) == NULL) return NULL; QValueList *cpplist = (QValueList *)sipCpp; PyObject *inst; // Get it. QValueList::Iterator it; for( it = cpplist->begin(); it != cpplist->end(); ++it ) { if (((inst = sipBuildResult (NULL, "N", new KServiceOffer (*it), sipClass_KServiceOffer)) == NULL) || PyList_Append (pylist, inst) < 0) { Py_DECREF (pylist); return NULL; } } return pylist; %End %ConvertToTypeCode if (sipIsErr == NULL) return PyList_Check(sipPy); QValueList *cpplist = new QValueList; PyObject *elem; KServiceOffer *cpp; int iserr = 0; for (int i = 0; i < PyList_Size (sipPy); i++) { elem = PyList_GET_ITEM (sipPy, i); cpp = (KServiceOffer *)sipForceConvertTo_KServiceOffer (elem, &iserr); if (iserr) { *sipIsErr = 1; delete cpplist; return 0; } cpplist->append (*cpp); } *sipCppPtr = cpplist; return 1; %End }; %MappedType QPtrList //converts a Python list of KServiceTypeProfile { %TypeHeaderCode #include #include #include //typedef QPtrList SvcTypeProfileList; %End %ConvertFromTypeCode // Convert to a Python list of KServiceTypeProfile if (!sipCpp) return PyList_New (0); PyObject *plist; // Create the list if ((plist = PyList_New(0)) == NULL) return NULL; // Get it. QPtrList *cList = (QPtrList *)sipCpp; PyObject *inst; KServiceTypeProfile *svc; for( svc = cList->first (); svc; svc = cList->next ()) { inst = sipConvertFromInstance (svc, sipClass_KServiceTypeProfile, sipTransferObj); if ((inst == NULL) || (PyList_Append (plist, inst) < 0)) { Py_XDECREF (inst); Py_DECREF (plist); return NULL; } } return plist; %End %ConvertToTypeCode // Convert a Python list to SvcTypeProfileList on the heap. if (sipIsErr == NULL) return PyList_Check(sipPy); QPtrList *cList = new QPtrList; PyObject *elem; KServiceTypeProfile *service; int iserr = 0; for (int i = 0; i < PyList_Size (sipPy); i++) { elem = PyList_GET_ITEM (sipPy, i); service = (KServiceTypeProfile *)sipForceConvertTo_KServiceTypeProfile (elem, &iserr); if (iserr) { *sipIsErr = 1; delete cList; return 0; } cList->append (service); } *sipCppPtr = cList; return 1; %End };