[core] Expose dsl::compound() internally

This will be used in a follow up patch by the function to expression
conversion code.
This commit is contained in:
Ander Conselvan de Oliveira
2019-04-02 15:52:16 +03:00
parent 343df18954
commit f2f2e64fc8
3 changed files with 24 additions and 6 deletions

View File

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

View File

@@ -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));
}

View File

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