blob: 37a0b4d09140b3fb9cb5f3c4b53081007177e67a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#ifndef MBGL_STORAGE_HTTP_REQUEST_BASE
#define MBGL_STORAGE_HTTP_REQUEST_BASE
#include <mbgl/storage/response.hpp>
#include <mbgl/storage/resource.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/optional.hpp>
#include <functional>
namespace mbgl {
class Response;
class HTTPRequestBase : private util::noncopyable {
public:
using Callback = std::function<void (Response)>;
HTTPRequestBase(const Resource& resource_, Callback notify_)
: resource(resource_)
, notify(std::move(notify_))
, cancelled(false) {
}
virtual ~HTTPRequestBase() = default;
virtual void cancel() { cancelled = true; };
protected:
static optional<SystemTimePoint> parseCacheControl(const char *value);
Resource resource;
Callback notify;
bool cancelled;
};
} // namespace mbgl
#endif // MBGL_STORAGE_HTTP_REQUEST_BASE
|