summaryrefslogtreecommitdiff
path: root/include/mbgl/style/expression/image.hpp
blob: 0bc4794a2420e9b7587127f55c17141a3df58405 (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
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once

#include <mbgl/style/conversion.hpp>
#include <mbgl/util/color.hpp>
#include <mbgl/util/optional.hpp>

#include <string>
#include <vector>

namespace mbgl {
namespace style {
namespace expression {

class Image {
public:
    Image() = default;
    Image(const char* imageID);
    Image(std::string imageID);
    explicit Image(std::string imageID, bool available);
    bool operator==(const Image&) const;
    mbgl::Value toValue() const;
    const std::string& id() const;
    bool isAvailable() const;
    bool empty() const;

private:
    std::string imageID;
    bool available;
};

} // namespace expression

namespace conversion {

template <>
struct Converter<expression::Image> {
public:
    optional<expression::Image> operator()(const Convertible& value, Error& error) const;
};

template <>
struct ValueFactory<expression::Image> {
    static Value make(const expression::Image& image) { return image.toValue(); }
};

} // namespace conversion

} // namespace style
} // namespace mbgl