Commit 7a6ecf87 authored by Paweł Wegner's avatar Paweł Wegner

Added simplified getThumbnailAsync.

parent 0654a5b6
......@@ -110,6 +110,11 @@ ICloudProvider::DownloadFileRequest::Pointer MockProvider::downloadFileAsync(
return nullptr;
}
ICloudProvider::DownloadFileRequest::Pointer MockProvider::getThumbnailAsync(
IItem::Pointer, const std::string&, DownloadFileCallback) {
return nullptr;
}
ICloudProvider::UploadFileRequest::Pointer MockProvider::uploadFileAsync(
IItem::Pointer, const std::string&, UploadFileCallback) {
return nullptr;
......
......@@ -164,6 +164,9 @@ class MockProvider : public ICloudProvider {
DownloadFileRequest::Pointer downloadFileAsync(IItem::Pointer,
const std::string&,
DownloadFileCallback) override;
DownloadFileRequest::Pointer getThumbnailAsync(IItem::Pointer,
const std::string&,
DownloadFileCallback) override;
UploadFileRequest::Pointer uploadFileAsync(IItem::Pointer, const std::string&,
UploadFileCallback) override;
};
......
......@@ -355,6 +355,13 @@ ICloudProvider::DownloadFileRequest::Pointer CloudProvider::downloadFileAsync(
item, make_unique<::DownloadFileCallback>(filename, callback));
}
ICloudProvider::DownloadFileRequest::Pointer CloudProvider::getThumbnailAsync(
IItem::Pointer item, const std::string& filename,
GetThumbnailCallback callback) {
return getThumbnailAsync(
item, make_unique<::DownloadFileCallback>(filename, callback));
}
ICloudProvider::UploadFileRequest::Pointer CloudProvider::uploadFileAsync(
IItem::Pointer parent, const std::string& filename,
UploadFileCallback callback) {
......
......@@ -87,6 +87,9 @@ class CloudProvider : public ICloudProvider,
DownloadFileRequest::Pointer downloadFileAsync(IItem::Pointer item,
const std::string& filename,
DownloadFileCallback) override;
DownloadFileRequest::Pointer getThumbnailAsync(IItem::Pointer item,
const std::string& filename,
GetThumbnailCallback) override;
UploadFileRequest::Pointer uploadFileAsync(IItem::Pointer parent,
const std::string& filename,
UploadFileCallback) override;
......
......@@ -202,8 +202,9 @@ class ICloudProvider {
*
* @return object representing the pending request
*/
virtual GetItemRequest::Pointer getItemAsync(const std::string& absolute_path,
GetItemCallback callback) = 0;
virtual GetItemRequest::Pointer getItemAsync(
const std::string& absolute_path,
GetItemCallback callback = GetItemCallback()) = 0;
/**
* Downloads the item, the file is provided by callback.
......@@ -242,7 +243,8 @@ class ICloudProvider {
* @return object representing the pending request
*/
virtual GetItemDataRequest::Pointer getItemDataAsync(
const std::string& id, GetItemDataCallback callback) = 0;
const std::string& id,
GetItemDataCallback callback = GetItemDataCallback()) = 0;
/**
* Downloads thumbnail image, before calling the function, make sure provided
......@@ -265,7 +267,8 @@ class ICloudProvider {
* @return object representing the pending request
*/
virtual DeleteItemRequest::Pointer deleteItemAsync(
IItem::Pointer item, DeleteItemCallback callback) = 0;
IItem::Pointer item,
DeleteItemCallback callback = DeleteItemCallback()) = 0;
/**
* Creates directory in cloud provider.
......@@ -281,7 +284,7 @@ class ICloudProvider {
*/
virtual CreateDirectoryRequest::Pointer createDirectoryAsync(
IItem::Pointer parent, const std::string& name,
CreateDirectoryCallback callback) = 0;
CreateDirectoryCallback callback = CreateDirectoryCallback()) = 0;
/**
* Moves item.
......@@ -295,9 +298,9 @@ class ICloudProvider {
*
* @return object representing the pending request
*/
virtual MoveItemRequest::Pointer moveItemAsync(IItem::Pointer source,
IItem::Pointer destination,
MoveItemCallback callback) = 0;
virtual MoveItemRequest::Pointer moveItemAsync(
IItem::Pointer source, IItem::Pointer destination,
MoveItemCallback callback = MoveItemCallback()) = 0;
/**
* Renames item.
......@@ -313,7 +316,7 @@ class ICloudProvider {
*/
virtual RenameItemRequest::Pointer renameItemAsync(
IItem::Pointer item, const std::string& name,
RenameItemCallback callback) = 0;
RenameItemCallback callback = RenameItemCallback()) = 0;
/**
* Simplified version of listDirectoryAsync.
......@@ -323,7 +326,8 @@ class ICloudProvider {
* @return object representing the pending request
*/
virtual ListDirectoryRequest::Pointer listDirectoryAsync(
IItem::Pointer item, ListDirectoryCallback callback) = 0;
IItem::Pointer item,
ListDirectoryCallback callback = ListDirectoryCallback()) = 0;
/**
* Simplified version of downloadFileAsync.
......@@ -339,7 +343,23 @@ class ICloudProvider {
*/
virtual DownloadFileRequest::Pointer downloadFileAsync(
IItem::Pointer item, const std::string& filename,
DownloadFileCallback callback) = 0;
DownloadFileCallback callback = DownloadFileCallback()) = 0;
/**
* Simplified version of getThumbnailAsync.
*
* @param item
*
* @param filename name at which thumbnail will be saved
*
* @param callback called when done; if successful, it gets true, otherwise
* false
*
* @return object representing pending request
*/
virtual DownloadFileRequest::Pointer getThumbnailAsync(
IItem::Pointer item, const std::string& filename,
GetThumbnailCallback callback = GetThumbnailCallback()) = 0;
/**
* Simplified version of uploadFileAsync.
......@@ -355,7 +375,7 @@ class ICloudProvider {
*/
virtual UploadFileRequest::Pointer uploadFileAsync(
IItem::Pointer parent, const std::string& filename,
UploadFileCallback callback) = 0;
UploadFileCallback callback = UploadFileCallback()) = 0;
};
} // namespace cloudstorage
......
......@@ -179,6 +179,7 @@ using ListDirectoryCallback =
std::function<void(const std::vector<IItem::Pointer>&)>;
using DownloadFileCallback = std::function<void(bool)>;
using UploadFileCallback = std::function<void(bool)>;
using GetThumbnailCallback = std::function<void(bool)>;
} // namespace cloudstorage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment