diff options
Diffstat (limited to 'include/mbgl/util/filesource.hpp')
-rw-r--r-- | include/mbgl/util/filesource.hpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/mbgl/util/filesource.hpp b/include/mbgl/util/filesource.hpp new file mode 100644 index 0000000000..0d339cbac7 --- /dev/null +++ b/include/mbgl/util/filesource.hpp @@ -0,0 +1,45 @@ +#ifndef MBGL_UTIL_FILESOURCE +#define MBGL_UTIL_FILESOURCE + +#include <string> +#include <memory> +#include <functional> + +namespace uv { +class loop; +} + +namespace mbgl { + +namespace platform { +struct Response; +} + +enum class ResourceType : uint8_t { + Unknown, + Tile, + Glyphs, + Image, + JSON +}; + +class FileSource { +public: + FileSource(); + + void setBase(const std::string &value); + const std::string &getBase() const; + + void load(ResourceType type, const std::string &url, std::function<void(platform::Response *)> callback, const std::shared_ptr<uv::loop> loop = nullptr); + +private: + // Stores a URL that is used as a base for loading resources with relative path. + std::string base; + + // Stores the absolute path to the cache directory. + const std::string cache; +}; + +} + +#endif |