summaryrefslogtreecommitdiff
path: root/include/llmr/style/property_fallback.hpp
blob: eb6bb15c9ca4cf9aee3a632235374cbfc9e726f8 (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 LLMR_STYLE_PROPERTY_FALLBACK
#define LLMR_STYLE_PROPERTY_FALLBACK

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

#include <map>

namespace llmr {

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