summaryrefslogtreecommitdiff
path: root/include/mbgl/storage/resource.hpp
blob: 1bbd90ea3783eee972cd843d206bba2ef50a9130 (plain)
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
#ifndef MBGL_STORAGE_RESOURCE
#define MBGL_STORAGE_RESOURCE

#include <string>
#include <functional>

namespace mbgl {

struct Resource {
    enum Kind : uint8_t {
        Unknown = 0,
        Style,
        Source,
        Tile,
        Glyphs,
        SpriteImage,
        SpriteJSON
    };

    const Kind kind;
    const std::string url;

    inline bool operator==(const Resource &res) const {
        return kind == res.kind && url == res.url;
    }

    struct Hash {
        std::size_t operator()(Resource const& r) const {
            return std::hash<std::string>()(r.url) ^ (std::hash<uint8_t>()(r.kind) << 1);
        }
    };

};

} // namespace mbgl

#endif