From 827c7e43da118f12ae614530340a566a23c42746 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Sat, 28 May 2016 01:08:51 +0600 Subject: CLOUD: Add OneDriveListDirectoryRequest Works as charm. --- .../cloud/onedrive/onedrivelistdirectoryrequest.h | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 backends/cloud/onedrive/onedrivelistdirectoryrequest.h (limited to 'backends/cloud/onedrive/onedrivelistdirectoryrequest.h') diff --git a/backends/cloud/onedrive/onedrivelistdirectoryrequest.h b/backends/cloud/onedrive/onedrivelistdirectoryrequest.h new file mode 100644 index 0000000000..61eebb2669 --- /dev/null +++ b/backends/cloud/onedrive/onedrivelistdirectoryrequest.h @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine +* +* ScummVM is the legal property of its developers, whose names +* are too numerous to list here. Please refer to the COPYRIGHT +* file distributed with this source distribution. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU 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 General Public License for more details. +* +* You should have received a copy of the GNU 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 BACKENDS_CLOUD_ONEDRIVE_ONEDRIVELISTDIRECTORYREQUEST_H +#define BACKENDS_CLOUD_ONEDRIVE_ONEDRIVELISTDIRECTORYREQUEST_H + +#include "backends/cloud/storage.h" +#include "backends/networking/curl/curljsonrequest.h" +#include "backends/networking/curl/request.h" +#include "common/callback.h" + +namespace Cloud { +namespace OneDrive { + +class OneDriveStorage; + +class OneDriveListDirectoryRequest: public Networking::Request { + Common::String _requestedPath; + bool _requestedRecursive; + OneDriveStorage *_storage; + Storage::FileArrayCallback _filesCallback; + Common::Array _files; + Common::Array _directoriesQueue; + Common::String _currentDirectory; + Request *_workingRequest; + bool _ignoreCallback; + + void start(); + void listNextDirectory(); + void listedDirectoryCallback(Networking::JsonResponse pair); + void makeRequest(Common::String url); + void finishFiles(Common::Array &files); +public: + OneDriveListDirectoryRequest(OneDriveStorage *storage, Common::String path, Storage::FileArrayCallback cb, bool recursive = false); + virtual ~OneDriveListDirectoryRequest() { delete _filesCallback; } + + virtual void handle() {} + virtual void restart() { start(); } + virtual void finish(); +}; + +} //end of namespace OneDrive +} //end of namespace Cloud + +#endif -- cgit v1.2.3