Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

Blokkal::Io::XmlRpcJob Class Reference

This class implements an XML-RPC call. More...

#include <xmlrpcjob.h>

Inheritance diagram for Blokkal::Io::XmlRpcJob:

Blokkal::Io::Job

List of all members.


Public Types

enum  ResponseType { ResponseSuccess = 1, ResponseFault = 2, ResponseError = 3 }
enum  WorkArounds { WordPressDateWorkAround = 0x01 }

Public Member Functions

const QVariant & response (void) const
Blokkal::Io::XmlRpcJob::ResponseType responseType (void) const
 XmlRpcJob (const KUrl &url, const QString &methodName, const QList< QVariant > &params, unsigned int workArounds=0, bool showProgressInfo=FALSE)
virtual ~XmlRpcJob (void)

Static Public Member Functions

static QVariant decodeData (const QDomElement &valueElement)
static void encodeData (QDomElement &containerElement, QVariant data, unsigned int workArounds=0)

Protected Slots

virtual void slotDataArrived (KIO::Job *job, const QByteArray &data)

Protected Member Functions

virtual void jobFinished (void)

Detailed Description

This class implements an XML-RPC call.

Basically, this is a wrapper around a KIO::TransferJob (HTTP-POST), that does all the dirty work for you.

Author:
Martin Mueller <orvio@orvio.de>

Definition at line 45 of file xmlrpcjob.h.


Member Enumeration Documentation

Enumerations for possible response types

Enumerator:
ResponseSuccess  A valid XML-RPX response indicating a success was received.
ResponseFault  A valid XML-RPX response indicating an error was received.
ResponseError  No valid XML-RPX response was received, either due to a malformed response, an IO error or similar.

Definition at line 89 of file xmlrpcjob.h.

Enumeration for workarounds for some buggy server side implementations

Enumerator:
WordPressDateWorkAround  Encode date in WordPress variant of ISO 8601.

Definition at line 75 of file xmlrpcjob.h.


Constructor & Destructor Documentation

Blokkal::Io::XmlRpcJob::XmlRpcJob ( const KUrl &  url,
const QString &  methodName,
const QList< QVariant > &  params,
unsigned int  workArounds = 0,
bool  showProgressInfo = FALSE 
)

Creates a new XmlRpcJob. The job will be started immediately. The job will destroy itself after it has finished. If you want to abort the job, delete this object.

Parameters:
url the url to connect to
methodName the name of the method to call
params parameters for the method call
workArounds enabled workarounds
showProgressInfo true to show progress information

Definition at line 47 of file xmlrpcjob.cpp.

Blokkal::Io::XmlRpcJob::~XmlRpcJob ( void   )  [virtual]

Destructor

Definition at line 99 of file xmlrpcjob.cpp.


Member Function Documentation

QVariant Blokkal::Io::XmlRpcJob::decodeData ( const QDomElement &  valueElement  )  [static]

Returns a QVariant representation of the Xml-Rpc data in valueElement

Parameters:
valueElement read the date from this element
Returns:
the QVariant representation

Definition at line 252 of file xmlrpcjob.cpp.

void Blokkal::Io::XmlRpcJob::encodeData ( QDomElement &  containerElement,
QVariant  data,
unsigned int  workArounds = 0 
) [static]

Encodes data into containerElement. Example: If containerElement is a "<param>" element and data is a QString, then the result will be

 <param>
   <value>SomeString</value>
 </param>
This method works recursively, so it will encode structures like QMap or QList automatically.
Parameters:
containerElement put the date in new child nodes of this element
data the data to encode
workArounds or'ed list of WorkArounds

Definition at line 170 of file xmlrpcjob.cpp.

void Blokkal::Io::XmlRpcJob::jobFinished ( void   )  [protected, virtual]

This method is called when all subjobs have finished and the result() signal is about to be emitted. Override this method in subclasses if you need to do special things after the job has finished. The default implementation does nothing.

Reimplemented from Blokkal::Io::Job.

Definition at line 113 of file xmlrpcjob.cpp.

const QVariant & Blokkal::Io::XmlRpcJob::response ( void   )  const

Returns the content of the XMl-RPX response. Check responseType() first.

Returns:
the content of the XMl-RPX response

Definition at line 160 of file xmlrpcjob.cpp.

Blokkal::Io::XmlRpcJob::ResponseType Blokkal::Io::XmlRpcJob::responseType ( void   )  const

Returns the type of the response

Returns:
the type of the response

Definition at line 165 of file xmlrpcjob.cpp.

void Blokkal::Io::XmlRpcJob::slotDataArrived ( KIO::Job *  job,
const QByteArray &  data 
) [protected, virtual, slot]

Stores the returned data in the response buffer. You should not need to override this method.

Parameters:
job the worker job
data the new data

Definition at line 104 of file xmlrpcjob.cpp.


The documentation for this class was generated from the following files: