summaryrefslogtreecommitdiff
path: root/include/mbgl/storage/file_source.hpp
blob: a53bf31c2cb36217a5dd589b9ed2d0c2759fb255 (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
#ifndef MBGL_STORAGE_FILE_SOURCE
#define MBGL_STORAGE_FILE_SOURCE

#include "response.hpp"
#include "resource.hpp"

#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/util.hpp>

#include <functional>

namespace mbgl {

class Request;

class FileSource : private util::noncopyable {
protected:
    MBGL_STORE_THREAD(tid)

public:
    virtual ~FileSource() = default;

    using Callback = std::function<void(const Response &)>;

    // These can be called from any thread. The callback will be invoked in the loop.
    // You can only cancel a request from the same thread it was created in.
    virtual Request* request(const Resource&, Callback) = 0;
    virtual void cancel(Request*) = 0;
};

}

#endif