diff options
Diffstat (limited to 'include/mbgl/style/expression/formatted.hpp')
-rw-r--r-- | include/mbgl/style/expression/formatted.hpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/mbgl/style/expression/formatted.hpp b/include/mbgl/style/expression/formatted.hpp index f4f08e919..bb3d609c9 100644 --- a/include/mbgl/style/expression/formatted.hpp +++ b/include/mbgl/style/expression/formatted.hpp @@ -48,7 +48,8 @@ public: bool operator==(const Formatted& ) const; std::string toString() const; - + mbgl::Value toObject() const; + bool empty() const { return sections.empty() || sections.at(0).text.empty(); } @@ -59,13 +60,18 @@ public: } // namespace expression namespace conversion { - + template <> -struct Converter<mbgl::style::expression::Formatted> { +struct Converter<expression::Formatted> { public: - optional<mbgl::style::expression::Formatted> operator()(const Convertible& value, Error& error) const; + optional<expression::Formatted> operator()(const Convertible& value, Error& error) const; }; - + +template <> +struct ValueFactory<expression::Formatted> { + static Value make(const expression::Formatted& formatted) { return formatted.toObject(); } +}; + } // namespace conversion } // namespace style |