1 | #pragma once |
---|---|
2 | |
3 | #include <mbgl/actor/actor_ref.hpp> |
4 | #include <mbgl/storage/file_source.hpp> |
5 | #include <mbgl/util/constants.hpp> |
6 | #include <mbgl/util/optional.hpp> |
7 | |
8 | namespace mbgl { |
9 | |
10 | class ResourceTransform; |
11 | |
12 | class OnlineFileSource : public FileSource { |
13 | public: |
14 | OnlineFileSource(); |
15 | ~OnlineFileSource() override; |
16 | |
17 | void setAPIBaseURL(const std::string& t) { apiBaseURL = t; } |
18 | std::string getAPIBaseURL() const { return apiBaseURL; } |
19 | |
20 | void setAccessToken(const std::string& t) { accessToken = t; } |
21 | std::string getAccessToken() const { return accessToken; } |
22 | |
23 | void setResourceTransform(optional<ActorRef<ResourceTransform>>&&); |
24 | |
25 | std::unique_ptr<AsyncRequest> request(const Resource&, Callback) override; |
26 | |
27 | // For testing only. |
28 | void setOnlineStatus(bool); |
29 | |
30 | private: |
31 | friend class OnlineFileRequest; |
32 | |
33 | class Impl; |
34 | const std::unique_ptr<Impl> impl; |
35 | std::string accessToken; |
36 | std::string apiBaseURL = mbgl::util::API_BASE_URL; |
37 | }; |
38 | |
39 | } // namespace mbgl |
40 |