~ubuntu-branches/ubuntu/vivid/unity-scope-click/vivid-proposed

« back to all changes in this revision

Viewing changes to scope/click/webclient.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-02-13 17:04:58 UTC
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: package-import@ubuntu.com-20140213170458-5lpiuiaom3aqglma
Tags: upstream-0.1+14.04.20140213.2
ImportĀ upstreamĀ versionĀ 0.1+14.04.20140213.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2014 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as published
 
6
 * by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * In addition, as a special exception, the copyright holders give
 
17
 * permission to link the code of portions of this program with the
 
18
 * OpenSSL library under certain conditions as described in each
 
19
 * individual source file, and distribute linked combinations
 
20
 * including the two.
 
21
 * You must obey the GNU General Public License in all respects
 
22
 * for all of the code used other than OpenSSL.  If you modify
 
23
 * file(s) with this exception, you may extend this exception to your
 
24
 * version of the file(s), but you are not obligated to do so.  If you
 
25
 * do not wish to do so, delete this exception statement from your
 
26
 * version.  If you delete this exception statement from all source
 
27
 * files in the program, then also delete it here.
 
28
 */
 
29
 
 
30
#ifndef CLICK_WEBCLIENT_H
 
31
#define CLICK_WEBCLIENT_H
 
32
 
 
33
#include <QObject>
 
34
#include <QNetworkReply>
 
35
#include <QNetworkRequest>
 
36
#include <QSharedPointer>
 
37
#include <QUrlQuery>
 
38
 
 
39
namespace click
 
40
{
 
41
namespace network
 
42
{
 
43
class AccessManager;
 
44
class Reply;
 
45
}
 
46
namespace web
 
47
{
 
48
class Service;
 
49
 
 
50
class CallParams
 
51
{
 
52
    QUrlQuery query;
 
53
    friend class Service;
 
54
public:
 
55
    void add(const std::string& key, const std::string& value);
 
56
    bool operator==(const CallParams &other) const;
 
57
};
 
58
 
 
59
class Response : public QObject
 
60
{
 
61
    Q_OBJECT
 
62
 
 
63
public:
 
64
    Response(const QSharedPointer<click::network::Reply>& reply, QObject* parent=0);
 
65
    virtual ~Response();
 
66
 
 
67
public slots:
 
68
    void replyFinished();
 
69
 
 
70
signals:
 
71
    void finished(QString result);
 
72
 
 
73
private:
 
74
    QSharedPointer<click::network::Reply> reply;
 
75
};
 
76
 
 
77
class Service
 
78
{
 
79
public:
 
80
    Service(const std::string& base,
 
81
            const QSharedPointer<click::network::AccessManager>& networkAccessManager);
 
82
    virtual ~Service();
 
83
 
 
84
    virtual QSharedPointer<Response> call(const std::string& path, const CallParams& params = CallParams());
 
85
private:
 
86
    struct Private;
 
87
    QScopedPointer<Private> impl;
 
88
};
 
89
}
 
90
}
 
91
 
 
92
#endif // CLICK_WEBCLIENT_H