#pragma once #include #include namespace mbgl { namespace style { namespace expression { struct FormatExpressionSection { explicit FormatExpressionSection(std::unique_ptr content_); void setTextSectionOptions(std::unique_ptr&& fontScale_, std::unique_ptr&& textFont_, std::unique_ptr&& textColor_); // Content can be expression that evaluates to String or Image. std::shared_ptr content; // Text related section options. std::shared_ptr fontScale; std::shared_ptr textFont; std::shared_ptr textColor; }; class FormatExpression final : public Expression { public: explicit FormatExpression(std::vector sections); EvaluationResult evaluate(const EvaluationContext&) const override; static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); void eachChild(const std::function&) const override; bool operator==(const Expression& e) const noexcept override; std::vector> possibleOutputs() const noexcept override { // Technically the combinatoric set of all children // Usually, this.text will be undefined anyway return {std::nullopt}; } const std::vector& getSections() const noexcept { return sections; } mbgl::Value serialize() const override; std::string getOperator() const override { return "format"; } private: static Dependency depsOfSection(const FormatExpressionSection& s) { return depsOf(s.content) | depsOf(s.fontScale) | depsOf(s.textFont) | depsOf(s.textColor); } private: std::vector sections; }; } // namespace expression } // namespace style } // namespace mbgl