#pragma once #include #include namespace mbgl { namespace style { namespace expression { struct FormatExpressionSection { explicit FormatExpressionSection(std::unique_ptr content_); void setTextSectionOptions(std::optional> fontScale_, std::optional> textFont_, std::optional> textColor_); // Content can be expression that evaluates to String or Image. std::shared_ptr content; // Text related section options. std::optional> fontScale; std::optional> textFont; std::optional> 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 override; std::vector> possibleOutputs() const override { // Technically the combinatoric set of all children // Usually, this.text will be undefined anyway return {std::nullopt}; } const std::vector& getSections() const { return sections; } mbgl::Value serialize() const override; std::string getOperator() const override { return "format"; } private: std::vector sections; }; } // namespace expression } // namespace style } // namespace mbgl