blob: c7a8fc63e44be20e11e4717c51e7f629e232972c (
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
|
#include <mbgl/style/conversion/tileset.hpp>
#include <mbgl/style/conversion/url_or_tileset.hpp>
#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
namespace conversion {
optional<variant<std::string, Tileset>> Converter<variant<std::string, Tileset>>::operator()(const Convertible& value,
Error& error) const {
auto urlVal = objectMember(value, "url");
if (!urlVal) {
optional<Tileset> tileset = convert<Tileset>(value, error);
if (!tileset) {
return nullopt;
}
return {*tileset};
}
optional<std::string> url = toString(*urlVal);
if (!url) {
error.message = "source url must be a string";
return nullopt;
}
return {*url};
}
} // namespace conversion
} // namespace style
} // namespace mbgl
|