blob: 4e502324d0add4044aa76778bcbd18fd7f0bbc49 (
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
|
#pragma once
#include <mbgl/util/optional.hpp>
#include <mbgl/util/variant.hpp>
#include <mbgl/util/tileset.hpp>
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/tileset.hpp>
#include <jni/jni.hpp>
#include <string>
namespace mbgl {
namespace style {
namespace conversion {
template <>
struct Converter<variant<std::string, Tileset>> {
template <class V>
Result<variant<std::string, Tileset>> operator()(const V& value) const {
if (isObject(value)) {
Result<Tileset> tileset = convert<Tileset>(value);
if (!tileset) {
return tileset.error();
}
return *tileset;
} else {
return *toString(value);
}
}
};
}
}
}
|