diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-09 12:47:42 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-09 12:47:42 +0000 |
| commit | 7822be3dc96ae2029e46c6f5fe295914bb4dfdf0 (patch) | |
| tree | 7c11d68cb215762c060037ed71d045d413c0c8c4 /source | |
| parent | 8a996d0fa8d6ea68c80e8c1e41f35dc924d04a07 (diff) | |
| download | qxmpp-7822be3dc96ae2029e46c6f5fe295914bb4dfdf0.tar.gz | |
prune dead XML RPC code
Diffstat (limited to 'source')
| -rw-r--r-- | source/xmlrpc.cpp | 82 | ||||
| -rw-r--r-- | source/xmlrpc.h | 20 |
2 files changed, 2 insertions, 100 deletions
diff --git a/source/xmlrpc.cpp b/source/xmlrpc.cpp index 5f650559..cfcaa2f9 100644 --- a/source/xmlrpc.cpp +++ b/source/xmlrpc.cpp @@ -12,13 +12,6 @@ XMLRPC::RequestMessage::RequestMessage( const QByteArray &method, const QList<QV m_args = args; } -XMLRPC::RequestMessage::RequestMessage( const QByteArray &method, const QVariant &arg ) -: MessageBase() -{ - m_method = method; - m_args.append(arg); -} - void XMLRPC::RequestMessage::writeXml( QXmlStreamWriter *writer ) const { writer->writeStartElement("methodCall"); @@ -38,19 +31,6 @@ void XMLRPC::RequestMessage::writeXml( QXmlStreamWriter *writer ) const } -QByteArray XMLRPC::RequestMessage::xml() const -{ - if( m_method.isEmpty() ) - return QByteArray(); - - QByteArray returnXML; - QXmlStreamWriter writer( &returnXML ); - writer.writeStartDocument(); - writeXml(&writer ); - writer.writeEndDocument(); - return returnXML; -} - void XMLRPC::MessageBase::marshall( QXmlStreamWriter *writer, const QVariant &value ) const { writer->writeStartElement("value"); @@ -350,52 +330,6 @@ XMLRPC::RequestMessage::RequestMessage( const QDomElement &element ) } } -XMLRPC::RequestMessage::RequestMessage( const QByteArray & xml ) -{ - QDomDocument message; - QString xmlErrMsg; - int xmlErrLine; - int xmlErrCol; - m_args.clear(); - m_method.clear(); - - if( message.setContent(xml, &xmlErrMsg, &xmlErrLine, &xmlErrCol) ) - { - const QDomElement methodCall = message.firstChildElement("methodCall"); - if( !methodCall.isNull() ) - { - const QDomElement methodName = methodCall.firstChildElement("methodName"); - if( !methodName.isNull() ) - { - m_method = methodName.text().toLatin1(); - } - else - { - setError("Missing methodName property."); - return; - } - - const QDomElement methodParams = methodCall.firstChildElement("params"); - if( !methodParams.isNull() ) - { - QDomNode param = methodParams.firstChild(); - while( !param.isNull() && isValid() ) - { - m_args.append( demarshall( param.firstChild().toElement() ) ); - param = param.nextSibling(); - } - } - } - else - setError("Not a valid methodCall message."); - } - else - { - setError(QString( "XML Error: %1 at row %2 and col %3") - .arg(xmlErrMsg).arg(xmlErrLine).arg(xmlErrCol)); - } -} - void XMLRPC::ResponseMessage::writeXml( QXmlStreamWriter *writer ) const { writer->writeStartElement("methodResponse"); @@ -414,22 +348,6 @@ void XMLRPC::ResponseMessage::writeXml( QXmlStreamWriter *writer ) const writer->writeEndElement(); } -QByteArray XMLRPC::ResponseMessage::xml( ) const -{ - QByteArray returnXML ; - QXmlStreamWriter writer(&returnXML); - writer.writeStartDocument(); - writeXml( &writer ); - writer.writeEndElement(); - writer.writeEndDocument(); - return returnXML; -} - -void XMLRPC::ResponseMessage::setValues( const QList< QVariant > vals ) -{ - m_values = vals; -} - XMLRPC::ResponseMessage::ResponseMessage( const QList< QVariant > & theValue ) : MessageBase(), m_values(theValue) { diff --git a/source/xmlrpc.h b/source/xmlrpc.h index ec70864b..f562ce23 100644 --- a/source/xmlrpc.h +++ b/source/xmlrpc.h @@ -83,38 +83,26 @@ private: class RequestMessage : public MessageBase { public: - RequestMessage( const QDomElement &element ); - /** - * Creates an RequestMessage from an XML packet. - */ - RequestMessage( const QByteArray &xml ); + 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 ); - /** - * Convinence ctor that creates a packet for a method with a single - * argument. - */ - RequestMessage( const QByteArray &method, const QVariant &arg ); - virtual ~RequestMessage() {;} /** * Return the xml representation of the packet. */ - QByteArray xml() const; void writeXml( QXmlStreamWriter *writer ) const; QByteArray method() const; QList< QVariant > args() const; - private: QByteArray m_method; QList<QVariant> m_args; - }; /** @@ -163,13 +151,9 @@ public: /** * Return the xml representation of the packet. */ - virtual QByteArray xml() const; void writeXml( QXmlStreamWriter *writer ) const; - QList< QVariant > values() const; -protected: - void setValues( const QList<QVariant> va2ls); private: QList<QVariant> m_values; |
