~pete-woods/storage-framework/cmake-extras-compatibility

« back to all changes in this revision

Viewing changes to src/qt/Uploader.cpp

  • Committer: Bileto Bot
  • Date: 2016-11-04 12:21:58 UTC
  • mfrom: (12.1.1 merge-devel)
  • Revision ID: ci-train-bot@canonical.com-20161104122158-hu8h9qyg3vm129t5
* Added v2 of the client-side API.
* Updated server-side API to tell the provider which metadata to return.
* Update provider API to manager ProviderBase class as a shared_ptr.
* Update client to discover ownCloud/Nextcloud and OneDrive accounts.
* Add match_etag argument to Download() D-Bus method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2016 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authors: Michi Henning <michi.henning@canonical.com>
 
17
 */
 
18
 
 
19
#include <unity/storage/qt/Uploader.h>
 
20
 
 
21
#include <unity/storage/qt/internal/UploaderImpl.h>
 
22
 
 
23
#include <cassert>
 
24
 
 
25
using namespace std;
 
26
 
 
27
namespace unity
 
28
{
 
29
namespace storage
 
30
{
 
31
namespace qt
 
32
{
 
33
 
 
34
Uploader::Uploader() = default;
 
35
 
 
36
Uploader::Uploader(unique_ptr<internal::UploaderImpl> p)
 
37
    : p_(move(p))
 
38
{
 
39
    assert(p_);
 
40
}
 
41
 
 
42
Uploader::~Uploader() = default;
 
43
 
 
44
bool Uploader::isValid() const
 
45
{
 
46
    return p_->isValid();
 
47
}
 
48
 
 
49
Uploader::Status Uploader::status() const
 
50
{
 
51
    return p_->status();
 
52
}
 
53
 
 
54
StorageError Uploader::error() const
 
55
{
 
56
    return p_->error();
 
57
}
 
58
 
 
59
Item::ConflictPolicy Uploader::policy() const
 
60
{
 
61
    return p_->policy();
 
62
}
 
63
 
 
64
qint64 Uploader::sizeInBytes() const
 
65
{
 
66
    return p_->sizeInBytes();
 
67
}
 
68
 
 
69
Item Uploader::item() const
 
70
{
 
71
    return p_->item();
 
72
}
 
73
 
 
74
void Uploader::cancel()
 
75
{
 
76
    p_->cancel();
 
77
}
 
78
 
 
79
void Uploader::close()
 
80
{
 
81
    p_->close();
 
82
}
 
83
 
 
84
qint64 Uploader::bytesAvailable() const
 
85
{
 
86
    return p_->bytesAvailable();
 
87
}
 
88
 
 
89
qint64 Uploader::bytesToWrite() const
 
90
{
 
91
    return p_->bytesToWrite();
 
92
}
 
93
 
 
94
bool Uploader::canReadLine() const
 
95
{
 
96
    return p_->canReadLine();
 
97
}
 
98
 
 
99
bool Uploader::isSequential() const
 
100
{
 
101
    return p_->isSequential();
 
102
}
 
103
 
 
104
bool Uploader::waitForBytesWritten(int msecs)
 
105
{
 
106
    return p_->waitForBytesWritten(msecs);
 
107
}
 
108
 
 
109
bool Uploader::waitForReadyRead(int msecs)
 
110
{
 
111
    return p_->waitForReadyRead(msecs);
 
112
}
 
113
 
 
114
// LCOV_EXCL_START
 
115
// Never called by QIODevice because device is opened write-only.
 
116
qint64 Uploader::readData(char* data, qint64 c)
 
117
{
 
118
    return p_->readData(data, c);
 
119
}
 
120
// LCOV_EXCL_STOP
 
121
 
 
122
qint64 Uploader::writeData(char const* data, qint64 c)
 
123
{
 
124
    return p_->writeData(data, c);
 
125
}
 
126
 
 
127
}  // namespace qt
 
128
}  // namespace storage
 
129
}  // namespace unity