diff options
Diffstat (limited to 'include/mbgl/storage/online_file_source.hpp')
-rw-r--r-- | include/mbgl/storage/online_file_source.hpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/include/mbgl/storage/online_file_source.hpp b/include/mbgl/storage/online_file_source.hpp index b2e9b43e5d..8969d21871 100644 --- a/include/mbgl/storage/online_file_source.hpp +++ b/include/mbgl/storage/online_file_source.hpp @@ -1,42 +1,46 @@ #pragma once -#include <mbgl/actor/actor_ref.hpp> #include <mbgl/storage/file_source.hpp> -#include <mbgl/util/constants.hpp> #include <mbgl/util/optional.hpp> namespace mbgl { class ResourceTransform; +// Properties that may be supported by online file sources. + +// Property name to set / get an access token. +// type: std::string +constexpr const char* ACCESS_TOKEN_KEY = "access-token"; + +// Property name to set / get base url. +// type: std::string +constexpr const char* API_BASE_URL_KEY = "api-base-url"; + +// Property name to set / get maximum number of concurrent requests. +// type: unsigned +constexpr const char* MAX_CONCURRENT_REQUESTS_KEY = "max-concurrent-requests"; + class OnlineFileSource : public FileSource { public: OnlineFileSource(); ~OnlineFileSource() override; - void setAPIBaseURL(const std::string& t) { apiBaseURL = t; } - std::string getAPIBaseURL() const { return apiBaseURL; } - - void setAccessToken(const std::string& t) { accessToken = t; } - std::string getAccessToken() const { return accessToken; } - - void setResourceTransform(optional<ActorRef<ResourceTransform>>&&); - + // FileSource overrides std::unique_ptr<AsyncRequest> request(const Resource&, Callback) override; + bool canRequest(const Resource&) const override; + void pause() override; + void resume() override; + void setProperty(const std::string&, const mapbox::base::Value&) override; + mapbox::base::Value getProperty(const std::string&) const override; - void setMaximumConcurrentRequests(uint32_t); - uint32_t getMaximumConcurrentRequests() const; - - // For testing only. - void setOnlineStatus(bool); + // OnlineFileSource interface. + // TODO: Would be nice to drop it to get uniform interface. + virtual void setResourceTransform(ResourceTransform); private: - friend class OnlineFileRequest; - class Impl; const std::unique_ptr<Impl> impl; - std::string accessToken; - std::string apiBaseURL = mbgl::util::API_BASE_URL; }; } // namespace mbgl |