~xavi-garcia-mena/storage-provider-webdav/base-url-host-fix

« back to all changes in this revision

Viewing changes to src/DavProvider.cpp

  • Committer: James Henstridge
  • Date: 2016-11-16 02:07:50 UTC
  • mfrom: (16.1.2 sf-0.2-compat)
  • Revision ID: james@jamesh.id.au-20161116020750-78a0agoyqb1j597m
Update provider so that it compiles with storage-framework 0.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include <QNetworkAccessManager>
16
16
#include <QNetworkReply>
17
17
#include <QNetworkRequest>
 
18
#include <unity/storage/common.h>
18
19
#include <unity/storage/provider/Exceptions.h>
19
 
#include <unity/storage/provider/metadata_keys.h>
20
20
 
21
21
using namespace std;
22
22
using namespace unity::storage::provider;
 
23
using namespace unity::storage::metadata;
23
24
using unity::storage::ItemType;
24
25
 
25
26
DavProvider::DavProvider()
29
30
 
30
31
DavProvider::~DavProvider() = default;
31
32
 
32
 
boost::future<ItemList> DavProvider::roots(Context const& ctx)
 
33
boost::future<ItemList> DavProvider::roots(
 
34
    vector<string> const& metadata_keys, Context const& ctx)
33
35
{
 
36
    Q_UNUSED(metadata_keys);
34
37
    auto handler = new RootsHandler(*this, ctx);
35
38
    return handler->get_future();
36
39
}
37
40
 
38
41
boost::future<tuple<ItemList,string>> DavProvider::list(
39
 
    string const& item_id, string const& page_token, Context const& ctx)
 
42
    string const& item_id, string const& page_token,
 
43
    vector<string> const& metadata_keys, Context const& ctx)
40
44
{
 
45
    Q_UNUSED(metadata_keys);
41
46
    if (!page_token.empty())
42
47
    {
43
48
        throw InvalidArgumentException("Invalid paging token: " + page_token);
47
52
}
48
53
 
49
54
boost::future<ItemList> DavProvider::lookup(
50
 
    string const& parent_id, string const& name, Context const& ctx)
 
55
    string const& parent_id, string const& name,
 
56
    vector<string> const& metadata_keys, Context const& ctx)
51
57
{
 
58
    Q_UNUSED(metadata_keys);
52
59
    string item_id = make_child_id(parent_id, name);
53
60
    auto handler = new LookupHandler(*this, item_id, ctx);
54
61
    return handler->get_future();
55
62
}
56
63
 
57
64
boost::future<Item> DavProvider::metadata(
58
 
    string const& item_id, Context const& ctx)
 
65
    string const& item_id, vector<string> const& metadata_keys,
 
66
    Context const& ctx)
59
67
{
 
68
    Q_UNUSED(metadata_keys);
60
69
    auto handler = new MetadataHandler(*this, item_id, ctx);
61
70
    return handler->get_future();
62
71
}
63
72
 
64
73
boost::future<Item> DavProvider::create_folder(
65
 
    string const& parent_id, string const& name, Context const& ctx)
 
74
    string const& parent_id, string const& name,
 
75
    vector<string> const& metadata_keys, Context const& ctx)
66
76
{
 
77
    Q_UNUSED(metadata_keys);
67
78
    auto handler = new CreateFolderHandler(*this, parent_id, name, ctx);
68
79
    return handler->get_future();
69
80
}
70
81
 
71
82
boost::future<unique_ptr<UploadJob>> DavProvider::create_file(
72
83
    string const& parent_id, string const& name, int64_t size,
73
 
    string const& content_type, bool allow_overwrite, Context const& ctx)
 
84
    string const& content_type, bool allow_overwrite,
 
85
    vector<string> const& metadata_keys, Context const& ctx)
74
86
{
 
87
    Q_UNUSED(metadata_keys);
75
88
    string item_id = make_child_id(parent_id, name);
76
89
    boost::promise<unique_ptr<UploadJob>> p;
77
90
    p.set_value(unique_ptr<UploadJob>(new DavUploadJob(
81
94
 
82
95
boost::future<unique_ptr<UploadJob>> DavProvider::update(
83
96
    string const& item_id, int64_t size, string const& old_etag,
84
 
    Context const& ctx)
 
97
    vector<string> const& metadata_keys, Context const& ctx)
85
98
{
 
99
    Q_UNUSED(metadata_keys);
86
100
    boost::promise<unique_ptr<UploadJob>> p;
87
101
    p.set_value(unique_ptr<UploadJob>(new DavUploadJob(
88
102
        *this, item_id, size, string(), true, old_etag, ctx)));
90
104
}
91
105
 
92
106
boost::future<unique_ptr<DownloadJob>> DavProvider::download(
93
 
    string const& item_id, Context const& ctx)
 
107
    string const& item_id, string const& match_etag, Context const& ctx)
94
108
{
95
109
    boost::promise<unique_ptr<DownloadJob>> p;
96
110
    p.set_value(unique_ptr<DownloadJob>(new DavDownloadJob(
97
 
        *this, item_id, string(), ctx)));
 
111
        *this, item_id, match_etag, ctx)));
98
112
    return p.get_future();
99
113
}
100
114
 
107
121
 
108
122
boost::future<Item> DavProvider::move(
109
123
    string const& item_id, string const& new_parent_id, string const& new_name,
110
 
    Context const& ctx)
 
124
    vector<string> const& metadata_keys, Context const& ctx)
111
125
{
112
126
}
113
127
 
114
128
boost::future<Item> DavProvider::copy(
115
129
    string const& item_id, string const& new_parent_id, string const& new_name,
116
 
    Context const& ctx)
 
130
    vector<string> const& metadata_keys, Context const& ctx)
117
131
{
118
132
}
119
133