Commit 6d80c8ff authored by Paweł Wegner's avatar Paweł Wegner

Added RenameItemRequest placeholder.

parent 1d28b22f
......@@ -36,6 +36,7 @@
#include "Request/GetItemRequest.h"
#include "Request/ListDirectoryRequest.h"
#include "Request/MoveItemRequest.h"
#include "Request/RenameItemRequest.h"
#include "Request/UploadFileRequest.h"
using namespace std::placeholders;
......@@ -200,6 +201,12 @@ ICloudProvider::MoveItemRequest::Pointer CloudProvider::moveItemAsync(
destination, callback);
}
ICloudProvider::RenameItemRequest::Pointer CloudProvider::renameItemAsync(
IItem::Pointer item, const std::string& name, RenameItemCallback callback) {
return make_unique<cloudstorage::RenameItemRequest>(shared_from_this(), item,
name, callback);
}
HttpRequest::Pointer CloudProvider::getItemDataRequest(const std::string&,
std::ostream&) const {
return nullptr;
......
......@@ -78,6 +78,9 @@ class CloudProvider : public ICloudProvider,
MoveItemRequest::Pointer moveItemAsync(IItem::Pointer source,
IItem::Pointer destination,
MoveItemCallback);
RenameItemRequest::Pointer renameItemAsync(IItem::Pointer item,
const std::string&,
RenameItemCallback);
virtual HttpRequest::Pointer getItemDataRequest(
const std::string& id, std::ostream& input_stream) const;
......
......@@ -47,6 +47,7 @@ class ICloudProvider {
using DeleteItemRequest = IRequest<bool>;
using CreateDirectoryRequest = IRequest<IItem::Pointer>;
using MoveItemRequest = IRequest<bool>;
using RenameItemRequest = IRequest<bool>;
class ICallback {
public:
......@@ -93,6 +94,9 @@ class ICloudProvider {
virtual MoveItemRequest::Pointer moveItemAsync(IItem::Pointer source,
IItem::Pointer destination,
MoveItemCallback) = 0;
virtual RenameItemRequest::Pointer renameItemAsync(IItem::Pointer item,
const std::string& name,
RenameItemCallback) = 0;
};
} // namespace cloudstorage
......
......@@ -85,6 +85,7 @@ using GetItemDataCallback = std::function<void(IItem::Pointer)>;
using DeleteItemCallback = std::function<void(bool)>;
using CreateDirectoryCallback = std::function<void(IItem::Pointer)>;
using MoveItemCallback = std::function<void(bool)>;
using RenameItemCallback = std::function<void(bool)>;
} // namespace cloudstorage
......
......@@ -36,7 +36,8 @@ libcloudstorage_la_SOURCES = \
Request/GetItemDataRequest.cpp \
Request/DeleteItemRequest.cpp \
Request/CreateDirectoryRequest.cpp \
Request/MoveItemRequest.cpp
Request/MoveItemRequest.cpp \
Request/RenameItemRequest.cpp
noinst_HEADERS = \
IAuth.h \
......@@ -63,7 +64,8 @@ noinst_HEADERS = \
Request/UploadFileRequest.h \
Request/DeleteItemRequest.h \
Request/CreateDirectoryRequest.h \
Request/MoveItemRequest.h
Request/MoveItemRequest.h \
Request/RenameItemRequest.h
nobase_include_HEADERS = \
IItem.h \
......
/*****************************************************************************
* RenameItemRequest.cpp : RenameItemRequest implementation
*
*****************************************************************************
* Copyright (C) 2016-2016 VideoLAN
*
* Authors: Paweł Wegner <pawel.wegner95@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "RenameItemRequest.h"
namespace cloudstorage {
RenameItemRequest::RenameItemRequest(std::shared_ptr<CloudProvider> p,
IItem::Pointer item,
const std::string& name,
RenameItemCallback callback)
: Request(p) {
set_resolver([=](Request*) {
callback(false);
return false;
});
}
RenameItemRequest::~RenameItemRequest() { cancel(); }
} // namespace cloudstorage
/*****************************************************************************
* RenameItemRequest.h : RenameItemRequest headers
*
*****************************************************************************
* Copyright (C) 2016-2016 VideoLAN
*
* Authors: Paweł Wegner <pawel.wegner95@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef RENAMEITEMREQUEST_H
#define RENAMEITEMREQUEST_H
#include "Request.h"
namespace cloudstorage {
class RenameItemRequest : public Request<bool> {
public:
RenameItemRequest(std::shared_ptr<CloudProvider>, IItem::Pointer,
const std::string&, RenameItemCallback);
~RenameItemRequest();
};
} // namespace cloudstorage
#endif // RENAMEITEMREQUEST_H
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