1/******************************************************************************
2 * Copyright (C) 2003 - 2004 by Frerich Raabe <raabe@kde.org> *
3 * Tobias Koenig <tokoe@kde.org> *
4 * Copyright (C) 2006 by Narayan Newton <narayannewton@gmail.com> *
5 * *
6 * This program is distributed in the hope that it will be useful, but *
7 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
8 * or FITNESS FOR A PARTICULAR PURPOSE. For licensing and distribution *
9 * details, check the accompanying file 'COPYING.BSD'. *
10 *****************************************************************************/
11/**
12 @file
13
14 This file is part of KXmlRpc and defines our internal classes.
15
16 @author Frerich Raabe <raabe@kde.org>
17 @author Tobias Koenig <tokoe@kde.org>
18 @author Narayan Newton <narayannewton@gmail.com>
19*/
20
21#ifndef KXML_RPC_QUERY_H
22#define KXML_RPC_QUERY_H
23
24#include "kxmlrpcclient_export.h"
25
26#include <QtCore/QList>
27#include <QtCore/QObject>
28#include <QtCore/QVariant>
29#include <QtCore/QMap>
30#include <kio/job.h>
31
32class QString;
33
34/** Namespace for XmlRpc related classes */
35namespace KXmlRpc {
36
37/**
38 @brief
39 Query is a class that represents an individual XML-RPC call.
40
41 This is an internal class and is only used by the KXmlRpc::Client class.
42 @internal
43 */
44class KXMLRPCCLIENT_EXPORT Query : public QObject
45{
46 friend class Result;
47 Q_OBJECT
48
49 public:
50 /**
51 Constructs a query.
52
53 @param id an optional id for the query.
54 @param parent an optional parent for the query.
55 */
56 static Query *create( const QVariant &id = QVariant(), QObject *parent = 0 );
57
58 public Q_SLOTS:
59 /**
60 Calls the specified method on the specified server with
61 the given argument list.
62
63 @param server the server to contact.
64 @param method the method to call.
65 @param args an argument list to pass to said method.
66 @param jobMetaData additional arguments to pass to the KIO::Job.
67 */
68 void call( const QString &server, const QString &method,
69 const QList<QVariant> &args,
70 const QMap<QString, QString> &jobMetaData );
71
72 Q_SIGNALS:
73 /**
74 A signal sent when we receive a result from the server.
75 */
76 void message( const QList<QVariant> &result, const QVariant &id );
77
78 /**
79 A signal sent when we receive an error from the server.
80 */
81 void fault( int, const QString &, const QVariant &id );
82
83 /**
84 A signal sent when a query finishes.
85 */
86 void finished( Query * );
87
88 private:
89 explicit Query( const QVariant &id, QObject *parent = 0 );
90 ~Query();
91
92 class Private;
93 Private *const d;
94
95 Q_PRIVATE_SLOT( d, void slotData( KIO::Job *, const QByteArray & ) )
96 Q_PRIVATE_SLOT( d, void slotResult( KJob * ) )
97};
98
99} // namespace XmlRpc
100
101#endif
102
103