summaryrefslogtreecommitdiff
path: root/src/mbgl/style/expression/is_expression.cpp
blob: cf26182164e3790220031f2c44e8853f10628677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <mbgl/style/expression/is_expression.hpp>
#include <mbgl/style/expression/compound_expression.hpp>
#include <mbgl/style/expression/parsing_context.hpp>
#include <mbgl/style/conversion_impl.hpp>

#include <unordered_set>

namespace mbgl {
namespace style {
namespace expression {

using namespace mbgl::style::conversion;

bool isExpression(const Convertible& value) {
    if (!isArray(value) || arrayLength(value) == 0) return false;
    optional<std::string> name = toString(arrayMember(value, 0));
    if (!name) return false;
    
    return isExpression(*name) || CompoundExpression::exists(*name);
}


} // namespace expression
} // namespace style
} // namespace mbgl