diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2019-08-21 16:03:36 +0300 |
---|---|---|
committer | Juha Alanen <19551460+jmalanen@users.noreply.github.com> | 2019-09-18 14:29:15 +0300 |
commit | 413278ca20de77f7025b5304493dca6d1863fbb3 (patch) | |
tree | 194c238e77795c3421fc0f849406340fd8e4ad77 /include | |
parent | 91171bc1a98acf3d21704fa86ad7ada5d1ac762e (diff) | |
download | qtlocation-mapboxgl-413278ca20de77f7025b5304493dca6d1863fbb3.tar.gz |
[core] Add feature state support to bucket classes
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/util/feature.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp index 56db250de0..d2a23cc5b0 100644 --- a/include/mbgl/util/feature.hpp +++ b/include/mbgl/util/feature.hpp @@ -1,6 +1,7 @@ #pragma once #include <mbgl/util/optional.hpp> +#include <mbgl/util/string.hpp> #include <mapbox/feature.hpp> @@ -32,4 +33,27 @@ optional<T> numericValue(const Value& value) { }); } +inline optional<std::string> featureIDtoString(const FeatureIdentifier& id) { + if (id.is<NullValue>()) { + return nullopt; + } + + return id.match( + [] (const std::string& value_) { + return value_; + }, + [] (uint64_t value_) { + return util::toString(value_); + }, + [] (int64_t value_) { + return util::toString(value_); + }, + [] (double value_) { + return util::toString(value_); + }, + [] (const auto&) -> optional<std::string> { + return nullopt; + }); +} + } // namespace mbgl |