diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-15 12:36:15 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-21 11:22:11 -0800 |
commit | 1766d7dcbf9482ceac9bff37e0f7f5a4c60b9123 (patch) | |
tree | bf4674142fbfe581c4328dc04641fcaf6b44d133 /src/mbgl/storage | |
parent | 0a2e4af4c5d34a394fd6c32d771f2e8ae92a387c (diff) | |
download | qtlocation-mapboxgl-1766d7dcbf9482ceac9bff37e0f7f5a4c60b9123.tar.gz |
[core] Eliminate RequestBase
HTTPRequestBase can now itself be the base class.
Diffstat (limited to 'src/mbgl/storage')
-rw-r--r-- | src/mbgl/storage/http_context_base.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/storage/http_request_base.hpp | 20 | ||||
-rw-r--r-- | src/mbgl/storage/request_base.hpp | 34 |
3 files changed, 17 insertions, 40 deletions
diff --git a/src/mbgl/storage/http_context_base.hpp b/src/mbgl/storage/http_context_base.hpp index f2d15e2918..a1a3f5b597 100644 --- a/src/mbgl/storage/http_context_base.hpp +++ b/src/mbgl/storage/http_context_base.hpp @@ -1,7 +1,6 @@ #ifndef MBGL_STORAGE_HTTP_CONTEXT_BASE #define MBGL_STORAGE_HTTP_CONTEXT_BASE -#include <mbgl/storage/request_base.hpp> #include <mbgl/storage/http_request_base.hpp> #include <mbgl/storage/network_status.hpp> @@ -15,7 +14,7 @@ public: virtual ~HTTPContextBase() = default; virtual HTTPRequestBase* createRequest(const std::string& url, - RequestBase::Callback, + HTTPRequestBase::Callback, std::shared_ptr<const Response>) = 0; }; diff --git a/src/mbgl/storage/http_request_base.hpp b/src/mbgl/storage/http_request_base.hpp index a17284e782..8f1caf7bdc 100644 --- a/src/mbgl/storage/http_request_base.hpp +++ b/src/mbgl/storage/http_request_base.hpp @@ -1,24 +1,36 @@ #ifndef MBGL_STORAGE_HTTP_REQUEST_BASE #define MBGL_STORAGE_HTTP_REQUEST_BASE -#include <mbgl/storage/request_base.hpp> +#include <mbgl/util/noncopyable.hpp> #include <mbgl/util/chrono.hpp> +#include <memory> +#include <functional> +#include <utility> +#include <string> + namespace mbgl { - class HTTPRequestBase : public RequestBase { +class Response; + +class HTTPRequestBase : private util::noncopyable { public: + using Callback = std::function<void (std::shared_ptr<const Response> response)>; + HTTPRequestBase(const std::string& url_, Callback notify_) - : RequestBase(url_, notify_) + : url(url_) + , notify(std::move(notify_)) , cancelled(false) { } virtual ~HTTPRequestBase() = default; - virtual void cancel() override { cancelled = true; }; + virtual void cancel() { cancelled = true; }; protected: static Seconds parseCacheControl(const char *value); + std::string url; + Callback notify; bool cancelled; }; diff --git a/src/mbgl/storage/request_base.hpp b/src/mbgl/storage/request_base.hpp deleted file mode 100644 index e3d33571d4..0000000000 --- a/src/mbgl/storage/request_base.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef MBGL_STORAGE_REQUEST_BASE -#define MBGL_STORAGE_REQUEST_BASE - -#include <mbgl/util/noncopyable.hpp> - -#include <memory> -#include <functional> -#include <utility> -#include <string> - -namespace mbgl { - -class Response; - -class RequestBase : private util::noncopyable { -public: - using Callback = std::function<void (std::shared_ptr<const Response> response)>; - - RequestBase(const std::string& url_, Callback notify_) - : url(url_) - , notify(std::move(notify_)) { - } - - virtual ~RequestBase() = default; - virtual void cancel() = 0; - -protected: - std::string url; - Callback notify; -}; - -} // namespace mbgl - -#endif // MBGL_STORAGE_REQUEST_BASE |