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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef MBGL_STORAGE_RESOURCE
#define MBGL_STORAGE_RESOURCE
#include <mbgl/storage/response.hpp>
#include <mbgl/util/optional.hpp>
#include <string>
namespace mbgl {
class Resource {
public:
enum Kind : uint8_t {
Unknown = 0,
Style,
Source,
Tile,
Glyphs,
SpriteImage,
SpriteJSON
};
struct TileData {
std::string urlTemplate;
float pixelRatio;
int32_t x;
int32_t y;
int8_t z;
};
Resource(Kind kind_, const std::string& url_, optional<TileData> tileData_ = {})
: kind(kind_),
url(url_),
tileData(tileData_) {
}
static Resource style(const std::string& url);
static Resource source(const std::string& url);
static Resource tile(const std::string& urlTemplate,
float pixelRatio,
int32_t x,
int32_t y,
int8_t z);
static Resource glyphs(const std::string& urlTemplate,
const std::string& fontStack,
const std::pair<uint16_t, uint16_t>& glyphRange);
static Resource spriteImage(const std::string& base, float pixelRatio);
static Resource spriteJSON(const std::string& base, float pixelRatio);
const Kind kind;
const std::string url;
// Includes auxiliary data if this is a tile request.
optional<TileData> tileData;
optional<SystemTimePoint> priorModified = {};
optional<SystemTimePoint> priorExpires = {};
optional<std::string> priorEtag = {};
};
} // namespace mbgl
#endif
|