* [core] Introduce FileSourceManager and use it for default platform impl
- Add `FileSourceManager` interface that provides access to `FileSource`
instances and means of registering / unregistering `FileSource` factories
- Split `DefaultFileSource` into smaller parts
- Add `DatabaseFileSource` interface and it's default implementation
- Remove inter-dependencies between concrete `FileSource` classes
* [build] Add files to next build system
* [core] Add generic property setters / getters
* [core] Remove setOnlineStatus from OnlineFileSource interface
* [core] Hide threading implementation details from DatabaseFileSource interface
* [core] Make DB file source methods virtual
* [core] Add documentation for DatabaseFileSource and rename one method
* [core] Use simple callback instead of ActorRef
* [core] Remove ActorRef from OnlineFileSource public header
* [core] Add callback to FileSource::forward async API
* [core] Pass OfflineRegionDefinition by value
* [core] Update tests to use modular file sources
* [core] Update unit tests
* [core] Update unit tests after rebase
* [core] Backport low prio fix for cached requests
* [core] Backport pack database
* [core] Return removed factory from unRegisterFileSourceFactory
* [core] Rename shadowed args in onlinefilesource
* [core] Remove simple std::function callback aliases
* [core] Expose online file source property keys in public header file
* [test-runner] Add proxy file source test runner
* [cache] Update mbgl-cache utility to use new file source
* [metrics] Rebaseline binary size metrics
* [offline] Update offline utility
* [core] Update changelog
81 lines
2.1 KiB
C++
81 lines
2.1 KiB
C++
#include <mbgl/storage/resource_options.hpp>
|
|
#include <mbgl/util/constants.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
class ResourceOptions::Impl {
|
|
public:
|
|
std::string accessToken;
|
|
std::string baseURL = mbgl::util::API_BASE_URL;
|
|
std::string cachePath = ":memory:";
|
|
std::string assetPath = ".";
|
|
uint64_t maximumSize = mbgl::util::DEFAULT_MAX_CACHE_SIZE;
|
|
void* platformContext = nullptr;
|
|
};
|
|
|
|
// These requires the complete type of Impl.
|
|
ResourceOptions::ResourceOptions() : impl_(std::make_unique<Impl>()) {}
|
|
ResourceOptions::~ResourceOptions() = default;
|
|
ResourceOptions::ResourceOptions(ResourceOptions&&) noexcept = default;
|
|
ResourceOptions::ResourceOptions(const ResourceOptions& other) : impl_(std::make_unique<Impl>(*other.impl_)) {}
|
|
|
|
ResourceOptions ResourceOptions::clone() const {
|
|
return ResourceOptions(*this);
|
|
}
|
|
|
|
ResourceOptions& ResourceOptions::withAccessToken(std::string token) {
|
|
impl_->accessToken = std::move(token);
|
|
return *this;
|
|
}
|
|
|
|
const std::string& ResourceOptions::accessToken() const {
|
|
return impl_->accessToken;
|
|
}
|
|
|
|
ResourceOptions& ResourceOptions::withBaseURL(std::string url) {
|
|
impl_->baseURL = std::move(url);
|
|
return *this;
|
|
}
|
|
|
|
const std::string& ResourceOptions::baseURL() const {
|
|
return impl_->baseURL;
|
|
}
|
|
|
|
ResourceOptions& ResourceOptions::withCachePath(std::string path) {
|
|
impl_->cachePath = std::move(path);
|
|
return *this;
|
|
}
|
|
|
|
const std::string& ResourceOptions::cachePath() const {
|
|
return impl_->cachePath;
|
|
}
|
|
|
|
ResourceOptions& ResourceOptions::withAssetPath(std::string path) {
|
|
impl_->assetPath = std::move(path);
|
|
return *this;
|
|
}
|
|
|
|
const std::string& ResourceOptions::assetPath() const {
|
|
return impl_->assetPath;
|
|
}
|
|
|
|
ResourceOptions& ResourceOptions::withMaximumCacheSize(uint64_t size) {
|
|
impl_->maximumSize = size;
|
|
return *this;
|
|
}
|
|
|
|
uint64_t ResourceOptions::maximumCacheSize() const {
|
|
return impl_->maximumSize;
|
|
}
|
|
|
|
ResourceOptions& ResourceOptions::withPlatformContext(void* context) {
|
|
impl_->platformContext = context;
|
|
return *this;
|
|
}
|
|
|
|
void* ResourceOptions::platformContext() const {
|
|
return impl_->platformContext;
|
|
}
|
|
|
|
} // namespace mbgl
|