summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2019-09-17 15:40:01 +0300
committerJuha Alanen <19551460+jmalanen@users.noreply.github.com>2019-09-18 14:29:15 +0300
commit6b13c42314f28e3b27111367c4f3296c3c3c1248 (patch)
tree2f91aae637e2c49bb55cfc336f772ac772ab5a2d /src/mbgl/style
parent0042f0b9f5de7151f14300f02a559b6ecb48a507 (diff)
downloadqtlocation-mapboxgl-6b13c42314f28e3b27111367c4f3296c3c3c1248.tar.gz
[build] Fix clang format and tidy checks
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/expression/compound_expression.cpp172
-rw-r--r--src/mbgl/style/expression/is_constant.cpp7
-rw-r--r--src/mbgl/style/properties.hpp9
3 files changed, 90 insertions, 98 deletions
diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp
index 8bd21bdad7..c2bc511e41 100644
--- a/src/mbgl/style/expression/compound_expression.cpp
+++ b/src/mbgl/style/expression/compound_expression.cpp
@@ -676,16 +676,17 @@ const auto& errorCompoundExpression() {
}
const auto& featureStateCompoundExpression() {
- static auto signature = detail::makeSignature("feature-state", [](const EvaluationContext& params, const std::string& key) -> Result<Value> {
- mbgl::Value state;
- if (params.featureState) {
- auto it = params.featureState->find(key);
- if (it != params.featureState->end()) {
- state = mbgl::Value(it->second);
+ static auto signature = detail::makeSignature(
+ "feature-state", [](const EvaluationContext& params, const std::string& key) -> Result<Value> {
+ mbgl::Value state;
+ if (params.featureState != nullptr) {
+ auto it = params.featureState->find(key);
+ if (it != params.featureState->end()) {
+ state = mbgl::Value(it->second);
+ }
}
- }
- return toExpressionValue(state);
- });
+ return toExpressionValue(state);
+ });
return signature;
}
@@ -886,82 +887,83 @@ const auto& filterInCompoundExpression() {
}
using ParseCompoundFunction = const std::unique_ptr<detail::SignatureBase>& (*)();
-MAPBOX_ETERNAL_CONSTEXPR const auto compoundExpressionRegistry = mapbox::eternal::hash_map<mapbox::eternal::string, ParseCompoundFunction>({
- { "e", eCompoundExpression },
- { "pi", piCompoundExpression },
- { "ln2", ln2CompoundExpression },
- { "typeof", typeofCompoundExpression },
- { "to-rgba", toRgbaCompoundExpression },
- { "rgba", rgbaCompoundExpression },
- { "rgb", rgbCompoundExpression },
- { "zoom", zoomCompoundExpression },
- { "heatmap-density", heatmapDensityCompoundExpression },
- { "line-progress", lineProgressCompoundExpression },
- { "accumulated", accumulatedCompoundExpression },
- { "has", hasContextCompoundExpression },
- { "has", hasObjectCompoundExpression },
- { "get", getContextCompoundExpression },
- { "get", getObjectCompoundExpression },
- { "properties", propertiesCompoundExpression },
- { "geometry-type", geometryTypeCompoundExpression },
- { "id", idCompoundExpression },
- { "+", plusCompoundExpression },
- { "-", minusCompoundExpression },
- { "-", negateCompoundExpression },
- { "*", multiplyCompoundExpression },
- { "/", divideCompoundExpression },
- { "%", modCompoundExpression },
- { "^", powCompoundExpression },
- { "sqrt", sqrtCompoundExpression },
- { "log10", log10CompoundExpression },
- { "ln", lnCompoundExpression },
- { "log2", log2CompoundExpression },
- { "sin", sinCompoundExpression },
- { "cos", cosCompoundExpression },
- { "tan", tanCompoundExpression },
- { "asin", asinCompoundExpression },
- { "acos", acosCompoundExpression },
- { "atan", atanCompoundExpression },
- { "min", minCompoundExpression },
- { "max", maxCompoundExpression },
- { "round", roundCompoundExpression },
- { "floor", floorCompoundExpression },
- { "ceil", ceilCompoundExpression },
- { "abs", absCompoundExpression },
- { "!", notCompoundExpression },
- { "is-supported-script", isSupportedScriptCompoundExpression },
- { "upcase", upcaseCompoundExpression },
- { "downcase", downcaseCompoundExpression },
- { "concat", concatCompoundExpression },
- { "resolved-locale", resolvedLocaleCompoundExpression },
- { "error", errorCompoundExpression },
- { "feature-state", featureStateCompoundExpression },
- // Legacy Filters
- { "filter-==", filterEqualsCompoundExpression },
- { "filter-id-==", filterIdEqualsCompoundExpression },
- { "filter-type-==", filterTypeEqualsCompoundExpression },
- { "filter-<", filterLessThanNumberCompoundExpression },
- { "filter-<", filterLessThanStringCompoundExpression },
- { "filter-id-<", filterIdLessThanNumberCompoundExpression },
- { "filter-id-<", filterIdLessThanStringCompoundExpression },
- { "filter->", filterMoreThanNumberCompoundExpression },
- { "filter->", filterMoreThanStringCompoundExpression },
- { "filter-id->", filterIdMoreThanNumberCompoundExpression },
- { "filter-id->", filterIdMoreThanStringCompoundExpression },
- { "filter-<=", filterLessOrEqualThanNumberCompoundExpression },
- { "filter-<=", filterLessOrEqualThanStringCompoundExpression },
- { "filter-id-<=", filterIdLessOrEqualThanNumberCompoundExpression },
- { "filter-id-<=", filterIdLessOrEqualThanStringCompoundExpression },
- { "filter->=", filterGreaterOrEqualThanNumberCompoundExpression },
- { "filter->=", filterGreaterOrEqualThanStringCompoundExpression },
- { "filter-id->=", filterIdGreaterOrEqualThanNumberCompoundExpression },
- { "filter-id->=", filterIdGreaterOrEqualThanStringCompoundExpression },
- { "filter-has", filterHasCompoundExpression },
- { "filter-has-id", filterHasIdCompoundExpression },
- { "filter-type-in", filterTypeInCompoundExpression },
- { "filter-id-in", filterIdInCompoundExpression },
- { "filter-in", filterInCompoundExpression },
-});
+MAPBOX_ETERNAL_CONSTEXPR const auto compoundExpressionRegistry =
+ mapbox::eternal::hash_map<mapbox::eternal::string, ParseCompoundFunction>({
+ {"e", eCompoundExpression},
+ {"pi", piCompoundExpression},
+ {"ln2", ln2CompoundExpression},
+ {"typeof", typeofCompoundExpression},
+ {"to-rgba", toRgbaCompoundExpression},
+ {"rgba", rgbaCompoundExpression},
+ {"rgb", rgbCompoundExpression},
+ {"zoom", zoomCompoundExpression},
+ {"heatmap-density", heatmapDensityCompoundExpression},
+ {"line-progress", lineProgressCompoundExpression},
+ {"accumulated", accumulatedCompoundExpression},
+ {"has", hasContextCompoundExpression},
+ {"has", hasObjectCompoundExpression},
+ {"get", getContextCompoundExpression},
+ {"get", getObjectCompoundExpression},
+ {"properties", propertiesCompoundExpression},
+ {"geometry-type", geometryTypeCompoundExpression},
+ {"id", idCompoundExpression},
+ {"+", plusCompoundExpression},
+ {"-", minusCompoundExpression},
+ {"-", negateCompoundExpression},
+ {"*", multiplyCompoundExpression},
+ {"/", divideCompoundExpression},
+ {"%", modCompoundExpression},
+ {"^", powCompoundExpression},
+ {"sqrt", sqrtCompoundExpression},
+ {"log10", log10CompoundExpression},
+ {"ln", lnCompoundExpression},
+ {"log2", log2CompoundExpression},
+ {"sin", sinCompoundExpression},
+ {"cos", cosCompoundExpression},
+ {"tan", tanCompoundExpression},
+ {"asin", asinCompoundExpression},
+ {"acos", acosCompoundExpression},
+ {"atan", atanCompoundExpression},
+ {"min", minCompoundExpression},
+ {"max", maxCompoundExpression},
+ {"round", roundCompoundExpression},
+ {"floor", floorCompoundExpression},
+ {"ceil", ceilCompoundExpression},
+ {"abs", absCompoundExpression},
+ {"!", notCompoundExpression},
+ {"is-supported-script", isSupportedScriptCompoundExpression},
+ {"upcase", upcaseCompoundExpression},
+ {"downcase", downcaseCompoundExpression},
+ {"concat", concatCompoundExpression},
+ {"resolved-locale", resolvedLocaleCompoundExpression},
+ {"error", errorCompoundExpression},
+ {"feature-state", featureStateCompoundExpression},
+ // Legacy Filters
+ {"filter-==", filterEqualsCompoundExpression},
+ {"filter-id-==", filterIdEqualsCompoundExpression},
+ {"filter-type-==", filterTypeEqualsCompoundExpression},
+ {"filter-<", filterLessThanNumberCompoundExpression},
+ {"filter-<", filterLessThanStringCompoundExpression},
+ {"filter-id-<", filterIdLessThanNumberCompoundExpression},
+ {"filter-id-<", filterIdLessThanStringCompoundExpression},
+ {"filter->", filterMoreThanNumberCompoundExpression},
+ {"filter->", filterMoreThanStringCompoundExpression},
+ {"filter-id->", filterIdMoreThanNumberCompoundExpression},
+ {"filter-id->", filterIdMoreThanStringCompoundExpression},
+ {"filter-<=", filterLessOrEqualThanNumberCompoundExpression},
+ {"filter-<=", filterLessOrEqualThanStringCompoundExpression},
+ {"filter-id-<=", filterIdLessOrEqualThanNumberCompoundExpression},
+ {"filter-id-<=", filterIdLessOrEqualThanStringCompoundExpression},
+ {"filter->=", filterGreaterOrEqualThanNumberCompoundExpression},
+ {"filter->=", filterGreaterOrEqualThanStringCompoundExpression},
+ {"filter-id->=", filterIdGreaterOrEqualThanNumberCompoundExpression},
+ {"filter-id->=", filterIdGreaterOrEqualThanStringCompoundExpression},
+ {"filter-has", filterHasCompoundExpression},
+ {"filter-has-id", filterHasIdCompoundExpression},
+ {"filter-type-in", filterTypeInCompoundExpression},
+ {"filter-id-in", filterIdInCompoundExpression},
+ {"filter-in", filterInCompoundExpression},
+ });
using namespace mbgl::style::conversion;
diff --git a/src/mbgl/style/expression/is_constant.cpp b/src/mbgl/style/expression/is_constant.cpp
index 5f8215c55f..4c4684c86a 100644
--- a/src/mbgl/style/expression/is_constant.cpp
+++ b/src/mbgl/style/expression/is_constant.cpp
@@ -17,12 +17,7 @@ bool isFeatureConstant(const Expression& expression) {
return false;
} else if (name == "has" && parameterCount && *parameterCount == 1) {
return false;
- } else if (
- name == "properties" ||
- name == "geometry-type" ||
- name == "id" ||
- name == "feature-state"
- ) {
+ } else if (name == "properties" || name == "geometry-type" || name == "id" || name == "feature-state") {
return false;
} else if (0u == name.rfind(filter, 0u)) {
// Legacy filters begin with "filter-" and are never constant.
diff --git a/src/mbgl/style/properties.hpp b/src/mbgl/style/properties.hpp
index b07456a96d..db0e54330c 100644
--- a/src/mbgl/style/properties.hpp
+++ b/src/mbgl/style/properties.hpp
@@ -183,13 +183,8 @@ public:
template <class T>
static T evaluate(float z, const GeometryTileFeature& feature, const FeatureState& state,
const PossiblyEvaluatedPropertyValue<T>& v, const T& defaultValue) {
- return v.match(
- [&] (const T& t) {
- return t;
- },
- [&] (const PropertyExpression<T>& t) {
- return t.evaluate(z, feature, state, defaultValue);
- });
+ return v.match([&](const T& t) { return t; },
+ [&](const PropertyExpression<T>& t) { return t.evaluate(z, feature, state, defaultValue); });
}
template <class P>