From df96eb3c71600a44eae2d93550e75ab42f0ed615 Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Tue, 2 Apr 2019 15:52:16 +0300 Subject: [core] Expose dsl::compound() internally This will be used in a follow up patch by the function to expression conversion code. --- src/core-files.json | 1 + src/mbgl/style/expression/dsl.cpp | 8 ++------ src/mbgl/style/expression/dsl_impl.hpp | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/mbgl/style/expression/dsl_impl.hpp diff --git a/src/core-files.json b/src/core-files.json index a52797acd7..7954e2fb88 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -674,6 +674,7 @@ "mbgl/style/conversion/json.hpp": "src/mbgl/style/conversion/json.hpp", "mbgl/style/conversion/stringify.hpp": "src/mbgl/style/conversion/stringify.hpp", "mbgl/style/custom_tile_loader.hpp": "src/mbgl/style/custom_tile_loader.hpp", + "mbgl/style/expression/dsl_impl.hpp": "src/mbgl/style/expression/dsl_impl.hpp", "mbgl/style/expression/util.hpp": "src/mbgl/style/expression/util.hpp", "mbgl/style/image_impl.hpp": "src/mbgl/style/image_impl.hpp", "mbgl/style/layer_impl.hpp": "src/mbgl/style/layer_impl.hpp", diff --git a/src/mbgl/style/expression/dsl.cpp b/src/mbgl/style/expression/dsl.cpp index d1d8dea799..dd4aa7d277 100644 --- a/src/mbgl/style/expression/dsl.cpp +++ b/src/mbgl/style/expression/dsl.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -14,18 +15,13 @@ namespace style { namespace expression { namespace dsl { -static std::unique_ptr compound(const char* op, std::vector> args) { +std::unique_ptr compound(const char* op, std::vector> args) { ParsingContext ctx; ParseResult result = createCompoundExpression(op, std::move(args), ctx); assert(result); return std::move(*result); } -template -static std::unique_ptr compound(const char* op, Args... args) { - return compound(op, vec(std::move(args)...)); -} - std::unique_ptr error(std::string message) { return std::make_unique(std::move(message)); } diff --git a/src/mbgl/style/expression/dsl_impl.hpp b/src/mbgl/style/expression/dsl_impl.hpp new file mode 100644 index 0000000000..201c60ffd8 --- /dev/null +++ b/src/mbgl/style/expression/dsl_impl.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +namespace mbgl { +namespace style { +namespace expression { +namespace dsl { + +std::unique_ptr compound(const char* op, std::vector> args); + +template +std::unique_ptr compound(const char* op, Args... args) { + return compound(op, vec(std::move(args)...)); +} + +} // namespace dsl +} // namespace expression +} // namespace style +} // namespace mbgl -- cgit v1.2.1