summaryrefslogtreecommitdiff
path: root/include/mbgl/style/property_fallback.hpp
blob: 5c5eae0cd67c72a46ac9151cdb0bb9d3aa909ef3 (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
#ifndef MBGL_STYLE_PROPERTY_FALLBACK
#define MBGL_STYLE_PROPERTY_FALLBACK

#include <mbgl/style/property_key.hpp>
#include <mbgl/style/property_value.hpp>

#include <map>

namespace mbgl {

class PropertyFallbackValue {
public:
    static const PropertyValue &Get(PropertyKey key) {
        auto it = properties.find(key);
        if (it != properties.end()) {
            return it->second;
        } else {
            return defaultProperty;
        }
    }

private:
    static const std::map<PropertyKey, PropertyValue> properties;
    static const PropertyValue defaultProperty;
};

}

#endif