| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <mbgl/util/optional.hpp> |
| 4 | |
| 5 | #include <mapbox/geometry/feature.hpp> |
| 6 | |
| 7 | namespace mbgl { |
| 8 | |
| 9 | using Value = mapbox::geometry::value; |
| 10 | using NullValue = mapbox::geometry::null_value_t; |
| 11 | using PropertyMap = mapbox::geometry::property_map; |
| 12 | using FeatureIdentifier = mapbox::geometry::identifier; |
| 13 | using Feature = mapbox::geometry::feature<double>; |
| 14 | |
| 15 | template <class T> |
| 16 | optional<T> numericValue(const Value& value) { |
| 17 | return value.match( |
| 18 | [] (uint64_t t) { |
| 19 | return optional<T>(t); |
| 20 | }, |
| 21 | [] (int64_t t) { |
| 22 | return optional<T>(t); |
| 23 | }, |
| 24 | [] (double t) { |
| 25 | return optional<T>(t); |
| 26 | }, |
| 27 | [] (auto) { |
| 28 | return optional<T>(); |
| 29 | }); |
| 30 | } |
| 31 | |
| 32 | } // namespace mbgl |
| 33 |
