diff options
author | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-04-02 15:52:16 +0300 |
---|---|---|
committer | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-05-21 12:14:22 +0300 |
commit | f2f2e64fc8540a262c94a148993c89ad0de76038 (patch) | |
tree | b7deceac2036a5e6fae4a484e7a6a4aae68a556a | |
parent | 343df18954be90c26ace7bcf1c21cf434737693a (diff) | |
download | qtlocation-mapboxgl-f2f2e64fc8540a262c94a148993c89ad0de76038.tar.gz |
[core] Expose dsl::compound() internally
This will be used in a follow up patch by the function to expression
conversion code.
-rw-r--r-- | src/core-files.json | 1 | ||||
-rw-r--r-- | src/mbgl/style/expression/dsl.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/expression/dsl_impl.hpp | 21 |
3 files changed, 24 insertions, 6 deletions
diff --git a/src/core-files.json b/src/core-files.json index e6c2a92822..cf87e410f9 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -673,6 +673,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 <mbgl/style/expression/dsl.hpp> +#include <mbgl/style/expression/dsl_impl.hpp> #include <mbgl/style/expression/error.hpp> #include <mbgl/style/expression/literal.hpp> #include <mbgl/style/expression/assertion.hpp> @@ -14,18 +15,13 @@ namespace style { namespace expression { namespace dsl { -static std::unique_ptr<Expression> compound(const char* op, std::vector<std::unique_ptr<Expression>> args) { +std::unique_ptr<Expression> compound(const char* op, std::vector<std::unique_ptr<Expression>> args) { ParsingContext ctx; ParseResult result = createCompoundExpression(op, std::move(args), ctx); assert(result); return std::move(*result); } -template <class... Args> -static std::unique_ptr<Expression> compound(const char* op, Args... args) { - return compound(op, vec(std::move(args)...)); -} - std::unique_ptr<Expression> error(std::string message) { return std::make_unique<Error>(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 <mbgl/style/expression/expression.hpp> +#include <mbgl/util/color.hpp> + +namespace mbgl { +namespace style { +namespace expression { +namespace dsl { + +std::unique_ptr<Expression> compound(const char* op, std::vector<std::unique_ptr<Expression>> args); + +template <class... Args> +std::unique_ptr<Expression> compound(const char* op, Args... args) { + return compound(op, vec(std::move(args)...)); +} + +} // namespace dsl +} // namespace expression +} // namespace style +} // namespace mbgl |