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 #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