Commit 812ed8a6 authored by Paweł Wegner's avatar Paweł Wegner
Browse files

Removed IItem::is_directory.

parent e9d3133f
......@@ -64,7 +64,7 @@ ICloudProvider::GetItemDataRequest::Pointer Dropbox::getItemDataAsync(
Json::Value response;
output >> response;
auto item = toItem(response);
if (item->is_directory()) return item;
if (item->type() == IItem::FileType::Directory) return item;
auto temporary_link = [r, id](std::ostream& input) {
auto request = make_unique<HttpRequest>(
"https://api.dropboxapi.com/2/files/get_temporary_link",
......
......@@ -38,8 +38,6 @@ class IItem {
virtual ~IItem() = default;
virtual std::string filename() const = 0;
virtual bool is_directory() const = 0;
virtual std::string id() const = 0;
virtual std::string url() const = 0;
virtual bool is_hidden() const = 0;
......
......@@ -40,7 +40,7 @@ GetItemRequest::GetItemRequest(std::shared_ptr<CloudProvider> p,
std::stringstream stream(path_.substr(1));
std::string token;
while (std::getline(stream, token, '/')) {
if (!node || !node->is_directory()) {
if (!node || node->type() != IItem::FileType::Directory) {
node = nullptr;
break;
}
......
......@@ -39,8 +39,6 @@ std::string Item::filename() const { return filename_; }
std::string Item::id() const { return id_; }
bool Item::is_directory() const { return type() == FileType::Directory; }
std::string Item::url() const { return url_; }
void Item::set_url(std::string url) { url_ = url; }
......
......@@ -37,7 +37,6 @@ class Item : public IItem {
std::string filename() const;
std::string id() const;
bool is_directory() const;
std::string url() const;
void set_url(std::string);
......
......@@ -54,11 +54,13 @@ class Callback : public cloudstorage::ICloudProvider::ICallback {
void traverse_drive(cloudstorage::ICloudProvider& drive,
cloudstorage::IItem::Pointer f, std::string path) {
std::cout << path << "\n";
if (!f->is_directory()) return;
if (f->type() != cloudstorage::IItem::FileType::Directory) return;
for (cloudstorage::IItem::Pointer& t :
drive.listDirectoryAsync(f, nullptr)->result()) {
traverse_drive(drive, std::move(t),
path + t->filename() + (t->is_directory() ? "/" : ""));
traverse_drive(
drive, std::move(t),
path + t->filename() +
(t->type() == cloudstorage::IItem::FileType::Directory ? "/" : ""));
}
}
......
Supports Markdown
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