diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-06-28 08:21:30 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-06-28 10:00:40 -0700 |
commit | e323daf71fb3698cd53a49b4a7fd296d8cd6dd19 (patch) | |
tree | 83b1328ee8691c49c2c1340fcae3204442c0b4a0 /src | |
parent | 1dd35eface06c253c6e039b49942bdeb32991839 (diff) | |
download | qtlocation-mapboxgl-e323daf71fb3698cd53a49b4a7fd296d8cd6dd19.tar.gz |
[core] InterpolateBase → Interpolate; Interpolate → InterpolateImpl
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/expression/find_zoom_curve.cpp | 14 | ||||
-rw-r--r-- | src/mbgl/style/expression/interpolate.cpp | 16 | ||||
-rw-r--r-- | src/mbgl/style/expression/parsing_context.cpp | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/mbgl/style/expression/find_zoom_curve.cpp b/src/mbgl/style/expression/find_zoom_curve.cpp index 5d39e0791e..ce8487a3af 100644 --- a/src/mbgl/style/expression/find_zoom_curve.cpp +++ b/src/mbgl/style/expression/find_zoom_curve.cpp @@ -10,8 +10,8 @@ namespace mbgl { namespace style { namespace expression { -optional<variant<const InterpolateBase*, const Step*, ParsingError>> findZoomCurve(const expression::Expression* e) { - optional<variant<const InterpolateBase*, const Step*, ParsingError>> result; +optional<variant<const Interpolate*, const Step*, ParsingError>> findZoomCurve(const expression::Expression* e) { + optional<variant<const Interpolate*, const Step*, ParsingError>> result; if (auto let = dynamic_cast<const Let*>(e)) { result = findZoomCurve(let->getResult()); @@ -23,7 +23,7 @@ optional<variant<const InterpolateBase*, const Step*, ParsingError>> findZoomCur break; } } - } else if (auto curve = dynamic_cast<const InterpolateBase*>(e)) { + } else if (auto curve = dynamic_cast<const Interpolate*>(e)) { auto z = dynamic_cast<CompoundExpressionBase*>(curve->getInput().get()); if (z && z->getName() == "zoom") { result = {curve}; @@ -40,7 +40,7 @@ optional<variant<const InterpolateBase*, const Step*, ParsingError>> findZoomCur } e->eachChild([&](const Expression& child) { - optional<variant<const InterpolateBase*, const Step*, ParsingError>> childResult(findZoomCurve(&child)); + optional<variant<const Interpolate*, const Step*, ParsingError>> childResult(findZoomCurve(&child)); if (childResult) { if (childResult->is<ParsingError>()) { result = childResult; @@ -59,13 +59,13 @@ optional<variant<const InterpolateBase*, const Step*, ParsingError>> findZoomCur return result; } -variant<const InterpolateBase*, const Step*> findZoomCurveChecked(const expression::Expression* e) { +variant<const Interpolate*, const Step*> findZoomCurveChecked(const expression::Expression* e) { return findZoomCurve(e)->match( - [](const ParsingError&) -> variant<const InterpolateBase*, const Step*> { + [](const ParsingError&) -> variant<const Interpolate*, const Step*> { assert(false); return {}; }, - [](auto zoomCurve) -> variant<const InterpolateBase*, const Step*> { + [](auto zoomCurve) -> variant<const Interpolate*, const Step*> { return {std::move(zoomCurve)}; } ); diff --git a/src/mbgl/style/expression/interpolate.cpp b/src/mbgl/style/expression/interpolate.cpp index e5f99f1117..c3a1f0dc95 100644 --- a/src/mbgl/style/expression/interpolate.cpp +++ b/src/mbgl/style/expression/interpolate.cpp @@ -8,13 +8,13 @@ namespace expression { using namespace mbgl::style::conversion; template <typename T> -class Interpolate : public InterpolateBase { +class InterpolateImpl : public Interpolate { public: - Interpolate(type::Type type_, + InterpolateImpl(type::Type type_, Interpolator interpolator_, std::unique_ptr<Expression> input_, std::map<double, std::unique_ptr<Expression>> stops_ - ) : InterpolateBase(std::move(type_), std::move(interpolator_), std::move(input_), std::move(stops_)) + ) : Interpolate(std::move(type_), std::move(interpolator_), std::move(input_), std::move(stops_)) { static_assert(util::Interpolatable<T>::value, "Interpolate expression requires an interpolatable value type."); } @@ -235,12 +235,12 @@ ParseResult createInterpolate(type::Type type, ParsingContext& ctx) { return type.match( [&](const type::NumberType&) -> ParseResult { - return ParseResult(std::make_unique<Interpolate<double>>( + return ParseResult(std::make_unique<InterpolateImpl<double>>( type, interpolator, std::move(input), std::move(stops) )); }, [&](const type::ColorType&) -> ParseResult { - return ParseResult(std::make_unique<Interpolate<Color>>( + return ParseResult(std::make_unique<InterpolateImpl<Color>>( type, interpolator, std::move(input), std::move(stops) )); }, @@ -249,7 +249,7 @@ ParseResult createInterpolate(type::Type type, ctx.error("Type " + toString(type) + " is not interpolatable."); return ParseResult(); } - return ParseResult(std::make_unique<Interpolate<std::vector<Value>>>( + return ParseResult(std::make_unique<InterpolateImpl<std::vector<Value>>>( type, interpolator, std::move(input), std::move(stops) )); }, @@ -260,7 +260,7 @@ ParseResult createInterpolate(type::Type type, ); } -std::vector<optional<Value>> InterpolateBase::possibleOutputs() const { +std::vector<optional<Value>> Interpolate::possibleOutputs() const { std::vector<optional<Value>> result; for (const auto& stop : stops) { for (auto& output : stop.second->possibleOutputs()) { @@ -270,7 +270,7 @@ std::vector<optional<Value>> InterpolateBase::possibleOutputs() const { return result; } -mbgl::Value InterpolateBase::serialize() const { +mbgl::Value Interpolate::serialize() const { std::vector<mbgl::Value> serialized; serialized.emplace_back(getOperator()); diff --git a/src/mbgl/style/expression/parsing_context.cpp b/src/mbgl/style/expression/parsing_context.cpp index b522aeff9a..72585c35df 100644 --- a/src/mbgl/style/expression/parsing_context.cpp +++ b/src/mbgl/style/expression/parsing_context.cpp @@ -216,7 +216,7 @@ ParseResult ParsingContext::parseExpression(const Convertible& value, TypeAnnota ParseResult ParsingContext::parseLayerPropertyExpression(const Convertible& value, TypeAnnotationOption typeAnnotationOption) { ParseResult parsed = parse(value, typeAnnotationOption); if (parsed && !isZoomConstant(**parsed)) { - optional<variant<const InterpolateBase*, const Step*, ParsingError>> zoomCurve = findZoomCurve(parsed->get()); + optional<variant<const Interpolate*, const Step*, ParsingError>> zoomCurve = findZoomCurve(parsed->get()); if (!zoomCurve) { error(R"("zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.)"); return ParseResult(); |