diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-09 13:43:24 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-09 13:43:24 +0000 |
| commit | ed9c0fa49eec55bd5840967098af80df0196117b (patch) | |
| tree | ca9790a6b0ce63a642727798fa61f1d45afbcc12 /source/xmlrpc.h | |
| parent | 71b56f080fd955062719c6529192a347fc26313f (diff) | |
| download | qxmpp-ed9c0fa49eec55bd5840967098af80df0196117b.tar.gz | |
simplify XML RPC code
Diffstat (limited to 'source/xmlrpc.h')
| -rw-r--r-- | source/xmlrpc.h | 59 |
1 files changed, 12 insertions, 47 deletions
diff --git a/source/xmlrpc.h b/source/xmlrpc.h index 3b846f23..67f1a028 100644 --- a/source/xmlrpc.h +++ b/source/xmlrpc.h @@ -41,55 +41,22 @@ namespace XMLRPC { /** - * Base utility methods for working with XMLRPC messages. -@author Ian Reinhart Geiser <geiseri@kde.org> -*/ -class MessageBase -{ -public: - MessageBase(); - virtual ~MessageBase(); - - /** - * Returns a human readable error that was recived from the server. - */ - QString error() const; - - /** - * Sets the human readable error message. - */ - virtual void setError( const QString &message ) const; - - /** - * Returns if the current message is valid. - */ - bool isValid() const; - -protected: - virtual void marshall( QXmlStreamWriter *writer, const QVariant &val ) const; - virtual QVariant demarshall( const QDomElement &elem ) const; - -private: - mutable QString m_message; - mutable bool m_valid; -}; - -/** * Creates an XMLRPC message that will call a method with a series of * QVariants that will be converted to XMLRPC types. @author Ian Reinhart Geiser <geiseri@kde.org> */ -class RequestMessage : public MessageBase +class RequestMessage { public: - RequestMessage( const QDomElement &element ); - /** * Creates a method packet that will call method with a list of args. */ - RequestMessage( const QByteArray &method, const QList<QVariant> &args ); + RequestMessage(const QByteArray &method = QByteArray(), const QList<QVariant> &args = QList<QVariant>()); - virtual ~RequestMessage() {;} + /** + * Parse an xml packet. + */ + bool parse(const QDomElement &element); /** * Return the xml representation of the packet. @@ -108,20 +75,18 @@ private: * Decodes an XMLRPC message from a server into a set of QVariants. @author Ian Reinhart Geiser <geiseri@kde.org> */ -class ResponseMessage : public MessageBase +class ResponseMessage { public: /** - * Create a new recive packet with an xml packet - */ - ResponseMessage( const QDomElement &element ); - - /** * Create a new response message with data. */ - ResponseMessage( const QList< QVariant >& theValue ); + ResponseMessage(const QList<QVariant> &theValue = QList<QVariant>()); - virtual ~ResponseMessage() {;} + /** + * Parse an xml packet. + */ + bool parse(const QDomElement &element); /** * Return the xml representation of the packet. |
