You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
4.1 KiB
125 lines
4.1 KiB
15 years ago
|
// -*- c++ -*-
|
||
|
/* This file is part of the KDE libraries
|
||
|
Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
|
||
|
Based on the davjob:
|
||
|
Copyright (C) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library 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
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#ifndef __kio_xmlrpcjob_h__
|
||
|
#define __kio_xmlrpcjob_h__
|
||
|
|
||
|
#include <kurl.h>
|
||
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqvaluelist.h>
|
||
|
#include <tqdom.h>
|
||
15 years ago
|
|
||
|
#include <kio/jobclasses.h>
|
||
|
#include <kio/global.h>
|
||
|
|
||
12 years ago
|
namespace TDEIO {
|
||
15 years ago
|
|
||
|
class XMLRPCResult;
|
||
|
|
||
|
/**
|
||
|
* The transfer job pumps data into and/or out of a Slave.
|
||
|
* Data is sent to the slave on request of the slave ( dataReq ).
|
||
|
* If data coming from the slave can not be handled, the
|
||
|
* reading of data from the slave should be suspended.
|
||
12 years ago
|
* @see TDEIO::xmlrpcCall()
|
||
15 years ago
|
* @since 3.4
|
||
|
*/
|
||
|
class XmlrpcJob : public TransferJob {
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
|
||
|
public:
|
||
|
/** Indicates the response type of the call
|
||
|
*/
|
||
|
enum XMLRPCResponseType {
|
||
|
XMLRPCMessageResponse,
|
||
|
XMLRPCFaultResponse,
|
||
|
XMLRPCUnknownResponse
|
||
|
};
|
||
|
/**
|
||
12 years ago
|
* Use TDEIO::xmlrpcPropFind(), TDEIO::xmlrpcPropPatch() and
|
||
|
* TDEIO::xmlrpcSearch() to create a new XmlrpcJob.
|
||
15 years ago
|
*/
|
||
15 years ago
|
XmlrpcJob( const KURL& url, const TQString& method,
|
||
|
const TQValueList<TQVariant> ¶ms, bool showProgressInfo );
|
||
15 years ago
|
virtual ~XmlrpcJob();
|
||
|
/**
|
||
15 years ago
|
* Returns the response as a TQDomDocument.
|
||
15 years ago
|
* @return the response document
|
||
|
*/
|
||
15 years ago
|
TQValueList<TQVariant> &response() { return m_response; }
|
||
15 years ago
|
/**
|
||
|
* Returns the type of the response.
|
||
|
* @return the type of the response
|
||
|
*/
|
||
|
XMLRPCResponseType responseType() const { return m_responseType; }
|
||
|
|
||
15 years ago
|
static TQString markupCall( const TQString &cmd,
|
||
|
const TQValueList<TQVariant> &args );
|
||
15 years ago
|
protected slots:
|
||
|
virtual void slotFinished();
|
||
15 years ago
|
virtual void slotData( const TQByteArray &data);
|
||
15 years ago
|
|
||
|
protected:
|
||
15 years ago
|
static TQString marshal( const TQVariant &arg );
|
||
|
static TQVariant demarshal( const TQDomElement &e );
|
||
15 years ago
|
|
||
15 years ago
|
static bool isMessageResponse( const TQDomDocument &doc );
|
||
|
static bool isFaultResponse( const TQDomDocument &doc );
|
||
15 years ago
|
|
||
15 years ago
|
static XMLRPCResult parseMessageResponse( const TQDomDocument &doc );
|
||
|
static XMLRPCResult parseFaultResponse( const TQDomDocument &doc );
|
||
15 years ago
|
|
||
|
|
||
|
private:
|
||
|
class XmlrpcJobPrivate;
|
||
|
XmlrpcJobPrivate *d;
|
||
15 years ago
|
TQString m_str_response;
|
||
|
TQValueList<TQVariant> m_response;
|
||
15 years ago
|
XMLRPCResponseType m_responseType;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Creates a XmlrpcJob that calls a @p method of the API at the given @p url.
|
||
|
*
|
||
|
* @param url the URL of the XML-RPC Interface of the server
|
||
|
* @param method the name of the method to call
|
||
15 years ago
|
* @param params the arguments (as TQValueList<TQVariant>) for the method call.
|
||
15 years ago
|
* @param showProgressInfo true to show progress information
|
||
|
* @return the new XmlrpcJob
|
||
|
*/
|
||
15 years ago
|
XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method,
|
||
|
const TQValueList<TQVariant> ¶ms,
|
||
15 years ago
|
bool showProgressInfo = true );
|
||
|
|
||
15 years ago
|
XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method,
|
||
|
const TQVariant &arg, bool showProgressInfo = true );
|
||
|
XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method,
|
||
|
const TQStringList &arg, bool showProgressInfo = true );
|
||
15 years ago
|
template <typename T>
|
||
15 years ago
|
XmlrpcJob* xmlrpcCall( const KURL& url, const TQString &method,
|
||
|
const TQValueList<T>&arg,bool showProgressInfo = true );
|
||
15 years ago
|
}
|
||
|
|
||
|
#endif
|