summaryrefslogtreecommitdiff
path: root/src/mbgl/style/property_parsing.hpp
blob: 8c2bd2c0f444f4e74d6122fd32372dbf33abcdd1 (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
#pragma once

#include <mbgl/style/property_value.hpp>
#include <mbgl/style/transition_options.hpp>
#include <mbgl/style/rapidjson_conversion.hpp>
#include <mbgl/style/conversion/property_value.hpp>

#include <mbgl/platform/log.hpp>

namespace mbgl {
namespace style {

template <typename T>
PropertyValue<T> parseProperty(const char* name, const JSValue& value) {
    conversion::Result<PropertyValue<T>> result = conversion::convert<PropertyValue<T>>(value);
    if (!result) {
        Log::Warning(Event::ParseStyle, "%s: %s", name, result.error().message);
        return {};
    }
    return *result;
}

optional<TransitionOptions> parseTransitionOptions(const char * name, const JSValue&);

} // namespace style
} // namespace mbgl