KNewStuff
soap.h
Go to the documentation of this file.
00001 /* 00002 This file is part of KNewStuff2. 00003 Copyright (c) 2007 Josef Spillner <spillner@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef KNEWSTUFF2_DXS_SOAP_H 00020 #define KNEWSTUFF2_DXS_SOAP_H 00021 00022 #include <QtCore/QObject> 00023 #include <QtNetwork/QAbstractSocket> 00024 00025 namespace KIO 00026 { 00027 class Job; 00028 } 00029 class KJob; 00030 00031 class QDomDocument; 00032 class QDomNode; 00033 class QDomElement; 00034 class QTcpSocket; 00035 00036 namespace KNS 00037 { 00038 00050 class Soap : public QObject 00051 { 00052 Q_OBJECT 00053 public: 00054 Soap(QObject* parent); 00055 ~Soap(); 00056 00057 enum Model { 00058 soap, 00059 canonicaltree 00060 }; 00061 00065 void setModel(Model m); 00066 00070 int call(const QDomElement& element, const QString &endpoint); 00071 00075 QString localname(const QDomNode& node); 00076 00083 QString xpath(const QDomNode& node, const QString &expr); 00084 QList<QDomNode> directChildNodes(const QDomNode& node, const QString &name); 00085 00086 signals: 00087 void signalResult(QDomNode node, int jobid); 00088 void signalError(); 00089 00090 private slots: 00091 void slotData(KIO::Job *job, const QByteArray& data); 00092 void slotResult(KJob *job); 00093 void slotSocket(); 00094 void slotSocketError(QAbstractSocket::SocketError error); 00095 00096 private: 00102 int call_soap(QDomElement element, const QString& endpoint); 00103 00107 void call_tree(const QDomElement& element, const QString& endpoint); 00108 QDomDocument buildtree(QDomDocument doc, QDomElement cur, const QString& data); 00109 00110 QString m_data; 00111 Model m_model; 00112 QTcpSocket *m_socket; 00113 QByteArray m_buffer; 00114 bool m_inprogress; 00115 QMap<KJob*, int> m_jobids; 00116 int m_lastjobid; 00117 }; 00118 00119 } 00120 00121 #endif
KDE 4.6 API Reference