diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-06-29 12:52:08 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-13 13:37:27 -0700 |
commit | a6727921fc1608d341c086cd70341e6df5e79a2b (patch) | |
tree | 3d856db5fc934256962a75808ec1a821c457aa02 /src/mbgl/style/function/categorical_stops.cpp | |
parent | bea8f8d177905bfb74e8b5c2d5e7750b3d6bad8e (diff) | |
download | qtlocation-mapboxgl-a6727921fc1608d341c086cd70341e6df5e79a2b.tar.gz |
[core] Convert legacy functions directly to expressions
Diffstat (limited to 'src/mbgl/style/function/categorical_stops.cpp')
-rw-r--r-- | src/mbgl/style/function/categorical_stops.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/mbgl/style/function/categorical_stops.cpp b/src/mbgl/style/function/categorical_stops.cpp deleted file mode 100644 index dd179f5376..0000000000 --- a/src/mbgl/style/function/categorical_stops.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include <mbgl/style/function/categorical_stops.hpp> -#include <mbgl/style/types.hpp> -#include <mbgl/util/color.hpp> - -#include <array> - -namespace mbgl { -namespace style { - -optional<CategoricalValue> categoricalValue(const Value& value) { - return value.match( - [] (bool t) { return optional<CategoricalValue>(t); }, - [] (uint64_t t) { return optional<CategoricalValue>(int64_t(t)); }, - [] (int64_t t) { return optional<CategoricalValue>(t); }, - [] (double t) { return optional<CategoricalValue>(int64_t(t)); }, - [] (const std::string& t) { return optional<CategoricalValue>(t); }, - [] (const auto&) { return optional<CategoricalValue>(); } - ); -} - -template <class T> -optional<T> CategoricalStops<T>::evaluate(const Value& value) const { - auto v = categoricalValue(value); - if (!v) { - return {}; - } - auto it = stops.find(*v); - return it == stops.end() ? optional<T>() : it->second; -} - -template class CategoricalStops<float>; -template class CategoricalStops<Color>; -template class CategoricalStops<std::array<float, 2>>; -template class CategoricalStops<std::string>; -template class CategoricalStops<TextTransformType>; -template class CategoricalStops<TextJustifyType>; -template class CategoricalStops<SymbolAnchorType>; -template class CategoricalStops<LineJoinType>; - -} // namespace style -} // namespace mbgl |