~mzanetti/+junk/swp-scope-with-aggregator-keyword

« back to all changes in this revision

Viewing changes to include/api/client.h

  • Committer: Michael Zanetti
  • Date: 2015-05-11 09:12:07 UTC
  • Revision ID: michael.zanetti@canonical.com-20150511091207-nx5edv19k7565cv6
simplify it a lot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef API_CLIENT_H_
2
 
#define API_CLIENT_H_
3
 
 
4
 
#include <api/config.h>
5
 
 
6
 
#include <atomic>
7
 
#include <deque>
8
 
#include <map>
9
 
#include <string>
10
 
#include <core/net/http/request.h>
11
 
#include <core/net/uri.h>
12
 
 
13
 
#include <QXmlStreamReader>
14
 
#include <QDateTime>
15
 
 
16
 
namespace api {
17
 
 
18
 
class Client {
19
 
public:
20
 
    Client();
21
 
 
22
 
    virtual ~Client() = default;
23
 
 
24
 
    struct NewsItem {
25
 
        QString title;
26
 
        QString description;
27
 
        QString image;
28
 
        QString link;
29
 
        QString category;
30
 
        QDateTime date;
31
 
    };
32
 
 
33
 
    typedef QList<NewsItem> NewsList;
34
 
 
35
 
    NewsList allNews(const std::string &prefix, const std::string &department, const std::string &query);
36
 
    void cancel();
37
 
 
38
 
protected:
39
 
    void getSpiegelFeed(const std::string &path, QXmlStreamReader &reader);
40
 
 
41
 
    core::net::http::Request::Progress::Next progress_report(
42
 
            const core::net::http::Request::Progress& progress);
43
 
 
44
 
    std::atomic<bool> cancelled_;
45
 
};
46
 
 
47
 
}
48
 
 
49
 
#endif // API_CLIENT_H_
50