aboutsummaryrefslogtreecommitdiff
path: root/source/xmlrpc.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 14:36:32 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 14:36:32 +0000
commit195afc0e0159c8ed89c4b374a9d9ba6aacfddc6b (patch)
tree5a909ada7e8d79a6252934d811c4dcd9d1b5ab11 /source/xmlrpc.cpp
parent47f2f46a5e390ffe15070a415df7f194b498abd9 (diff)
downloadqxmpp-195afc0e0159c8ed89c4b374a9d9ba6aacfddc6b.tar.gz
rework internal XML RPC APIs
Diffstat (limited to 'source/xmlrpc.cpp')
-rw-r--r--source/xmlrpc.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/source/xmlrpc.cpp b/source/xmlrpc.cpp
index 82830c46..3db63f0d 100644
--- a/source/xmlrpc.cpp
+++ b/source/xmlrpc.cpp
@@ -37,8 +37,8 @@ static void marshall( QXmlStreamWriter *writer, const QVariant &value)
{
writer->writeStartElement("array");
writer->writeStartElement("data");
- foreach( QVariant item, value.toList() )
- marshall( writer, item );
+ foreach(const QVariant &item, value.toList())
+ marshall(writer, item);
writer->writeEndElement();
writer->writeEndElement();
break;
@@ -119,7 +119,7 @@ static QVariant demarshall(const QDomElement &elem, QStringList &errors)
return QVariant( QDateTime::fromString( typeData.text(), Qt::ISODate ) );
else if( typeName == "array" )
{
- QList<QVariant> arr;
+ QVariantList arr;
QDomNode valueNode = typeData.firstChild().firstChild();
while (!valueNode.isNull() && errors.isEmpty())
{
@@ -160,11 +160,6 @@ static QVariant demarshall(const QDomElement &elem, QStringList &errors)
return QVariant();
}
-XMLRPC::RequestMessage::RequestMessage(const QByteArray &method, const QList<QVariant> &args)
- : m_method(method), m_args(args)
-{
-}
-
bool XMLRPC::RequestMessage::parse(const QDomElement &element)
{
QStringList errors;
@@ -199,16 +194,26 @@ bool XMLRPC::RequestMessage::parse(const QDomElement &element)
return true;
}
-QList< QVariant > XMLRPC::RequestMessage::args() const
+QVariantList XMLRPC::RequestMessage::arguments() const
{
return m_args;
}
+void XMLRPC::RequestMessage::setArguments(const QVariantList &args)
+{
+ m_args = args;
+}
+
QByteArray XMLRPC::RequestMessage::method() const
{
return m_method;
}
+void XMLRPC::RequestMessage::setMethod(const QByteArray &method)
+{
+ m_method = method;
+}
+
void XMLRPC::RequestMessage::writeXml( QXmlStreamWriter *writer ) const
{
writer->writeStartElement("methodCall");
@@ -216,10 +221,10 @@ void XMLRPC::RequestMessage::writeXml( QXmlStreamWriter *writer ) const
if( !m_args.isEmpty() )
{
writer->writeStartElement("params");
- foreach( QVariant arg, m_args)
+ foreach(const QVariant &arg, m_args)
{
writer->writeStartElement("param");
- marshall( writer, arg );
+ marshall(writer, arg);
writer->writeEndElement();
}
writer->writeEndElement();
@@ -227,11 +232,6 @@ void XMLRPC::RequestMessage::writeXml( QXmlStreamWriter *writer ) const
writer->writeEndElement();
}
-XMLRPC::ResponseMessage::ResponseMessage( const QList< QVariant > & theValue )
- : m_values(theValue)
-{
-}
-
bool XMLRPC::ResponseMessage::parse(const QDomElement &element)
{
QStringList errors;
@@ -266,11 +266,16 @@ bool XMLRPC::ResponseMessage::parse(const QDomElement &element)
}
}
-QList< QVariant > XMLRPC::ResponseMessage::values() const
+QVariantList XMLRPC::ResponseMessage::values() const
{
return m_values;
}
+void XMLRPC::ResponseMessage::setValues(const QVariantList &values)
+{
+ m_values = values;
+}
+
void XMLRPC::ResponseMessage::writeXml( QXmlStreamWriter *writer ) const
{
writer->writeStartElement("methodResponse");
@@ -278,10 +283,10 @@ void XMLRPC::ResponseMessage::writeXml( QXmlStreamWriter *writer ) const
if( !m_values.isEmpty() )
{
writer->writeStartElement("params");
- foreach( QVariant arg, m_values)
+ foreach (const QVariant &arg, m_values)
{
writer->writeStartElement("param");
- marshall( writer, arg );
+ marshall(writer, arg);
writer->writeEndElement();
}
writer->writeEndElement();