[core] Add feature state support to bucket classes

This commit is contained in:
Juha Alanen
2019-08-21 16:03:36 +03:00
committed by Juha Alanen
parent 91171bc1a9
commit 413278ca20
17 changed files with 232 additions and 42 deletions

View File

@@ -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