KNewStuff
soap.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KNEWSTUFF2_DXS_SOAP_H
00022 #define KNEWSTUFF2_DXS_SOAP_H
00023
00024 #include <QtCore/QObject>
00025 #include <QtNetwork/QAbstractSocket>
00026
00027 namespace KIO
00028 {
00029 class Job;
00030 }
00031 class KJob;
00032
00033 class QDomDocument;
00034 class QDomNode;
00035 class QDomElement;
00036 class QTcpSocket;
00037
00038 namespace KNS
00039 {
00040
00052 class Soap : public QObject
00053 {
00054 Q_OBJECT
00055 public:
00056 Soap(QObject* parent);
00057 ~Soap();
00058
00059 enum Model {
00060 soap,
00061 canonicaltree
00062 };
00063
00068 void setModel(Model m);
00069
00075 int call(const QDomElement& element, const QString &endpoint);
00076
00082 QString localname(const QDomNode& node);
00083
00090 QString xpath(const QDomNode& node, const QString &expr);
00097 QList<QDomNode> directChildNodes(const QDomNode& node, const QString &name);
00098
00099 signals:
00100 void signalResult(QDomNode node, int jobid);
00101 void signalError();
00102
00103 private slots:
00104 void slotData(KIO::Job *job, const QByteArray& data);
00105 void slotResult(KJob *job);
00106 void slotSocket();
00107 void slotSocketError(QAbstractSocket::SocketError error);
00108
00109 private:
00115 int call_soap(QDomElement element, const QString& endpoint);
00116
00122 void call_tree(const QDomElement& element, const QString& endpoint);
00130 QDomDocument buildtree(QDomDocument doc, QDomElement cur, const QString& data);
00131
00132 QString m_data;
00133 Model m_model;
00134 QTcpSocket *m_socket;
00135 QByteArray m_buffer;
00136 bool m_inprogress;
00137 QMap<KJob*, int> m_jobids;
00138 int m_lastjobid;
00139 };
00140
00141 }
00142
00143 #endif