summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-03 12:27:14 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-04-05 11:10:52 +0200
commit570eecb427d2823c3de8322b62d695e7e99ddde1 (patch)
tree8731d9a37b4977f8e78d5f74ac4332932c239a47
parent4459d96b1ba863edd16ba31b1e12d601ac60144f (diff)
downloadqtlocation-mapboxgl-upstream/gfx-refactor-6.tar.gz
[core] clang-tidy fixesupstream/gfx-refactor-6
-rw-r--r--.clang-tidy3
-rw-r--r--bin/offline.cpp2
-rw-r--r--circle.yml4
-rw-r--r--include/mbgl/style/layers/background_layer.hpp12
-rw-r--r--include/mbgl/style/layers/circle_layer.hpp44
-rw-r--r--include/mbgl/style/layers/fill_extrusion_layer.hpp32
-rw-r--r--include/mbgl/style/layers/fill_layer.hpp28
-rw-r--r--include/mbgl/style/layers/heatmap_layer.hpp20
-rw-r--r--include/mbgl/style/layers/hillshade_layer.hpp24
-rw-r--r--include/mbgl/style/layers/layer.hpp.ejs8
-rw-r--r--include/mbgl/style/layers/line_layer.hpp60
-rw-r--r--include/mbgl/style/layers/raster_layer.hpp32
-rw-r--r--include/mbgl/style/layers/symbol_layer.hpp212
-rw-r--r--platform/default/src/mbgl/storage/default_file_source.cpp3
-rw-r--r--platform/default/src/mbgl/storage/offline.cpp3
-rw-r--r--platform/default/src/mbgl/text/bidi.cpp2
-rw-r--r--platform/node/src/node_expression.cpp12
-rw-r--r--platform/node/src/node_feature.cpp4
-rw-r--r--platform/node/src/node_map.cpp6
-rwxr-xr-xscripts/clang-tidy-diff.py201
-rwxr-xr-xscripts/clang-tools.sh65
-rw-r--r--src/mbgl/actor/mailbox.cpp3
-rw-r--r--src/mbgl/annotation/annotation_tile.cpp2
-rw-r--r--src/mbgl/annotation/line_annotation_impl.cpp2
-rw-r--r--src/mbgl/layout/symbol_instance.cpp5
-rw-r--r--src/mbgl/layout/symbol_instance.hpp2
-rw-r--r--src/mbgl/layout/symbol_layout.cpp3
-rw-r--r--src/mbgl/map/map.cpp2
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.cpp4
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_fill_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_hillshade_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_raster_layer.cpp2
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp2
-rw-r--r--src/mbgl/renderer/render_source.cpp3
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp2
-rw-r--r--src/mbgl/renderer/sources/render_geojson_source.cpp2
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp6
-rw-r--r--src/mbgl/renderer/sources/render_raster_dem_source.cpp6
-rw-r--r--src/mbgl/storage/file_source.cpp2
-rw-r--r--src/mbgl/style/conversion/filter.cpp2
-rw-r--r--src/mbgl/style/conversion/function.cpp4
-rw-r--r--src/mbgl/style/custom_tile_loader.cpp24
-rw-r--r--src/mbgl/style/expression/boolean_operator.cpp8
-rw-r--r--src/mbgl/style/expression/case.cpp2
-rw-r--r--src/mbgl/style/expression/coercion.cpp2
-rw-r--r--src/mbgl/style/expression/comparison.cpp3
-rw-r--r--src/mbgl/style/expression/dsl.cpp4
-rw-r--r--src/mbgl/style/expression/format_expression.cpp2
-rw-r--r--src/mbgl/style/expression/formatted.cpp2
-rw-r--r--src/mbgl/style/expression/let.cpp4
-rw-r--r--src/mbgl/style/expression/match.cpp2
-rw-r--r--src/mbgl/style/expression/step.cpp6
-rw-r--r--src/mbgl/style/expression/value.cpp2
-rw-r--r--src/mbgl/style/layers/background_layer.cpp14
-rw-r--r--src/mbgl/style/layers/circle_layer.cpp46
-rw-r--r--src/mbgl/style/layers/fill_extrusion_layer.cpp34
-rw-r--r--src/mbgl/style/layers/fill_layer.cpp30
-rw-r--r--src/mbgl/style/layers/heatmap_layer.cpp22
-rw-r--r--src/mbgl/style/layers/hillshade_layer.cpp26
-rw-r--r--src/mbgl/style/layers/layer.cpp.ejs12
-rw-r--r--src/mbgl/style/layers/line_layer.cpp64
-rw-r--r--src/mbgl/style/layers/raster_layer.cpp34
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp216
-rw-r--r--src/mbgl/style/sources/raster_source.cpp2
-rw-r--r--src/mbgl/style/sources/vector_source.cpp2
-rw-r--r--src/mbgl/text/cross_tile_symbol_index.cpp5
-rw-r--r--src/mbgl/text/language_tag.cpp4
-rw-r--r--src/mbgl/text/placement.cpp5
-rw-r--r--src/mbgl/tile/custom_geometry_tile.cpp3
-rw-r--r--src/mbgl/tile/geometry_tile_worker.cpp5
-rw-r--r--src/mbgl/tile/geometry_tile_worker.hpp2
-rw-r--r--src/mbgl/util/string.cpp2
-rw-r--r--src/mbgl/util/tile_cover.cpp4
-rw-r--r--src/mbgl/util/tile_cover_impl.cpp4
-rw-r--r--test/actor/actor.test.cpp2
-rw-r--r--test/api/custom_layer.test.cpp8
-rw-r--r--test/map/map.test.cpp2
-rw-r--r--test/src/mbgl/test/sqlite3_test_fs.cpp50
-rw-r--r--test/storage/offline_database.test.cpp2
-rw-r--r--test/style/filter.test.cpp8
-rw-r--r--test/text/glyph_manager.test.cpp4
-rw-r--r--test/util/merge_lines.test.cpp2
-rw-r--r--test/util/peer.test.cpp12
-rw-r--r--test/util/tile_cover.test.cpp12
87 files changed, 856 insertions, 684 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 356748ec11..97600637ed 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,2 +1,3 @@
Checks: 'modernize-*,misc-static-assert,llvm-namespace-comment,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.uninitialized.UndefReturn,-clang-analyzer-core.StackAddressEscape,-clang-analyzer-core.CallAndMessage,-clang-diagnostic-unused-command-line-argument,-clang-analyzer-core.uninitialized.*,-clang-analyzer-core.NullDereference,-clang-analyzer-core.NonNullParamChecker'
-HeaderFilterRegex: '\/mbgl\/'
+WarningsAsErrors: '*'
+FormatStyle: file
diff --git a/bin/offline.cpp b/bin/offline.cpp
index 5cd43adfe3..a82e2b5aa5 100644
--- a/bin/offline.cpp
+++ b/bin/offline.cpp
@@ -197,7 +197,7 @@ int main(int argc, char *argv[]) {
: region(region_),
fileSource(fileSource_),
loop(loop_),
- mergePath(mergePath_),
+ mergePath(std::move(mergePath_)),
start(util::now()) {
}
diff --git a/circle.yml b/circle.yml
index 3d261cf798..7a37777e01 100644
--- a/circle.yml
+++ b/circle.yml
@@ -488,8 +488,8 @@ jobs:
- image: mbgl/linux-clang-7:a5a3c52107
working_directory: /src
environment:
- LIBSYSCONFCPUS: 2
- JOBS: 2
+ LIBSYSCONFCPUS: 4
+ JOBS: 4
BUILDTYPE: Debug
steps:
- install-dependencies: { ccache: false }
diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp
index f0efa7acba..1e1f4b78a8 100644
--- a/include/mbgl/style/layers/background_layer.hpp
+++ b/include/mbgl/style/layers/background_layer.hpp
@@ -25,20 +25,20 @@ public:
// Paint properties
static PropertyValue<Color> getDefaultBackgroundColor();
- PropertyValue<Color> getBackgroundColor() const;
- void setBackgroundColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getBackgroundColor() const;
+ void setBackgroundColor(const PropertyValue<Color>&);
void setBackgroundColorTransition(const TransitionOptions&);
TransitionOptions getBackgroundColorTransition() const;
static PropertyValue<std::string> getDefaultBackgroundPattern();
- PropertyValue<std::string> getBackgroundPattern() const;
- void setBackgroundPattern(PropertyValue<std::string>);
+ const PropertyValue<std::string>& getBackgroundPattern() const;
+ void setBackgroundPattern(const PropertyValue<std::string>&);
void setBackgroundPatternTransition(const TransitionOptions&);
TransitionOptions getBackgroundPatternTransition() const;
static PropertyValue<float> getDefaultBackgroundOpacity();
- PropertyValue<float> getBackgroundOpacity() const;
- void setBackgroundOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getBackgroundOpacity() const;
+ void setBackgroundOpacity(const PropertyValue<float>&);
void setBackgroundOpacityTransition(const TransitionOptions&);
TransitionOptions getBackgroundOpacityTransition() const;
diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp
index 08ec686ff2..4095bc8fe7 100644
--- a/include/mbgl/style/layers/circle_layer.hpp
+++ b/include/mbgl/style/layers/circle_layer.hpp
@@ -25,68 +25,68 @@ public:
// Paint properties
static PropertyValue<float> getDefaultCircleRadius();
- PropertyValue<float> getCircleRadius() const;
- void setCircleRadius(PropertyValue<float>);
+ const PropertyValue<float>& getCircleRadius() const;
+ void setCircleRadius(const PropertyValue<float>&);
void setCircleRadiusTransition(const TransitionOptions&);
TransitionOptions getCircleRadiusTransition() const;
static PropertyValue<Color> getDefaultCircleColor();
- PropertyValue<Color> getCircleColor() const;
- void setCircleColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getCircleColor() const;
+ void setCircleColor(const PropertyValue<Color>&);
void setCircleColorTransition(const TransitionOptions&);
TransitionOptions getCircleColorTransition() const;
static PropertyValue<float> getDefaultCircleBlur();
- PropertyValue<float> getCircleBlur() const;
- void setCircleBlur(PropertyValue<float>);
+ const PropertyValue<float>& getCircleBlur() const;
+ void setCircleBlur(const PropertyValue<float>&);
void setCircleBlurTransition(const TransitionOptions&);
TransitionOptions getCircleBlurTransition() const;
static PropertyValue<float> getDefaultCircleOpacity();
- PropertyValue<float> getCircleOpacity() const;
- void setCircleOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getCircleOpacity() const;
+ void setCircleOpacity(const PropertyValue<float>&);
void setCircleOpacityTransition(const TransitionOptions&);
TransitionOptions getCircleOpacityTransition() const;
static PropertyValue<std::array<float, 2>> getDefaultCircleTranslate();
- PropertyValue<std::array<float, 2>> getCircleTranslate() const;
- void setCircleTranslate(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getCircleTranslate() const;
+ void setCircleTranslate(const PropertyValue<std::array<float, 2>>&);
void setCircleTranslateTransition(const TransitionOptions&);
TransitionOptions getCircleTranslateTransition() const;
static PropertyValue<TranslateAnchorType> getDefaultCircleTranslateAnchor();
- PropertyValue<TranslateAnchorType> getCircleTranslateAnchor() const;
- void setCircleTranslateAnchor(PropertyValue<TranslateAnchorType>);
+ const PropertyValue<TranslateAnchorType>& getCircleTranslateAnchor() const;
+ void setCircleTranslateAnchor(const PropertyValue<TranslateAnchorType>&);
void setCircleTranslateAnchorTransition(const TransitionOptions&);
TransitionOptions getCircleTranslateAnchorTransition() const;
static PropertyValue<CirclePitchScaleType> getDefaultCirclePitchScale();
- PropertyValue<CirclePitchScaleType> getCirclePitchScale() const;
- void setCirclePitchScale(PropertyValue<CirclePitchScaleType>);
+ const PropertyValue<CirclePitchScaleType>& getCirclePitchScale() const;
+ void setCirclePitchScale(const PropertyValue<CirclePitchScaleType>&);
void setCirclePitchScaleTransition(const TransitionOptions&);
TransitionOptions getCirclePitchScaleTransition() const;
static PropertyValue<AlignmentType> getDefaultCirclePitchAlignment();
- PropertyValue<AlignmentType> getCirclePitchAlignment() const;
- void setCirclePitchAlignment(PropertyValue<AlignmentType>);
+ const PropertyValue<AlignmentType>& getCirclePitchAlignment() const;
+ void setCirclePitchAlignment(const PropertyValue<AlignmentType>&);
void setCirclePitchAlignmentTransition(const TransitionOptions&);
TransitionOptions getCirclePitchAlignmentTransition() const;
static PropertyValue<float> getDefaultCircleStrokeWidth();
- PropertyValue<float> getCircleStrokeWidth() const;
- void setCircleStrokeWidth(PropertyValue<float>);
+ const PropertyValue<float>& getCircleStrokeWidth() const;
+ void setCircleStrokeWidth(const PropertyValue<float>&);
void setCircleStrokeWidthTransition(const TransitionOptions&);
TransitionOptions getCircleStrokeWidthTransition() const;
static PropertyValue<Color> getDefaultCircleStrokeColor();
- PropertyValue<Color> getCircleStrokeColor() const;
- void setCircleStrokeColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getCircleStrokeColor() const;
+ void setCircleStrokeColor(const PropertyValue<Color>&);
void setCircleStrokeColorTransition(const TransitionOptions&);
TransitionOptions getCircleStrokeColorTransition() const;
static PropertyValue<float> getDefaultCircleStrokeOpacity();
- PropertyValue<float> getCircleStrokeOpacity() const;
- void setCircleStrokeOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getCircleStrokeOpacity() const;
+ void setCircleStrokeOpacity(const PropertyValue<float>&);
void setCircleStrokeOpacityTransition(const TransitionOptions&);
TransitionOptions getCircleStrokeOpacityTransition() const;
diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp
index c4b7ecfcdb..80152de80a 100644
--- a/include/mbgl/style/layers/fill_extrusion_layer.hpp
+++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp
@@ -25,50 +25,50 @@ public:
// Paint properties
static PropertyValue<float> getDefaultFillExtrusionOpacity();
- PropertyValue<float> getFillExtrusionOpacity() const;
- void setFillExtrusionOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getFillExtrusionOpacity() const;
+ void setFillExtrusionOpacity(const PropertyValue<float>&);
void setFillExtrusionOpacityTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionOpacityTransition() const;
static PropertyValue<Color> getDefaultFillExtrusionColor();
- PropertyValue<Color> getFillExtrusionColor() const;
- void setFillExtrusionColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getFillExtrusionColor() const;
+ void setFillExtrusionColor(const PropertyValue<Color>&);
void setFillExtrusionColorTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionColorTransition() const;
static PropertyValue<std::array<float, 2>> getDefaultFillExtrusionTranslate();
- PropertyValue<std::array<float, 2>> getFillExtrusionTranslate() const;
- void setFillExtrusionTranslate(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getFillExtrusionTranslate() const;
+ void setFillExtrusionTranslate(const PropertyValue<std::array<float, 2>>&);
void setFillExtrusionTranslateTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionTranslateTransition() const;
static PropertyValue<TranslateAnchorType> getDefaultFillExtrusionTranslateAnchor();
- PropertyValue<TranslateAnchorType> getFillExtrusionTranslateAnchor() const;
- void setFillExtrusionTranslateAnchor(PropertyValue<TranslateAnchorType>);
+ const PropertyValue<TranslateAnchorType>& getFillExtrusionTranslateAnchor() const;
+ void setFillExtrusionTranslateAnchor(const PropertyValue<TranslateAnchorType>&);
void setFillExtrusionTranslateAnchorTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionTranslateAnchorTransition() const;
static PropertyValue<std::string> getDefaultFillExtrusionPattern();
- PropertyValue<std::string> getFillExtrusionPattern() const;
- void setFillExtrusionPattern(PropertyValue<std::string>);
+ const PropertyValue<std::string>& getFillExtrusionPattern() const;
+ void setFillExtrusionPattern(const PropertyValue<std::string>&);
void setFillExtrusionPatternTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionPatternTransition() const;
static PropertyValue<float> getDefaultFillExtrusionHeight();
- PropertyValue<float> getFillExtrusionHeight() const;
- void setFillExtrusionHeight(PropertyValue<float>);
+ const PropertyValue<float>& getFillExtrusionHeight() const;
+ void setFillExtrusionHeight(const PropertyValue<float>&);
void setFillExtrusionHeightTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionHeightTransition() const;
static PropertyValue<float> getDefaultFillExtrusionBase();
- PropertyValue<float> getFillExtrusionBase() const;
- void setFillExtrusionBase(PropertyValue<float>);
+ const PropertyValue<float>& getFillExtrusionBase() const;
+ void setFillExtrusionBase(const PropertyValue<float>&);
void setFillExtrusionBaseTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionBaseTransition() const;
static PropertyValue<bool> getDefaultFillExtrusionVerticalGradient();
- PropertyValue<bool> getFillExtrusionVerticalGradient() const;
- void setFillExtrusionVerticalGradient(PropertyValue<bool>);
+ const PropertyValue<bool>& getFillExtrusionVerticalGradient() const;
+ void setFillExtrusionVerticalGradient(const PropertyValue<bool>&);
void setFillExtrusionVerticalGradientTransition(const TransitionOptions&);
TransitionOptions getFillExtrusionVerticalGradientTransition() const;
diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp
index 6a402f28f7..e4872a5fd8 100644
--- a/include/mbgl/style/layers/fill_layer.hpp
+++ b/include/mbgl/style/layers/fill_layer.hpp
@@ -25,44 +25,44 @@ public:
// Paint properties
static PropertyValue<bool> getDefaultFillAntialias();
- PropertyValue<bool> getFillAntialias() const;
- void setFillAntialias(PropertyValue<bool>);
+ const PropertyValue<bool>& getFillAntialias() const;
+ void setFillAntialias(const PropertyValue<bool>&);
void setFillAntialiasTransition(const TransitionOptions&);
TransitionOptions getFillAntialiasTransition() const;
static PropertyValue<float> getDefaultFillOpacity();
- PropertyValue<float> getFillOpacity() const;
- void setFillOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getFillOpacity() const;
+ void setFillOpacity(const PropertyValue<float>&);
void setFillOpacityTransition(const TransitionOptions&);
TransitionOptions getFillOpacityTransition() const;
static PropertyValue<Color> getDefaultFillColor();
- PropertyValue<Color> getFillColor() const;
- void setFillColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getFillColor() const;
+ void setFillColor(const PropertyValue<Color>&);
void setFillColorTransition(const TransitionOptions&);
TransitionOptions getFillColorTransition() const;
static PropertyValue<Color> getDefaultFillOutlineColor();
- PropertyValue<Color> getFillOutlineColor() const;
- void setFillOutlineColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getFillOutlineColor() const;
+ void setFillOutlineColor(const PropertyValue<Color>&);
void setFillOutlineColorTransition(const TransitionOptions&);
TransitionOptions getFillOutlineColorTransition() const;
static PropertyValue<std::array<float, 2>> getDefaultFillTranslate();
- PropertyValue<std::array<float, 2>> getFillTranslate() const;
- void setFillTranslate(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getFillTranslate() const;
+ void setFillTranslate(const PropertyValue<std::array<float, 2>>&);
void setFillTranslateTransition(const TransitionOptions&);
TransitionOptions getFillTranslateTransition() const;
static PropertyValue<TranslateAnchorType> getDefaultFillTranslateAnchor();
- PropertyValue<TranslateAnchorType> getFillTranslateAnchor() const;
- void setFillTranslateAnchor(PropertyValue<TranslateAnchorType>);
+ const PropertyValue<TranslateAnchorType>& getFillTranslateAnchor() const;
+ void setFillTranslateAnchor(const PropertyValue<TranslateAnchorType>&);
void setFillTranslateAnchorTransition(const TransitionOptions&);
TransitionOptions getFillTranslateAnchorTransition() const;
static PropertyValue<std::string> getDefaultFillPattern();
- PropertyValue<std::string> getFillPattern() const;
- void setFillPattern(PropertyValue<std::string>);
+ const PropertyValue<std::string>& getFillPattern() const;
+ void setFillPattern(const PropertyValue<std::string>&);
void setFillPatternTransition(const TransitionOptions&);
TransitionOptions getFillPatternTransition() const;
diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp
index 4c3ae0daf8..bbd9d6eb7b 100644
--- a/include/mbgl/style/layers/heatmap_layer.hpp
+++ b/include/mbgl/style/layers/heatmap_layer.hpp
@@ -26,32 +26,32 @@ public:
// Paint properties
static PropertyValue<float> getDefaultHeatmapRadius();
- PropertyValue<float> getHeatmapRadius() const;
- void setHeatmapRadius(PropertyValue<float>);
+ const PropertyValue<float>& getHeatmapRadius() const;
+ void setHeatmapRadius(const PropertyValue<float>&);
void setHeatmapRadiusTransition(const TransitionOptions&);
TransitionOptions getHeatmapRadiusTransition() const;
static PropertyValue<float> getDefaultHeatmapWeight();
- PropertyValue<float> getHeatmapWeight() const;
- void setHeatmapWeight(PropertyValue<float>);
+ const PropertyValue<float>& getHeatmapWeight() const;
+ void setHeatmapWeight(const PropertyValue<float>&);
void setHeatmapWeightTransition(const TransitionOptions&);
TransitionOptions getHeatmapWeightTransition() const;
static PropertyValue<float> getDefaultHeatmapIntensity();
- PropertyValue<float> getHeatmapIntensity() const;
- void setHeatmapIntensity(PropertyValue<float>);
+ const PropertyValue<float>& getHeatmapIntensity() const;
+ void setHeatmapIntensity(const PropertyValue<float>&);
void setHeatmapIntensityTransition(const TransitionOptions&);
TransitionOptions getHeatmapIntensityTransition() const;
static ColorRampPropertyValue getDefaultHeatmapColor();
- ColorRampPropertyValue getHeatmapColor() const;
- void setHeatmapColor(ColorRampPropertyValue);
+ const ColorRampPropertyValue& getHeatmapColor() const;
+ void setHeatmapColor(const ColorRampPropertyValue&);
void setHeatmapColorTransition(const TransitionOptions&);
TransitionOptions getHeatmapColorTransition() const;
static PropertyValue<float> getDefaultHeatmapOpacity();
- PropertyValue<float> getHeatmapOpacity() const;
- void setHeatmapOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getHeatmapOpacity() const;
+ void setHeatmapOpacity(const PropertyValue<float>&);
void setHeatmapOpacityTransition(const TransitionOptions&);
TransitionOptions getHeatmapOpacityTransition() const;
diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp
index 760e70aa75..d2eebadf9d 100644
--- a/include/mbgl/style/layers/hillshade_layer.hpp
+++ b/include/mbgl/style/layers/hillshade_layer.hpp
@@ -25,38 +25,38 @@ public:
// Paint properties
static PropertyValue<float> getDefaultHillshadeIlluminationDirection();
- PropertyValue<float> getHillshadeIlluminationDirection() const;
- void setHillshadeIlluminationDirection(PropertyValue<float>);
+ const PropertyValue<float>& getHillshadeIlluminationDirection() const;
+ void setHillshadeIlluminationDirection(const PropertyValue<float>&);
void setHillshadeIlluminationDirectionTransition(const TransitionOptions&);
TransitionOptions getHillshadeIlluminationDirectionTransition() const;
static PropertyValue<HillshadeIlluminationAnchorType> getDefaultHillshadeIlluminationAnchor();
- PropertyValue<HillshadeIlluminationAnchorType> getHillshadeIlluminationAnchor() const;
- void setHillshadeIlluminationAnchor(PropertyValue<HillshadeIlluminationAnchorType>);
+ const PropertyValue<HillshadeIlluminationAnchorType>& getHillshadeIlluminationAnchor() const;
+ void setHillshadeIlluminationAnchor(const PropertyValue<HillshadeIlluminationAnchorType>&);
void setHillshadeIlluminationAnchorTransition(const TransitionOptions&);
TransitionOptions getHillshadeIlluminationAnchorTransition() const;
static PropertyValue<float> getDefaultHillshadeExaggeration();
- PropertyValue<float> getHillshadeExaggeration() const;
- void setHillshadeExaggeration(PropertyValue<float>);
+ const PropertyValue<float>& getHillshadeExaggeration() const;
+ void setHillshadeExaggeration(const PropertyValue<float>&);
void setHillshadeExaggerationTransition(const TransitionOptions&);
TransitionOptions getHillshadeExaggerationTransition() const;
static PropertyValue<Color> getDefaultHillshadeShadowColor();
- PropertyValue<Color> getHillshadeShadowColor() const;
- void setHillshadeShadowColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getHillshadeShadowColor() const;
+ void setHillshadeShadowColor(const PropertyValue<Color>&);
void setHillshadeShadowColorTransition(const TransitionOptions&);
TransitionOptions getHillshadeShadowColorTransition() const;
static PropertyValue<Color> getDefaultHillshadeHighlightColor();
- PropertyValue<Color> getHillshadeHighlightColor() const;
- void setHillshadeHighlightColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getHillshadeHighlightColor() const;
+ void setHillshadeHighlightColor(const PropertyValue<Color>&);
void setHillshadeHighlightColorTransition(const TransitionOptions&);
TransitionOptions getHillshadeHighlightColorTransition() const;
static PropertyValue<Color> getDefaultHillshadeAccentColor();
- PropertyValue<Color> getHillshadeAccentColor() const;
- void setHillshadeAccentColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getHillshadeAccentColor() const;
+ void setHillshadeAccentColor(const PropertyValue<Color>&);
void setHillshadeAccentColorTransition(const TransitionOptions&);
TransitionOptions getHillshadeAccentColorTransition() const;
diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs
index a7a8ff35c5..8371f11910 100644
--- a/include/mbgl/style/layers/layer.hpp.ejs
+++ b/include/mbgl/style/layers/layer.hpp.ejs
@@ -43,8 +43,8 @@ public:
<% for (const property of layoutProperties) { -%>
static <%- propertyValueType(property) %> getDefault<%- camelize(property.name) %>();
- <%- propertyValueType(property) %> get<%- camelize(property.name) %>() const;
- void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>);
+ const <%- propertyValueType(property) %>& get<%- camelize(property.name) %>() const;
+ void set<%- camelize(property.name) %>(const <%- propertyValueType(property) %>&);
<% } -%>
<% } -%>
@@ -52,8 +52,8 @@ public:
<% for (const property of paintProperties) { -%>
static <%- propertyValueType(property) %> getDefault<%- camelize(property.name) %>();
- <%- propertyValueType(property) %> get<%- camelize(property.name) %>() const;
- void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>);
+ const <%- propertyValueType(property) %>& get<%- camelize(property.name) %>() const;
+ void set<%- camelize(property.name) %>(const <%- propertyValueType(property) %>&);
void set<%- camelize(property.name) %>Transition(const TransitionOptions&);
TransitionOptions get<%- camelize(property.name) %>Transition() const;
diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp
index 5993ac8730..21fdb3653e 100644
--- a/include/mbgl/style/layers/line_layer.hpp
+++ b/include/mbgl/style/layers/line_layer.hpp
@@ -28,86 +28,86 @@ public:
// Layout properties
static PropertyValue<LineCapType> getDefaultLineCap();
- PropertyValue<LineCapType> getLineCap() const;
- void setLineCap(PropertyValue<LineCapType>);
+ const PropertyValue<LineCapType>& getLineCap() const;
+ void setLineCap(const PropertyValue<LineCapType>&);
static PropertyValue<LineJoinType> getDefaultLineJoin();
- PropertyValue<LineJoinType> getLineJoin() const;
- void setLineJoin(PropertyValue<LineJoinType>);
+ const PropertyValue<LineJoinType>& getLineJoin() const;
+ void setLineJoin(const PropertyValue<LineJoinType>&);
static PropertyValue<float> getDefaultLineMiterLimit();
- PropertyValue<float> getLineMiterLimit() const;
- void setLineMiterLimit(PropertyValue<float>);
+ const PropertyValue<float>& getLineMiterLimit() const;
+ void setLineMiterLimit(const PropertyValue<float>&);
static PropertyValue<float> getDefaultLineRoundLimit();
- PropertyValue<float> getLineRoundLimit() const;
- void setLineRoundLimit(PropertyValue<float>);
+ const PropertyValue<float>& getLineRoundLimit() const;
+ void setLineRoundLimit(const PropertyValue<float>&);
// Paint properties
static PropertyValue<float> getDefaultLineOpacity();
- PropertyValue<float> getLineOpacity() const;
- void setLineOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getLineOpacity() const;
+ void setLineOpacity(const PropertyValue<float>&);
void setLineOpacityTransition(const TransitionOptions&);
TransitionOptions getLineOpacityTransition() const;
static PropertyValue<Color> getDefaultLineColor();
- PropertyValue<Color> getLineColor() const;
- void setLineColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getLineColor() const;
+ void setLineColor(const PropertyValue<Color>&);
void setLineColorTransition(const TransitionOptions&);
TransitionOptions getLineColorTransition() const;
static PropertyValue<std::array<float, 2>> getDefaultLineTranslate();
- PropertyValue<std::array<float, 2>> getLineTranslate() const;
- void setLineTranslate(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getLineTranslate() const;
+ void setLineTranslate(const PropertyValue<std::array<float, 2>>&);
void setLineTranslateTransition(const TransitionOptions&);
TransitionOptions getLineTranslateTransition() const;
static PropertyValue<TranslateAnchorType> getDefaultLineTranslateAnchor();
- PropertyValue<TranslateAnchorType> getLineTranslateAnchor() const;
- void setLineTranslateAnchor(PropertyValue<TranslateAnchorType>);
+ const PropertyValue<TranslateAnchorType>& getLineTranslateAnchor() const;
+ void setLineTranslateAnchor(const PropertyValue<TranslateAnchorType>&);
void setLineTranslateAnchorTransition(const TransitionOptions&);
TransitionOptions getLineTranslateAnchorTransition() const;
static PropertyValue<float> getDefaultLineWidth();
- PropertyValue<float> getLineWidth() const;
- void setLineWidth(PropertyValue<float>);
+ const PropertyValue<float>& getLineWidth() const;
+ void setLineWidth(const PropertyValue<float>&);
void setLineWidthTransition(const TransitionOptions&);
TransitionOptions getLineWidthTransition() const;
static PropertyValue<float> getDefaultLineGapWidth();
- PropertyValue<float> getLineGapWidth() const;
- void setLineGapWidth(PropertyValue<float>);
+ const PropertyValue<float>& getLineGapWidth() const;
+ void setLineGapWidth(const PropertyValue<float>&);
void setLineGapWidthTransition(const TransitionOptions&);
TransitionOptions getLineGapWidthTransition() const;
static PropertyValue<float> getDefaultLineOffset();
- PropertyValue<float> getLineOffset() const;
- void setLineOffset(PropertyValue<float>);
+ const PropertyValue<float>& getLineOffset() const;
+ void setLineOffset(const PropertyValue<float>&);
void setLineOffsetTransition(const TransitionOptions&);
TransitionOptions getLineOffsetTransition() const;
static PropertyValue<float> getDefaultLineBlur();
- PropertyValue<float> getLineBlur() const;
- void setLineBlur(PropertyValue<float>);
+ const PropertyValue<float>& getLineBlur() const;
+ void setLineBlur(const PropertyValue<float>&);
void setLineBlurTransition(const TransitionOptions&);
TransitionOptions getLineBlurTransition() const;
static PropertyValue<std::vector<float>> getDefaultLineDasharray();
- PropertyValue<std::vector<float>> getLineDasharray() const;
- void setLineDasharray(PropertyValue<std::vector<float>>);
+ const PropertyValue<std::vector<float>>& getLineDasharray() const;
+ void setLineDasharray(const PropertyValue<std::vector<float>>&);
void setLineDasharrayTransition(const TransitionOptions&);
TransitionOptions getLineDasharrayTransition() const;
static PropertyValue<std::string> getDefaultLinePattern();
- PropertyValue<std::string> getLinePattern() const;
- void setLinePattern(PropertyValue<std::string>);
+ const PropertyValue<std::string>& getLinePattern() const;
+ void setLinePattern(const PropertyValue<std::string>&);
void setLinePatternTransition(const TransitionOptions&);
TransitionOptions getLinePatternTransition() const;
static ColorRampPropertyValue getDefaultLineGradient();
- ColorRampPropertyValue getLineGradient() const;
- void setLineGradient(ColorRampPropertyValue);
+ const ColorRampPropertyValue& getLineGradient() const;
+ void setLineGradient(const ColorRampPropertyValue&);
void setLineGradientTransition(const TransitionOptions&);
TransitionOptions getLineGradientTransition() const;
diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp
index f4736c9dcd..bdd9857c39 100644
--- a/include/mbgl/style/layers/raster_layer.hpp
+++ b/include/mbgl/style/layers/raster_layer.hpp
@@ -25,50 +25,50 @@ public:
// Paint properties
static PropertyValue<float> getDefaultRasterOpacity();
- PropertyValue<float> getRasterOpacity() const;
- void setRasterOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getRasterOpacity() const;
+ void setRasterOpacity(const PropertyValue<float>&);
void setRasterOpacityTransition(const TransitionOptions&);
TransitionOptions getRasterOpacityTransition() const;
static PropertyValue<float> getDefaultRasterHueRotate();
- PropertyValue<float> getRasterHueRotate() const;
- void setRasterHueRotate(PropertyValue<float>);
+ const PropertyValue<float>& getRasterHueRotate() const;
+ void setRasterHueRotate(const PropertyValue<float>&);
void setRasterHueRotateTransition(const TransitionOptions&);
TransitionOptions getRasterHueRotateTransition() const;
static PropertyValue<float> getDefaultRasterBrightnessMin();
- PropertyValue<float> getRasterBrightnessMin() const;
- void setRasterBrightnessMin(PropertyValue<float>);
+ const PropertyValue<float>& getRasterBrightnessMin() const;
+ void setRasterBrightnessMin(const PropertyValue<float>&);
void setRasterBrightnessMinTransition(const TransitionOptions&);
TransitionOptions getRasterBrightnessMinTransition() const;
static PropertyValue<float> getDefaultRasterBrightnessMax();
- PropertyValue<float> getRasterBrightnessMax() const;
- void setRasterBrightnessMax(PropertyValue<float>);
+ const PropertyValue<float>& getRasterBrightnessMax() const;
+ void setRasterBrightnessMax(const PropertyValue<float>&);
void setRasterBrightnessMaxTransition(const TransitionOptions&);
TransitionOptions getRasterBrightnessMaxTransition() const;
static PropertyValue<float> getDefaultRasterSaturation();
- PropertyValue<float> getRasterSaturation() const;
- void setRasterSaturation(PropertyValue<float>);
+ const PropertyValue<float>& getRasterSaturation() const;
+ void setRasterSaturation(const PropertyValue<float>&);
void setRasterSaturationTransition(const TransitionOptions&);
TransitionOptions getRasterSaturationTransition() const;
static PropertyValue<float> getDefaultRasterContrast();
- PropertyValue<float> getRasterContrast() const;
- void setRasterContrast(PropertyValue<float>);
+ const PropertyValue<float>& getRasterContrast() const;
+ void setRasterContrast(const PropertyValue<float>&);
void setRasterContrastTransition(const TransitionOptions&);
TransitionOptions getRasterContrastTransition() const;
static PropertyValue<RasterResamplingType> getDefaultRasterResampling();
- PropertyValue<RasterResamplingType> getRasterResampling() const;
- void setRasterResampling(PropertyValue<RasterResamplingType>);
+ const PropertyValue<RasterResamplingType>& getRasterResampling() const;
+ void setRasterResampling(const PropertyValue<RasterResamplingType>&);
void setRasterResamplingTransition(const TransitionOptions&);
TransitionOptions getRasterResamplingTransition() const;
static PropertyValue<float> getDefaultRasterFadeDuration();
- PropertyValue<float> getRasterFadeDuration() const;
- void setRasterFadeDuration(PropertyValue<float>);
+ const PropertyValue<float>& getRasterFadeDuration() const;
+ void setRasterFadeDuration(const PropertyValue<float>&);
void setRasterFadeDurationTransition(const TransitionOptions&);
TransitionOptions getRasterFadeDurationTransition() const;
diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp
index 35fe72e6bf..c7082f232d 100644
--- a/include/mbgl/style/layers/symbol_layer.hpp
+++ b/include/mbgl/style/layers/symbol_layer.hpp
@@ -27,244 +27,244 @@ public:
// Layout properties
static PropertyValue<SymbolPlacementType> getDefaultSymbolPlacement();
- PropertyValue<SymbolPlacementType> getSymbolPlacement() const;
- void setSymbolPlacement(PropertyValue<SymbolPlacementType>);
+ const PropertyValue<SymbolPlacementType>& getSymbolPlacement() const;
+ void setSymbolPlacement(const PropertyValue<SymbolPlacementType>&);
static PropertyValue<float> getDefaultSymbolSpacing();
- PropertyValue<float> getSymbolSpacing() const;
- void setSymbolSpacing(PropertyValue<float>);
+ const PropertyValue<float>& getSymbolSpacing() const;
+ void setSymbolSpacing(const PropertyValue<float>&);
static PropertyValue<bool> getDefaultSymbolAvoidEdges();
- PropertyValue<bool> getSymbolAvoidEdges() const;
- void setSymbolAvoidEdges(PropertyValue<bool>);
+ const PropertyValue<bool>& getSymbolAvoidEdges() const;
+ void setSymbolAvoidEdges(const PropertyValue<bool>&);
static PropertyValue<SymbolZOrderType> getDefaultSymbolZOrder();
- PropertyValue<SymbolZOrderType> getSymbolZOrder() const;
- void setSymbolZOrder(PropertyValue<SymbolZOrderType>);
+ const PropertyValue<SymbolZOrderType>& getSymbolZOrder() const;
+ void setSymbolZOrder(const PropertyValue<SymbolZOrderType>&);
static PropertyValue<bool> getDefaultIconAllowOverlap();
- PropertyValue<bool> getIconAllowOverlap() const;
- void setIconAllowOverlap(PropertyValue<bool>);
+ const PropertyValue<bool>& getIconAllowOverlap() const;
+ void setIconAllowOverlap(const PropertyValue<bool>&);
static PropertyValue<bool> getDefaultIconIgnorePlacement();
- PropertyValue<bool> getIconIgnorePlacement() const;
- void setIconIgnorePlacement(PropertyValue<bool>);
+ const PropertyValue<bool>& getIconIgnorePlacement() const;
+ void setIconIgnorePlacement(const PropertyValue<bool>&);
static PropertyValue<bool> getDefaultIconOptional();
- PropertyValue<bool> getIconOptional() const;
- void setIconOptional(PropertyValue<bool>);
+ const PropertyValue<bool>& getIconOptional() const;
+ void setIconOptional(const PropertyValue<bool>&);
static PropertyValue<AlignmentType> getDefaultIconRotationAlignment();
- PropertyValue<AlignmentType> getIconRotationAlignment() const;
- void setIconRotationAlignment(PropertyValue<AlignmentType>);
+ const PropertyValue<AlignmentType>& getIconRotationAlignment() const;
+ void setIconRotationAlignment(const PropertyValue<AlignmentType>&);
static PropertyValue<float> getDefaultIconSize();
- PropertyValue<float> getIconSize() const;
- void setIconSize(PropertyValue<float>);
+ const PropertyValue<float>& getIconSize() const;
+ void setIconSize(const PropertyValue<float>&);
static PropertyValue<IconTextFitType> getDefaultIconTextFit();
- PropertyValue<IconTextFitType> getIconTextFit() const;
- void setIconTextFit(PropertyValue<IconTextFitType>);
+ const PropertyValue<IconTextFitType>& getIconTextFit() const;
+ void setIconTextFit(const PropertyValue<IconTextFitType>&);
static PropertyValue<std::array<float, 4>> getDefaultIconTextFitPadding();
- PropertyValue<std::array<float, 4>> getIconTextFitPadding() const;
- void setIconTextFitPadding(PropertyValue<std::array<float, 4>>);
+ const PropertyValue<std::array<float, 4>>& getIconTextFitPadding() const;
+ void setIconTextFitPadding(const PropertyValue<std::array<float, 4>>&);
static PropertyValue<std::string> getDefaultIconImage();
- PropertyValue<std::string> getIconImage() const;
- void setIconImage(PropertyValue<std::string>);
+ const PropertyValue<std::string>& getIconImage() const;
+ void setIconImage(const PropertyValue<std::string>&);
static PropertyValue<float> getDefaultIconRotate();
- PropertyValue<float> getIconRotate() const;
- void setIconRotate(PropertyValue<float>);
+ const PropertyValue<float>& getIconRotate() const;
+ void setIconRotate(const PropertyValue<float>&);
static PropertyValue<float> getDefaultIconPadding();
- PropertyValue<float> getIconPadding() const;
- void setIconPadding(PropertyValue<float>);
+ const PropertyValue<float>& getIconPadding() const;
+ void setIconPadding(const PropertyValue<float>&);
static PropertyValue<bool> getDefaultIconKeepUpright();
- PropertyValue<bool> getIconKeepUpright() const;
- void setIconKeepUpright(PropertyValue<bool>);
+ const PropertyValue<bool>& getIconKeepUpright() const;
+ void setIconKeepUpright(const PropertyValue<bool>&);
static PropertyValue<std::array<float, 2>> getDefaultIconOffset();
- PropertyValue<std::array<float, 2>> getIconOffset() const;
- void setIconOffset(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getIconOffset() const;
+ void setIconOffset(const PropertyValue<std::array<float, 2>>&);
static PropertyValue<SymbolAnchorType> getDefaultIconAnchor();
- PropertyValue<SymbolAnchorType> getIconAnchor() const;
- void setIconAnchor(PropertyValue<SymbolAnchorType>);
+ const PropertyValue<SymbolAnchorType>& getIconAnchor() const;
+ void setIconAnchor(const PropertyValue<SymbolAnchorType>&);
static PropertyValue<AlignmentType> getDefaultIconPitchAlignment();
- PropertyValue<AlignmentType> getIconPitchAlignment() const;
- void setIconPitchAlignment(PropertyValue<AlignmentType>);
+ const PropertyValue<AlignmentType>& getIconPitchAlignment() const;
+ void setIconPitchAlignment(const PropertyValue<AlignmentType>&);
static PropertyValue<AlignmentType> getDefaultTextPitchAlignment();
- PropertyValue<AlignmentType> getTextPitchAlignment() const;
- void setTextPitchAlignment(PropertyValue<AlignmentType>);
+ const PropertyValue<AlignmentType>& getTextPitchAlignment() const;
+ void setTextPitchAlignment(const PropertyValue<AlignmentType>&);
static PropertyValue<AlignmentType> getDefaultTextRotationAlignment();
- PropertyValue<AlignmentType> getTextRotationAlignment() const;
- void setTextRotationAlignment(PropertyValue<AlignmentType>);
+ const PropertyValue<AlignmentType>& getTextRotationAlignment() const;
+ void setTextRotationAlignment(const PropertyValue<AlignmentType>&);
static PropertyValue<expression::Formatted> getDefaultTextField();
- PropertyValue<expression::Formatted> getTextField() const;
- void setTextField(PropertyValue<expression::Formatted>);
+ const PropertyValue<expression::Formatted>& getTextField() const;
+ void setTextField(const PropertyValue<expression::Formatted>&);
static PropertyValue<std::vector<std::string>> getDefaultTextFont();
- PropertyValue<std::vector<std::string>> getTextFont() const;
- void setTextFont(PropertyValue<std::vector<std::string>>);
+ const PropertyValue<std::vector<std::string>>& getTextFont() const;
+ void setTextFont(const PropertyValue<std::vector<std::string>>&);
static PropertyValue<float> getDefaultTextSize();
- PropertyValue<float> getTextSize() const;
- void setTextSize(PropertyValue<float>);
+ const PropertyValue<float>& getTextSize() const;
+ void setTextSize(const PropertyValue<float>&);
static PropertyValue<float> getDefaultTextMaxWidth();
- PropertyValue<float> getTextMaxWidth() const;
- void setTextMaxWidth(PropertyValue<float>);
+ const PropertyValue<float>& getTextMaxWidth() const;
+ void setTextMaxWidth(const PropertyValue<float>&);
static PropertyValue<float> getDefaultTextLineHeight();
- PropertyValue<float> getTextLineHeight() const;
- void setTextLineHeight(PropertyValue<float>);
+ const PropertyValue<float>& getTextLineHeight() const;
+ void setTextLineHeight(const PropertyValue<float>&);
static PropertyValue<float> getDefaultTextLetterSpacing();
- PropertyValue<float> getTextLetterSpacing() const;
- void setTextLetterSpacing(PropertyValue<float>);
+ const PropertyValue<float>& getTextLetterSpacing() const;
+ void setTextLetterSpacing(const PropertyValue<float>&);
static PropertyValue<TextJustifyType> getDefaultTextJustify();
- PropertyValue<TextJustifyType> getTextJustify() const;
- void setTextJustify(PropertyValue<TextJustifyType>);
+ const PropertyValue<TextJustifyType>& getTextJustify() const;
+ void setTextJustify(const PropertyValue<TextJustifyType>&);
static PropertyValue<float> getDefaultTextRadialOffset();
- PropertyValue<float> getTextRadialOffset() const;
- void setTextRadialOffset(PropertyValue<float>);
+ const PropertyValue<float>& getTextRadialOffset() const;
+ void setTextRadialOffset(const PropertyValue<float>&);
static PropertyValue<std::vector<TextVariableAnchorType>> getDefaultTextVariableAnchor();
- PropertyValue<std::vector<TextVariableAnchorType>> getTextVariableAnchor() const;
- void setTextVariableAnchor(PropertyValue<std::vector<TextVariableAnchorType>>);
+ const PropertyValue<std::vector<TextVariableAnchorType>>& getTextVariableAnchor() const;
+ void setTextVariableAnchor(const PropertyValue<std::vector<TextVariableAnchorType>>&);
static PropertyValue<SymbolAnchorType> getDefaultTextAnchor();
- PropertyValue<SymbolAnchorType> getTextAnchor() const;
- void setTextAnchor(PropertyValue<SymbolAnchorType>);
+ const PropertyValue<SymbolAnchorType>& getTextAnchor() const;
+ void setTextAnchor(const PropertyValue<SymbolAnchorType>&);
static PropertyValue<float> getDefaultTextMaxAngle();
- PropertyValue<float> getTextMaxAngle() const;
- void setTextMaxAngle(PropertyValue<float>);
+ const PropertyValue<float>& getTextMaxAngle() const;
+ void setTextMaxAngle(const PropertyValue<float>&);
static PropertyValue<float> getDefaultTextRotate();
- PropertyValue<float> getTextRotate() const;
- void setTextRotate(PropertyValue<float>);
+ const PropertyValue<float>& getTextRotate() const;
+ void setTextRotate(const PropertyValue<float>&);
static PropertyValue<float> getDefaultTextPadding();
- PropertyValue<float> getTextPadding() const;
- void setTextPadding(PropertyValue<float>);
+ const PropertyValue<float>& getTextPadding() const;
+ void setTextPadding(const PropertyValue<float>&);
static PropertyValue<bool> getDefaultTextKeepUpright();
- PropertyValue<bool> getTextKeepUpright() const;
- void setTextKeepUpright(PropertyValue<bool>);
+ const PropertyValue<bool>& getTextKeepUpright() const;
+ void setTextKeepUpright(const PropertyValue<bool>&);
static PropertyValue<TextTransformType> getDefaultTextTransform();
- PropertyValue<TextTransformType> getTextTransform() const;
- void setTextTransform(PropertyValue<TextTransformType>);
+ const PropertyValue<TextTransformType>& getTextTransform() const;
+ void setTextTransform(const PropertyValue<TextTransformType>&);
static PropertyValue<std::array<float, 2>> getDefaultTextOffset();
- PropertyValue<std::array<float, 2>> getTextOffset() const;
- void setTextOffset(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getTextOffset() const;
+ void setTextOffset(const PropertyValue<std::array<float, 2>>&);
static PropertyValue<bool> getDefaultTextAllowOverlap();
- PropertyValue<bool> getTextAllowOverlap() const;
- void setTextAllowOverlap(PropertyValue<bool>);
+ const PropertyValue<bool>& getTextAllowOverlap() const;
+ void setTextAllowOverlap(const PropertyValue<bool>&);
static PropertyValue<bool> getDefaultTextIgnorePlacement();
- PropertyValue<bool> getTextIgnorePlacement() const;
- void setTextIgnorePlacement(PropertyValue<bool>);
+ const PropertyValue<bool>& getTextIgnorePlacement() const;
+ void setTextIgnorePlacement(const PropertyValue<bool>&);
static PropertyValue<bool> getDefaultTextOptional();
- PropertyValue<bool> getTextOptional() const;
- void setTextOptional(PropertyValue<bool>);
+ const PropertyValue<bool>& getTextOptional() const;
+ void setTextOptional(const PropertyValue<bool>&);
// Paint properties
static PropertyValue<float> getDefaultIconOpacity();
- PropertyValue<float> getIconOpacity() const;
- void setIconOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getIconOpacity() const;
+ void setIconOpacity(const PropertyValue<float>&);
void setIconOpacityTransition(const TransitionOptions&);
TransitionOptions getIconOpacityTransition() const;
static PropertyValue<Color> getDefaultIconColor();
- PropertyValue<Color> getIconColor() const;
- void setIconColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getIconColor() const;
+ void setIconColor(const PropertyValue<Color>&);
void setIconColorTransition(const TransitionOptions&);
TransitionOptions getIconColorTransition() const;
static PropertyValue<Color> getDefaultIconHaloColor();
- PropertyValue<Color> getIconHaloColor() const;
- void setIconHaloColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getIconHaloColor() const;
+ void setIconHaloColor(const PropertyValue<Color>&);
void setIconHaloColorTransition(const TransitionOptions&);
TransitionOptions getIconHaloColorTransition() const;
static PropertyValue<float> getDefaultIconHaloWidth();
- PropertyValue<float> getIconHaloWidth() const;
- void setIconHaloWidth(PropertyValue<float>);
+ const PropertyValue<float>& getIconHaloWidth() const;
+ void setIconHaloWidth(const PropertyValue<float>&);
void setIconHaloWidthTransition(const TransitionOptions&);
TransitionOptions getIconHaloWidthTransition() const;
static PropertyValue<float> getDefaultIconHaloBlur();
- PropertyValue<float> getIconHaloBlur() const;
- void setIconHaloBlur(PropertyValue<float>);
+ const PropertyValue<float>& getIconHaloBlur() const;
+ void setIconHaloBlur(const PropertyValue<float>&);
void setIconHaloBlurTransition(const TransitionOptions&);
TransitionOptions getIconHaloBlurTransition() const;
static PropertyValue<std::array<float, 2>> getDefaultIconTranslate();
- PropertyValue<std::array<float, 2>> getIconTranslate() const;
- void setIconTranslate(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getIconTranslate() const;
+ void setIconTranslate(const PropertyValue<std::array<float, 2>>&);
void setIconTranslateTransition(const TransitionOptions&);
TransitionOptions getIconTranslateTransition() const;
static PropertyValue<TranslateAnchorType> getDefaultIconTranslateAnchor();
- PropertyValue<TranslateAnchorType> getIconTranslateAnchor() const;
- void setIconTranslateAnchor(PropertyValue<TranslateAnchorType>);
+ const PropertyValue<TranslateAnchorType>& getIconTranslateAnchor() const;
+ void setIconTranslateAnchor(const PropertyValue<TranslateAnchorType>&);
void setIconTranslateAnchorTransition(const TransitionOptions&);
TransitionOptions getIconTranslateAnchorTransition() const;
static PropertyValue<float> getDefaultTextOpacity();
- PropertyValue<float> getTextOpacity() const;
- void setTextOpacity(PropertyValue<float>);
+ const PropertyValue<float>& getTextOpacity() const;
+ void setTextOpacity(const PropertyValue<float>&);
void setTextOpacityTransition(const TransitionOptions&);
TransitionOptions getTextOpacityTransition() const;
static PropertyValue<Color> getDefaultTextColor();
- PropertyValue<Color> getTextColor() const;
- void setTextColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getTextColor() const;
+ void setTextColor(const PropertyValue<Color>&);
void setTextColorTransition(const TransitionOptions&);
TransitionOptions getTextColorTransition() const;
static PropertyValue<Color> getDefaultTextHaloColor();
- PropertyValue<Color> getTextHaloColor() const;
- void setTextHaloColor(PropertyValue<Color>);
+ const PropertyValue<Color>& getTextHaloColor() const;
+ void setTextHaloColor(const PropertyValue<Color>&);
void setTextHaloColorTransition(const TransitionOptions&);
TransitionOptions getTextHaloColorTransition() const;
static PropertyValue<float> getDefaultTextHaloWidth();
- PropertyValue<float> getTextHaloWidth() const;
- void setTextHaloWidth(PropertyValue<float>);
+ const PropertyValue<float>& getTextHaloWidth() const;
+ void setTextHaloWidth(const PropertyValue<float>&);
void setTextHaloWidthTransition(const TransitionOptions&);
TransitionOptions getTextHaloWidthTransition() const;
static PropertyValue<float> getDefaultTextHaloBlur();
- PropertyValue<float> getTextHaloBlur() const;
- void setTextHaloBlur(PropertyValue<float>);
+ const PropertyValue<float>& getTextHaloBlur() const;
+ void setTextHaloBlur(const PropertyValue<float>&);
void setTextHaloBlurTransition(const TransitionOptions&);
TransitionOptions getTextHaloBlurTransition() const;
static PropertyValue<std::array<float, 2>> getDefaultTextTranslate();
- PropertyValue<std::array<float, 2>> getTextTranslate() const;
- void setTextTranslate(PropertyValue<std::array<float, 2>>);
+ const PropertyValue<std::array<float, 2>>& getTextTranslate() const;
+ void setTextTranslate(const PropertyValue<std::array<float, 2>>&);
void setTextTranslateTransition(const TransitionOptions&);
TransitionOptions getTextTranslateTransition() const;
static PropertyValue<TranslateAnchorType> getDefaultTextTranslateAnchor();
- PropertyValue<TranslateAnchorType> getTextTranslateAnchor() const;
- void setTextTranslateAnchor(PropertyValue<TranslateAnchorType>);
+ const PropertyValue<TranslateAnchorType>& getTextTranslateAnchor() const;
+ void setTextTranslateAnchor(const PropertyValue<TranslateAnchorType>&);
void setTextTranslateAnchorTransition(const TransitionOptions&);
TransitionOptions getTextTranslateAnchorTransition() const;
diff --git a/platform/default/src/mbgl/storage/default_file_source.cpp b/platform/default/src/mbgl/storage/default_file_source.cpp
index 4d812044cf..1ccf999109 100644
--- a/platform/default/src/mbgl/storage/default_file_source.cpp
+++ b/platform/default/src/mbgl/storage/default_file_source.cpp
@@ -14,13 +14,14 @@
#include <mbgl/util/stopwatch.hpp>
#include <cassert>
+#include <utility>
namespace mbgl {
class DefaultFileSource::Impl {
public:
Impl(std::shared_ptr<FileSource> assetFileSource_, std::string cachePath, uint64_t maximumCacheSize)
- : assetFileSource(assetFileSource_)
+ : assetFileSource(std::move(assetFileSource_))
, localFileSource(std::make_unique<LocalFileSource>())
, offlineDatabase(std::make_unique<OfflineDatabase>(cachePath, maximumCacheSize)) {
}
diff --git a/platform/default/src/mbgl/storage/offline.cpp b/platform/default/src/mbgl/storage/offline.cpp
index fd945c724f..dd809ad129 100644
--- a/platform/default/src/mbgl/storage/offline.cpp
+++ b/platform/default/src/mbgl/storage/offline.cpp
@@ -10,6 +10,7 @@
#include <rapidjson/writer.h>
#include <cmath>
+#include <utility>
namespace mbgl {
@@ -33,7 +34,7 @@ OfflineTilePyramidRegionDefinition::OfflineTilePyramidRegionDefinition(
// OfflineGeometryRegionDefinition
OfflineGeometryRegionDefinition::OfflineGeometryRegionDefinition(std::string styleURL_, Geometry<double> geometry_, double minZoom_, double maxZoom_, float pixelRatio_, bool includeIdeographs_)
- : styleURL(styleURL_)
+ : styleURL(std::move(styleURL_))
, geometry(std::move(geometry_))
, minZoom(minZoom_)
, maxZoom(maxZoom_)
diff --git a/platform/default/src/mbgl/text/bidi.cpp b/platform/default/src/mbgl/text/bidi.cpp
index 32a3dc23ef..6bb2d36446 100644
--- a/platform/default/src/mbgl/text/bidi.cpp
+++ b/platform/default/src/mbgl/text/bidi.cpp
@@ -180,7 +180,7 @@ std::vector<StyledText> BiDi::processStyledText(const StyledText& input, std::se
std::u16string BiDi::writeReverse(const std::u16string& input, std::size_t logicalStart, std::size_t logicalEnd) {
UErrorCode errorCode = U_ZERO_ERROR;
- int32_t logicalLength = static_cast<int32_t>(logicalEnd - logicalStart);
+ auto logicalLength = static_cast<int32_t>(logicalEnd - logicalStart);
std::u16string outputText(logicalLength + 1, 0);
// UBIDI_DO_MIRRORING: Apply unicode mirroring of characters like parentheses
diff --git a/platform/node/src/node_expression.cpp b/platform/node/src/node_expression.cpp
index 4f1e392505..e980c464d8 100644
--- a/platform/node/src/node_expression.cpp
+++ b/platform/node/src/node_expression.cpp
@@ -173,7 +173,7 @@ struct ToValue {
} else {
serializedSection.emplace("fontStack", mbgl::NullValue());
}
- sections.push_back(serializedSection);
+ sections.emplace_back(serializedSection);
}
serialized.emplace("sections", sections);
@@ -205,7 +205,7 @@ v8::Local<v8::Value> toJS(const Value& value) {
}
void NodeExpression::Evaluate(const Nan::FunctionCallbackInfo<v8::Value>& info) {
- NodeExpression* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
+ auto* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
const std::unique_ptr<Expression>& expression = nodeExpr->expression;
if (info.Length() < 2 || !info[0]->IsObject()) {
@@ -246,7 +246,7 @@ void NodeExpression::Evaluate(const Nan::FunctionCallbackInfo<v8::Value>& info)
}
void NodeExpression::GetType(const Nan::FunctionCallbackInfo<v8::Value>& info) {
- NodeExpression* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
+ auto* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
const std::unique_ptr<Expression>& expression = nodeExpr->expression;
const type::Type type = expression->getType();
@@ -255,19 +255,19 @@ void NodeExpression::GetType(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}
void NodeExpression::IsFeatureConstant(const Nan::FunctionCallbackInfo<v8::Value>& info) {
- NodeExpression* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
+ auto* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
const std::unique_ptr<Expression>& expression = nodeExpr->expression;
info.GetReturnValue().Set(Nan::New(isFeatureConstant(*expression)));
}
void NodeExpression::IsZoomConstant(const Nan::FunctionCallbackInfo<v8::Value>& info) {
- NodeExpression* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
+ auto* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
const std::unique_ptr<Expression>& expression = nodeExpr->expression;
info.GetReturnValue().Set(Nan::New(isZoomConstant(*expression)));
}
void NodeExpression::Serialize(const Nan::FunctionCallbackInfo<v8::Value>& info) {
- NodeExpression* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
+ auto* nodeExpr = ObjectWrap::Unwrap<NodeExpression>(info.Holder());
const std::unique_ptr<Expression>& expression = nodeExpr->expression;
const mbgl::Value serialized = expression->serialize();
diff --git a/platform/node/src/node_feature.cpp b/platform/node/src/node_feature.cpp
index ee1cdab031..2dfab686a7 100644
--- a/platform/node/src/node_feature.cpp
+++ b/platform/node/src/node_feature.cpp
@@ -47,9 +47,9 @@ public:
}
private:
- v8::Local<v8::String> type(const char* type) {
+ v8::Local<v8::String> type(const char* type_) {
Nan::EscapableHandleScope scope;
- return scope.Escape(Nan::New(type).ToLocalChecked());
+ return scope.Escape(Nan::New(type_).ToLocalChecked());
}
};
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 291dea6bb7..7156a1f1bf 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -1254,10 +1254,10 @@ std::unique_ptr<mbgl::AsyncRequest> NodeFileSource::request(const mbgl::Resource
Nan::Set(instance, Nan::New("url").ToLocalChecked(), Nan::New(resource.url).ToLocalChecked());
Nan::Set(instance, Nan::New("kind").ToLocalChecked(), Nan::New<v8::Integer>(resource.kind));
- auto request = Nan::ObjectWrap::Unwrap<node_mbgl::NodeRequest>(instance);
- request->Execute();
+ auto req = Nan::ObjectWrap::Unwrap<node_mbgl::NodeRequest>(instance);
+ req->Execute();
- return std::make_unique<node_mbgl::NodeRequest::NodeAsyncRequest>(request);
+ return std::make_unique<node_mbgl::NodeRequest::NodeAsyncRequest>(req);
}
} // namespace node_mbgl
diff --git a/scripts/clang-tidy-diff.py b/scripts/clang-tidy-diff.py
new file mode 100755
index 0000000000..e5e0ff3911
--- /dev/null
+++ b/scripts/clang-tidy-diff.py
@@ -0,0 +1,201 @@
+#!/usr/bin/env python
+#
+#===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+r"""
+ClangTidy Diff Checker
+======================
+
+This script reads input from a unified diff, runs clang-tidy on all changed
+files and outputs clang-tidy warnings in changed lines only. This is useful to
+detect clang-tidy regressions in the lines touched by a specific patch.
+Example usage for git/svn users:
+
+ git diff -U0 HEAD^ | clang-tidy-diff.py -p1
+ svn diff --diff-cmd=diff -x-U0 | \
+ clang-tidy-diff.py -fix -checks=-*,modernize-use-override
+
+"""
+
+import argparse
+import json
+import re
+import subprocess
+import sys
+import multiprocessing
+import os
+import threading
+
+is_py2 = sys.version[0] == '2'
+
+if is_py2:
+ import Queue as queue
+else:
+ import queue as queue
+
+def run_tidy(command, lines_by_file, queue, failed_files):
+ """Takes filenames out of queue and runs clang-tidy on them."""
+ while True:
+ name = queue.get()
+
+ line_filter_json = json.dumps([{"name" : name, "lines" : lines_by_file[name]}], separators = (',', ':'))
+ if sys.platform == 'win32':
+ line_filter_json = re.sub(r'"', r'"""', line_filter_json)
+ else:
+ line_filter_json = "'" + line_filter_json + "'";
+
+ invocation = list(command)
+ invocation.append('-line-filter=' + line_filter_json)
+ invocation.append(name)
+
+ sys.stdout.write('Checking differences in {}...\n'.format(name))
+ return_code = subprocess.call(' '.join(invocation), shell=True)
+ if return_code != 0:
+ failed_files.append(name)
+ queue.task_done()
+
+def main():
+ parser = argparse.ArgumentParser(description=
+ 'Run clang-tidy against changed files, and '
+ 'output diagnostics only for modified '
+ 'lines.')
+ parser.add_argument('-clang-tidy-binary', metavar='PATH',
+ default='clang-tidy',
+ help='path to clang-tidy binary')
+ parser.add_argument('-p', metavar='NUM', default=0,
+ help='strip the smallest prefix containing P slashes')
+ parser.add_argument('-regex', metavar='PATTERN', default=None,
+ help='custom pattern selecting file paths to check '
+ '(case sensitive, overrides -iregex)')
+ parser.add_argument('-iregex', metavar='PATTERN', default=
+ r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)',
+ help='custom pattern selecting file paths to check '
+ '(case insensitive, overridden by -regex)')
+
+ parser.add_argument('-fix', action='store_true', default=False,
+ help='apply suggested fixes')
+ parser.add_argument('-checks',
+ help='checks filter, when not specified, use clang-tidy '
+ 'default',
+ default='')
+ parser.add_argument('-path', dest='build_path',
+ help='Path used to read a compile command database.')
+ parser.add_argument('-extra-arg', dest='extra_arg',
+ action='append', default=[],
+ help='Additional argument to append to the compiler '
+ 'command line.')
+ parser.add_argument('-extra-arg-before', dest='extra_arg_before',
+ action='append', default=[],
+ help='Additional argument to prepend to the compiler '
+ 'command line.')
+ parser.add_argument('-j', type=int, default=0,
+ help='number of tidy instances to be run in parallel.')
+ parser.add_argument('-quiet', action='store_true', default=False,
+ help='Run clang-tidy in quiet mode')
+ clang_tidy_args = []
+ argv = sys.argv[1:]
+ if '--' in argv:
+ clang_tidy_args.extend(argv[argv.index('--'):])
+ argv = argv[:argv.index('--')]
+
+ args = parser.parse_args(argv)
+
+ # Extract changed lines for each file.
+ filename = None
+ lines_by_file = {}
+ for line in sys.stdin:
+ match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\n\"]*)' % args.p, line)
+ if match:
+ filename = match.group(2)
+ if filename == None:
+ continue
+
+ if args.regex is not None:
+ if not re.match('^%s$' % args.regex, filename):
+ continue
+ else:
+ if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
+ continue
+
+ match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
+ if match:
+ start_line = int(match.group(1))
+ line_count = 1
+ if match.group(3):
+ line_count = int(match.group(3))
+ if line_count == 0:
+ continue
+ end_line = start_line + line_count - 1;
+ lines_by_file.setdefault(filename, []).append([start_line, end_line])
+
+ if len(lines_by_file) == 0:
+ print("No relevant changes found.")
+ sys.exit(0)
+
+ # Run clang-tidy on files containing changes.
+ command = [args.clang_tidy_binary]
+ if args.fix:
+ command.append('-fix')
+ if args.checks != '':
+ command.append('-checks=' + quote + args.checks + quote)
+ if args.quiet:
+ command.append('-quiet')
+ if args.build_path is not None:
+ command.append('-p=%s' % args.build_path)
+ for arg in args.extra_arg:
+ command.append('-extra-arg=%s' % arg)
+ for arg in args.extra_arg_before:
+ command.append('-extra-arg-before=%s' % arg)
+ command.extend(clang_tidy_args)
+
+ try:
+ invocation = list(command)
+ invocation.append('-')
+ subprocess.check_call(invocation)
+ except:
+ print("Unable to run clang-tidy: {}".format(' '.join(command)))
+ sys.exit(1)
+
+ max_task = args.j
+ if max_task == 0:
+ max_task = multiprocessing.cpu_count()
+
+ return_code = 0
+ try:
+ # Spin up a bunch of tidy-launching threads.
+ task_queue = queue.Queue(max_task)
+ # List of files with a non-zero return code.
+ failed_files = []
+ for _ in range(max_task):
+ t = threading.Thread(target=run_tidy,
+ args=(command, lines_by_file, task_queue, failed_files))
+ t.daemon = True
+ t.start()
+
+ # Fill the queue with files.
+ for name in lines_by_file:
+ task_queue.put(name)
+
+ # Wait for all threads to be done.
+ task_queue.join()
+ if len(failed_files):
+ return_code = 1
+
+ except KeyboardInterrupt:
+ # This is a sad hack. Unfortunately subprocess goes
+ # bonkers with ctrl-c and we start forking merrily.
+ print('\nCtrl-C detected, goodbye.')
+ os.kill(0, 9)
+ return_code = 1
+
+ sys.exit(return_code)
+
+if __name__ == '__main__':
+ main()
diff --git a/scripts/clang-tools.sh b/scripts/clang-tools.sh
index 1e73951176..54a3958488 100755
--- a/scripts/clang-tools.sh
+++ b/scripts/clang-tools.sh
@@ -1,64 +1,31 @@
#!/usr/bin/env bash
-set -e
-set -o pipefail
+set -euo pipefail
-CLANG_TIDY_PREFIX=${CLANG_TIDY_PREFIX:-$(scripts/mason.sh PREFIX clang-tidy VERSION 4.0.1)}
-CLANG_TIDY=${CLANG_TIDY:-${CLANG_TIDY_PREFIX}/bin/clang-tidy}
-CLANG_APPLY=${CLANG_APPLY:-${CLANG_TIDY_PREFIX}/bin/clang-apply-replacements}
+CLANG_TIDY_PREFIX=${CLANG_TIDY_PREFIX:-$(scripts/mason.sh PREFIX clang-tidy VERSION 7.0.0)}
+CLANG_TIDY=${CLANG_TIDY_PREFIX}/bin/clang-tidy
+CLANG_APPLY=${CLANG_TIDY_PREFIX}/bin/clang-apply-replacements
-CLANG_FORMAT=${CLANG_FORMAT:-$(scripts/mason.sh PREFIX clang-format VERSION 4.0.1)/bin/clang-format}
-
-for CLANG_FILE in "${CLANG_TIDY} ${CLANG_APPLY} ${CLANG_FORMAT}"; do
- command -v ${CLANG_TIDY} > /dev/null 2>&1 || {
+for CLANG_FILE in "${CLANG_TIDY}" "${CLANG_APPLY}"; do
+ command -v "${CLANG_FILE}" > /dev/null 2>&1 || {
echo "Can't find ${CLANG_FILE} in PATH."
- if [ -z ${CLANG_FILE} ]; then
+ if [ -z "${CLANG_FILE}" ]; then
echo "Alternatively, you can manually set ${!CLANG_FILE@}."
fi
exit 1
}
done
-cd $1
-
-export CDUP=$(git rev-parse --show-cdup)
-export CLANG_TIDY CLANG_APPLY CLANG_FORMAT
-
-function run_clang_tidy() {
- FILES=$(git ls-files "src/mbgl/*.cpp" "platform/*.cpp" "test/*.cpp")
- ${CLANG_TIDY_PREFIX}/share/run-clang-tidy.py -j ${JOBS} \
- -clang-tidy-binary ${CLANG_TIDY} \
- -clang-apply-replacements-binary ${CLANG_APPLY} \
- -fix ${FILES} 2>/dev/null || exit 1
-}
-
-function run_clang_tidy_diff() {
- OUTPUT=$(git diff origin/$2 --src-prefix=${CDUP} --dst-prefix=${CDUP} | \
- ${CLANG_TIDY_PREFIX}/share/clang-tidy-diff.py \
- -clang-tidy-binary ${CLANG_TIDY} \
- 2>/dev/null)
- if [[ -n $OUTPUT ]] && [[ $OUTPUT != "No relevant changes found." ]]; then
- echo -e "${OUTPUT}"
- exit 1
- fi
-}
-
-function run_clang_format() {
- echo "Running clang-format on $0..."
- DIFF_FILES=$(git diff origin/$2 --name-only *cpp)
- echo "${DIFF_FILES}" | xargs -I{} -P ${JOBS} bash -c 'run_clang_format' {}
- ${CLANG_FORMAT} -i ${CDUP}/$0 || exit 1
-}
-
-export -f run_clang_tidy run_clang_tidy_diff run_clang_format
-
echo "Running Clang checks... (this might take a while)"
-if [[ -n $3 ]] && [[ $3 == "--diff" ]]; then
- run_clang_tidy_diff $@
- # XXX disabled until we run clang-format over the entire codebase.
- #run_clang_format $@
- echo "All checks pass!"
+if [[ -n ${3:-} ]] && [[ ${3:-} == "--diff" ]]; then
+ git diff "origin/$2" | "scripts/clang-tidy-diff.py" \
+ -clang-tidy-binary "${CLANG_TIDY}" \
+ -p 1 -quiet -path "$1"
else
- run_clang_tidy $@
+ git ls-files "src/*.cpp" "test/*.cpp" "platform/*.cpp" "bin/*.cpp" | \
+ xargs "${CLANG_TIDY_PREFIX}/share/run-clang-tidy.py" \
+ -clang-tidy-binary "${CLANG_TIDY}" \
+ -clang-apply-replacements-binary "${CLANG_APPLY}" \
+ -quiet -p "$1" -fix
fi
diff --git a/src/mbgl/actor/mailbox.cpp b/src/mbgl/actor/mailbox.cpp
index 8ee8dca114..dfe0520790 100644
--- a/src/mbgl/actor/mailbox.cpp
+++ b/src/mbgl/actor/mailbox.cpp
@@ -6,8 +6,7 @@
namespace mbgl {
-Mailbox::Mailbox() {
-}
+Mailbox::Mailbox() = default;
Mailbox::Mailbox(Scheduler& scheduler_)
: scheduler(&scheduler_) {
diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp
index 7ece03c78a..6c3c9eb617 100644
--- a/src/mbgl/annotation/annotation_tile.cpp
+++ b/src/mbgl/annotation/annotation_tile.cpp
@@ -64,7 +64,7 @@ GeometryCollection AnnotationTileFeature::getGeometries() const {
class AnnotationTileLayerData {
public:
- AnnotationTileLayerData(const std::string& name_) : name(name_) {
+ AnnotationTileLayerData(std::string name_) : name(std::move(name_)) {
}
const std::string name;
diff --git a/src/mbgl/annotation/line_annotation_impl.cpp b/src/mbgl/annotation/line_annotation_impl.cpp
index 315a36954b..533a137a3d 100644
--- a/src/mbgl/annotation/line_annotation_impl.cpp
+++ b/src/mbgl/annotation/line_annotation_impl.cpp
@@ -22,7 +22,7 @@ void LineAnnotationImpl::updateStyle(Style::Impl& style) const {
layer = style.addLayer(std::move(newLayer), AnnotationManager::PointLayerID);
}
- LineLayer* lineLayer = static_cast<LineLayer*>(layer);
+ auto* lineLayer = static_cast<LineLayer*>(layer);
lineLayer->setLineOpacity(annotation.opacity);
lineLayer->setLineWidth(annotation.width);
lineLayer->setLineColor(annotation.color);
diff --git a/src/mbgl/layout/symbol_instance.cpp b/src/mbgl/layout/symbol_instance.cpp
index 0197df1066..809aa2f451 100644
--- a/src/mbgl/layout/symbol_instance.cpp
+++ b/src/mbgl/layout/symbol_instance.cpp
@@ -1,5 +1,6 @@
#include <mbgl/layout/symbol_instance.hpp>
#include <mbgl/style/layers/symbol_layer_properties.hpp>
+#include <utility>
namespace mbgl {
@@ -34,7 +35,7 @@ SymbolInstance::SymbolInstance(Anchor& anchor_,
const IndexedSubfeature& indexedFeature,
const std::size_t layoutFeatureIndex_,
const std::size_t dataFeatureIndex_,
- const std::u16string& key_,
+ std::u16string key_,
const float overscaling,
const float rotate,
float radialTextOffset_) :
@@ -52,7 +53,7 @@ SymbolInstance::SymbolInstance(Anchor& anchor_,
dataFeatureIndex(dataFeatureIndex_),
textOffset(textOffset_),
iconOffset(iconOffset_),
- key(key_),
+ key(std::move(key_)),
textBoxScale(textBoxScale_),
radialTextOffset(radialTextOffset_),
singleLine(shapedTextOrientations.singleLine) {
diff --git a/src/mbgl/layout/symbol_instance.hpp b/src/mbgl/layout/symbol_instance.hpp
index 5169b16adb..95159deeb1 100644
--- a/src/mbgl/layout/symbol_instance.hpp
+++ b/src/mbgl/layout/symbol_instance.hpp
@@ -40,7 +40,7 @@ public:
const IndexedSubfeature&,
const std::size_t layoutFeatureIndex,
const std::size_t dataFeatureIndex,
- const std::u16string& key,
+ std::u16string key,
const float overscaling,
const float rotate,
float radialTextOffset);
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index d1c50d7773..badc352f76 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -117,8 +117,7 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters,
FontStack baseFontStack = layout.evaluate<TextFont>(zoom, ft);
ft.formattedText = TaggedString();
- for (std::size_t j = 0; j < formatted.sections.size(); j++) {
- const auto& section = formatted.sections[j];
+ for (const auto & section : formatted.sections) {
std::string u8string = section.text;
if (textTransform == TextTransformType::Uppercase) {
u8string = platform::uppercase(u8string);
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index b22a9ee2f2..c31bb8ca34 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -252,7 +252,7 @@ CameraOptions Map::cameraForGeometry(const Geometry<double>& geometry, const Edg
std::vector<LatLng> latLngs;
forEachPoint(geometry, [&](const Point<double>& pt) {
- latLngs.push_back({ pt.y, pt.x });
+ latLngs.emplace_back(pt.y, pt.x);
});
return cameraForLatLngs(latLngs, padding, bearing, pitch);
}
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp
index 68f683c8d6..a0ebab20be 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.cpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp
@@ -203,8 +203,8 @@ void SymbolBucket::sortFeatures(const float angle) {
std::sort(symbolInstanceIndexes.begin(), symbolInstanceIndexes.end(), [sin, cos, this](size_t &aIndex, size_t &bIndex) {
const SymbolInstance& a = symbolInstances[aIndex];
const SymbolInstance& b = symbolInstances[bIndex];
- const int32_t aRotated = static_cast<int32_t>(::lround(sin * a.anchor.point.x + cos * a.anchor.point.y));
- const int32_t bRotated = static_cast<int32_t>(::lround(sin * b.anchor.point.x + cos * b.anchor.point.y));
+ const auto aRotated = static_cast<int32_t>(::lround(sin * a.anchor.point.x + cos * a.anchor.point.y));
+ const auto bRotated = static_cast<int32_t>(::lround(sin * b.anchor.point.x + cos * b.anchor.point.y));
return aRotated != bRotated ?
aRotated < bRotated :
a.dataFeatureIndex > b.dataFeatureIndex;
diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp
index 0b99460e76..9284ed8238 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.cpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.cpp
@@ -59,7 +59,7 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*)
}
// TODO: remove cast
- gl::Context& glContext = static_cast<gl::Context&>(paintParameters.context);
+ auto& glContext = static_cast<gl::Context&>(paintParameters.context);
const TransformState& state = paintParameters.state;
// Reset GL state to a known state so the CustomLayer always has a clean slate.
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index 6f69916734..4041e420df 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -138,7 +138,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
continue;
}
const auto fillPatternValue = evaluated.get<FillExtrusionPattern>().constantOr(mbgl::Faded<std::basic_string<char> >{"", ""});
- GeometryTile& geometryTile = static_cast<GeometryTile&>(tile.tile);
+ auto& geometryTile = static_cast<GeometryTile&>(tile.tile);
optional<ImagePosition> patternPosA = geometryTile.getPattern(fillPatternValue.from);
optional<ImagePosition> patternPosB = geometryTile.getPattern(fillPatternValue.to);
FillExtrusionBucket& bucket = *bucket_;
diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp
index aba1481044..e6447c83a4 100644
--- a/src/mbgl/renderer/layers/render_fill_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_layer.cpp
@@ -150,7 +150,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
}
const auto fillPatternValue = evaluated.get<FillPattern>().constantOr(Faded<std::basic_string<char>>{"", ""});
for (const RenderTile& tile : renderTiles) {
- GeometryTile& geometryTile = static_cast<GeometryTile&>(tile.tile);
+ auto& geometryTile = static_cast<GeometryTile&>(tile.tile);
optional<ImagePosition> patternPosA = geometryTile.getPattern(fillPatternValue.from);
optional<ImagePosition> patternPosB = geometryTile.getPattern(fillPatternValue.to);
diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
index 5736280892..08efa898f6 100644
--- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp
+++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp
@@ -61,7 +61,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
if (parameters.pass != RenderPass::Translucent && parameters.pass != RenderPass::Pass3D)
return;
- RenderRasterDEMSource* demsrc = static_cast<RenderRasterDEMSource*>(src);
+ auto* demsrc = static_cast<RenderRasterDEMSource*>(src);
const uint8_t TERRAIN_RGB_MAXZOOM = 15;
const uint8_t maxzoom = demsrc != nullptr ? demsrc->getMaxZoom() : TERRAIN_RGB_MAXZOOM;
diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp
index ba6d045b49..2ea910f911 100644
--- a/src/mbgl/renderer/layers/render_line_layer.cpp
+++ b/src/mbgl/renderer/layers/render_line_layer.cpp
@@ -126,7 +126,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
} else if (!unevaluated.get<LinePattern>().isUndefined()) {
const auto linePatternValue = evaluated.get<LinePattern>().constantOr(Faded<std::basic_string<char>>{ "", ""});
- GeometryTile& geometryTile = static_cast<GeometryTile&>(tile.tile);
+ auto& geometryTile = static_cast<GeometryTile&>(tile.tile);
const Size texsize = geometryTile.iconAtlasTexture->size;
optional<ImagePosition> posA = geometryTile.getPattern(linePatternValue.from);
diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp
index 4964afe6a7..55caeaf5b0 100644
--- a/src/mbgl/renderer/layers/render_raster_layer.cpp
+++ b/src/mbgl/renderer/layers/render_raster_layer.cpp
@@ -127,7 +127,7 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
const gfx::TextureFilterType filter = evaluated.get<RasterResampling>() == RasterResamplingType::Nearest ? gfx::TextureFilterType::Nearest : gfx::TextureFilterType::Linear;
- if (RenderImageSource* imageSource = source->as<RenderImageSource>()) {
+ if (auto* imageSource = source->as<RenderImageSource>()) {
if (imageSource->isEnabled() && imageSource->isLoaded() && !imageSource->bucket->needsUpload()) {
RasterBucket& bucket = *imageSource->bucket;
assert(bucket.texture);
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 84ce0a73e0..17bb08c0ea 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -148,7 +148,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
};
assert(tile.tile.kind == Tile::Kind::Geometry);
- GeometryTile& geometryTile = static_cast<GeometryTile&>(tile.tile);
+ auto& geometryTile = static_cast<GeometryTile&>(tile.tile);
if (bucket.hasIconData()) {
auto values = iconPropertyValues(evaluated_, layout);
diff --git a/src/mbgl/renderer/render_source.cpp b/src/mbgl/renderer/render_source.cpp
index dfe1f25ed6..81638605f0 100644
--- a/src/mbgl/renderer/render_source.cpp
+++ b/src/mbgl/renderer/render_source.cpp
@@ -11,6 +11,7 @@
#include <mbgl/tile/tile.hpp>
#include <mbgl/layermanager/layer_manager.hpp>
+#include <utility>
namespace mbgl {
@@ -50,7 +51,7 @@ std::unique_ptr<RenderSource> RenderSource::create(Immutable<Source::Impl> impl)
static RenderSourceObserver nullObserver;
RenderSource::RenderSource(Immutable<style::Source::Impl> impl)
- : baseImpl(impl),
+ : baseImpl(std::move(impl)),
observer(&nullObserver) {
}
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 87178d775e..f1fb31f693 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -576,7 +576,7 @@ void Renderer::Impl::queryRenderedSymbols(std::unordered_map<std::string, std::v
auto renderedSymbols = placement->getCollisionIndex().queryRenderedSymbols(geometry);
std::vector<std::reference_wrapper<const RetainedQueryData>> bucketQueryData;
for (auto entry : renderedSymbols) {
- bucketQueryData.push_back(placement->getQueryData(entry.first));
+ bucketQueryData.emplace_back(placement->getQueryData(entry.first));
}
// Although symbol query is global, symbol results are only sortable within a bucket
// For a predictable global sort renderItems, we sort the buckets based on their corresponding tile position
diff --git a/src/mbgl/renderer/sources/render_geojson_source.cpp b/src/mbgl/renderer/sources/render_geojson_source.cpp
index 5eb6a931d3..3cfcfc7392 100644
--- a/src/mbgl/renderer/sources/render_geojson_source.cpp
+++ b/src/mbgl/renderer/sources/render_geojson_source.cpp
@@ -66,7 +66,7 @@ MAPBOX_ETERNAL_CONSTEXPR const auto extensionGetters = mapbox::eternal::hash_map
{"expansion-zoom", &getClusterExpansionZoom}
});
-}
+} // namespace
RenderGeoJSONSource::RenderGeoJSONSource(Immutable<style::GeoJSONSource::Impl> impl_)
: RenderSource(impl_) {
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
index 102125be19..7190f25bc7 100644
--- a/src/mbgl/renderer/sources/render_image_source.cpp
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -38,10 +38,10 @@ void RenderImageSource::startRender(PaintParameters& parameters) {
matrices.clear();
- for (size_t i = 0; i < tileIds.size(); i++) {
+ for (auto& tileId : tileIds) {
mat4 matrix;
matrix::identity(matrix);
- parameters.state.matrixFor(matrix, tileIds[i]);
+ parameters.state.matrixFor(matrix, tileId);
matrix::multiply(matrix, parameters.alignedProjMatrix, matrix);
matrices.push_back(matrix);
}
@@ -167,7 +167,7 @@ void RenderImageSource::update(Immutable<style::Source::Impl> baseImpl_,
auto idealTiles = util::tileCover(transformState, transformState.getZoom());
for (auto tile : idealTiles) {
if (tile.wrap != 0 && tileCover[0].canonical.isChildOf(tile.canonical)) {
- tileIds.push_back({ tile.wrap, tileCover[0].canonical });
+ tileIds.emplace_back(tile.wrap, tileCover[0].canonical);
hasVisibleTile = true;
}
else if (!hasVisibleTile) {
diff --git a/src/mbgl/renderer/sources/render_raster_dem_source.cpp b/src/mbgl/renderer/sources/render_raster_dem_source.cpp
index 2bc3a91c7c..63ab3ca370 100644
--- a/src/mbgl/renderer/sources/render_raster_dem_source.cpp
+++ b/src/mbgl/renderer/sources/render_raster_dem_source.cpp
@@ -60,7 +60,7 @@ void RenderRasterDEMSource::update(Immutable<style::Source::Impl> baseImpl_,
}
void RenderRasterDEMSource::onTileChanged(Tile& tile){
- RasterDEMTile& demtile = static_cast<RasterDEMTile&>(tile);
+ auto& demtile = static_cast<RasterDEMTile&>(tile);
std::map<DEMTileNeighbors, DEMTileNeighbors> opposites = {
{ DEMTileNeighbors::Left, DEMTileNeighbors::Right },
@@ -104,13 +104,13 @@ void RenderRasterDEMSource::onTileChanged(Tile& tile){
};
for (uint8_t i = 0; i < 8; i++) {
- DEMTileNeighbors mask = DEMTileNeighbors(std::pow(2,i));
+ auto mask = DEMTileNeighbors(std::pow(2,i));
// only backfill if this neighbor has not been previously backfilled
if ((demtile.neighboringTiles & mask) != mask) {
OverscaledTileID neighborid = getNeighbor(mask);
Tile* renderableNeighbor = tilePyramid.getTile(neighborid);
if (renderableNeighbor != nullptr && renderableNeighbor->isRenderable()) {
- RasterDEMTile& borderTile = static_cast<RasterDEMTile&>(*renderableNeighbor);
+ auto& borderTile = static_cast<RasterDEMTile&>(*renderableNeighbor);
demtile.backfillBorder(borderTile, mask);
// if the border tile has not been backfilled by a previous instance of the main
diff --git a/src/mbgl/storage/file_source.cpp b/src/mbgl/storage/file_source.cpp
index 5854682771..5f60a05278 100644
--- a/src/mbgl/storage/file_source.cpp
+++ b/src/mbgl/storage/file_source.cpp
@@ -18,7 +18,7 @@ std::shared_ptr<FileSource> FileSource::getSharedFileSource(const ResourceOption
it = it->second.expired() ? fileSources.erase(it) : ++it;
}
- const uint64_t context = reinterpret_cast<uint64_t>(options.platformContext());
+ const auto context = reinterpret_cast<uint64_t>(options.platformContext());
const std::string key = options.baseURL() + '|' + options.accessToken() + '|' + options.cachePath() + '|' + util::toString(context);
std::shared_ptr<mbgl::FileSource> fileSource;
diff --git a/src/mbgl/style/conversion/filter.cpp b/src/mbgl/style/conversion/filter.cpp
index 18a29ed808..4e8d9c48e5 100644
--- a/src/mbgl/style/conversion/filter.cpp
+++ b/src/mbgl/style/conversion/filter.cpp
@@ -233,7 +233,7 @@ optional<mbgl::Value> serializeLegacyFilter(const Convertible& values) {
if (arrayValue) {
result.push_back(*arrayValue);
} else {
- result.push_back(NullValue());
+ result.emplace_back(NullValue());
}
}
return (mbgl::Value)result;
diff --git a/src/mbgl/style/conversion/function.cpp b/src/mbgl/style/conversion/function.cpp
index df4decc73e..579924c78c 100644
--- a/src/mbgl/style/conversion/function.cpp
+++ b/src/mbgl/style/conversion/function.cpp
@@ -251,7 +251,7 @@ static optional<std::unique_ptr<Expression>> convertLiteral(type::Type type, con
error.message = "value must be an array of numbers";
return nullopt;
}
- result.push_back(double(*number));
+ result.emplace_back(double(*number));
}
return literal(result);
},
@@ -264,7 +264,7 @@ static optional<std::unique_ptr<Expression>> convertLiteral(type::Type type, con
error.message = "value must be an array of strings";
return nullopt;
}
- result.push_back(*string);
+ result.emplace_back(*string);
}
return literal(result);
},
diff --git a/src/mbgl/style/custom_tile_loader.cpp b/src/mbgl/style/custom_tile_loader.cpp
index 1c587302b8..48fd5ae9e2 100644
--- a/src/mbgl/style/custom_tile_loader.cpp
+++ b/src/mbgl/style/custom_tile_loader.cpp
@@ -20,9 +20,9 @@ void CustomTileLoader::fetchTile(const OverscaledTileID& tileID, ActorRef<Custom
auto tuple = std::make_tuple(tileID.overscaledZ, tileID.wrap, tileRef);
tileCallbackMap.insert({ tileID.canonical, std::vector<OverscaledIDFunctionTuple>(1, tuple) });
} else {
- for (auto iter = tileCallbacks->second.begin(); iter != tileCallbacks->second.end(); iter++) {
- if (std::get<0>(*iter) == tileID.overscaledZ && std::get<1>(*iter) == tileID.wrap ) {
- std::get<2>(*iter) = tileRef;
+ for (auto& iter : tileCallbacks->second) {
+ if (std::get<0>(iter) == tileID.overscaledZ && std::get<1>(iter) == tileID.wrap ) {
+ std::get<2>(iter) = tileRef;
return;
}
}
@@ -70,8 +70,8 @@ void CustomTileLoader::setTileData(const CanonicalTileID& tileID, const GeoJSON&
void CustomTileLoader::invalidateTile(const CanonicalTileID& tileID) {
auto tileCallbacks = tileCallbackMap.find(tileID);
if (tileCallbacks == tileCallbackMap.end()) { return; }
- for (auto iter = tileCallbacks->second.begin(); iter != tileCallbacks->second.end(); iter++) {
- auto actor = std::get<2>(*iter);
+ for (auto& iter : tileCallbacks->second) {
+ auto actor = std::get<2>(iter);
actor.invoke(&CustomGeometryTile::invalidateTileData);
invokeTileCancel(tileID);
}
@@ -82,20 +82,20 @@ void CustomTileLoader::invalidateTile(const CanonicalTileID& tileID) {
void CustomTileLoader::invalidateRegion(const LatLngBounds& bounds, Range<uint8_t> ) {
std::map<uint8_t, util::TileRange> tileRanges;
- for (auto idtuple= tileCallbackMap.begin(); idtuple != tileCallbackMap.end(); idtuple++) {
- auto zoom = idtuple->first.z;
+ for (auto& idtuple : tileCallbackMap) {
+ auto zoom = idtuple.first.z;
auto tileRange = tileRanges.find(zoom);
if(tileRange == tileRanges.end()) {
tileRange = tileRanges.emplace(std::make_pair(zoom, util::TileRange::fromLatLngBounds(bounds, zoom))).first;
}
- if (tileRange->second.contains(idtuple->first)) {
- for (auto iter = idtuple->second.begin(); iter != idtuple->second.end(); iter++) {
+ if (tileRange->second.contains(idtuple.first)) {
+ for (auto iter = idtuple.second.begin(); iter != idtuple.second.end(); iter++) {
auto actor = std::get<2>(*iter);
actor.invoke(&CustomGeometryTile::invalidateTileData);
- invokeTileCancel(idtuple->first);
- dataCache.erase(idtuple->first);
+ invokeTileCancel(idtuple.first);
+ dataCache.erase(idtuple.first);
}
- idtuple->second.clear();
+ idtuple.second.clear();
}
}
}
diff --git a/src/mbgl/style/expression/boolean_operator.cpp b/src/mbgl/style/expression/boolean_operator.cpp
index fa472270ce..a02c08131f 100644
--- a/src/mbgl/style/expression/boolean_operator.cpp
+++ b/src/mbgl/style/expression/boolean_operator.cpp
@@ -6,8 +6,8 @@ namespace style {
namespace expression {
EvaluationResult Any::evaluate(const EvaluationContext& params) const {
- for (auto it = inputs.begin(); it != inputs.end(); it++) {
- const EvaluationResult result = (*it)->evaluate(params);
+ for (const auto& input : inputs) {
+ const EvaluationResult result = input->evaluate(params);
if (!result) return result;
if (result->get<bool>()) return EvaluationResult(true);
}
@@ -34,8 +34,8 @@ std::vector<optional<Value>> Any::possibleOutputs() const {
EvaluationResult All::evaluate(const EvaluationContext& params) const {
- for (auto it = inputs.begin(); it != inputs.end(); it++) {
- const EvaluationResult result = (*it)->evaluate(params);
+ for (const auto& input : inputs) {
+ const EvaluationResult result = input->evaluate(params);
if (!result) return result;
if (!result->get<bool>()) return EvaluationResult(false);
}
diff --git a/src/mbgl/style/expression/case.cpp b/src/mbgl/style/expression/case.cpp
index 0c2ff0d7cd..314551592f 100644
--- a/src/mbgl/style/expression/case.cpp
+++ b/src/mbgl/style/expression/case.cpp
@@ -86,7 +86,7 @@ ParseResult Case::parse(const Convertible& value, ParsingContext& ctx) {
outputType = (*output)->getType();
}
- branches.push_back(std::make_pair(std::move(*test), std::move(*output)));
+ branches.emplace_back(std::move(*test), std::move(*output));
}
assert(outputType);
diff --git a/src/mbgl/style/expression/coercion.cpp b/src/mbgl/style/expression/coercion.cpp
index 75a6056081..e0c29be1a2 100644
--- a/src/mbgl/style/expression/coercion.cpp
+++ b/src/mbgl/style/expression/coercion.cpp
@@ -113,7 +113,7 @@ mbgl::Value Coercion::serialize() const {
// by string expressions that get implicitly coerced to "formatted".
std::vector<mbgl::Value> serialized{{ std::string("format") }};
serialized.push_back(inputs[0]->serialize());
- serialized.push_back(std::unordered_map<std::string, mbgl::Value>());
+ serialized.emplace_back(std::unordered_map<std::string, mbgl::Value>());
return serialized;
} else {
return Expression::serialize();
diff --git a/src/mbgl/style/expression/comparison.cpp b/src/mbgl/style/expression/comparison.cpp
index cdcdb5d59c..aa5808a975 100644
--- a/src/mbgl/style/expression/comparison.cpp
+++ b/src/mbgl/style/expression/comparison.cpp
@@ -2,6 +2,7 @@
#include <mbgl/style/expression/comparison.hpp>
#include <mbgl/style/expression/dsl.hpp>
#include <mbgl/style/conversion_impl.hpp>
+#include <utility>
namespace mbgl {
namespace style {
@@ -149,7 +150,7 @@ CollatorComparison::CollatorComparison(
std::unique_ptr<Expression> rhs_,
std::unique_ptr<Expression> collator_)
: Expression(Kind::Comparison, type::Boolean),
- op(op_),
+ op(std::move(op_)),
compare(getCollatorComparisonFunction(op)),
lhs(std::move(lhs_)),
rhs(std::move(rhs_)),
diff --git a/src/mbgl/style/expression/dsl.cpp b/src/mbgl/style/expression/dsl.cpp
index e7d90ba07b..b4fd8fa551 100644
--- a/src/mbgl/style/expression/dsl.cpp
+++ b/src/mbgl/style/expression/dsl.cpp
@@ -41,7 +41,7 @@ std::unique_ptr<Expression> literal(Value value) {
std::unique_ptr<Expression> literal(std::initializer_list<double> value) {
std::vector<Value> values;
for (auto i : value) {
- values.push_back(i);
+ values.emplace_back(i);
}
return literal(values);
}
@@ -49,7 +49,7 @@ std::unique_ptr<Expression> literal(std::initializer_list<double> value) {
std::unique_ptr<Expression> literal(std::initializer_list<const char *> value) {
std::vector<Value> values;
for (auto i : value) {
- values.push_back(std::string(i));
+ values.emplace_back(std::string(i));
}
return literal(values);
}
diff --git a/src/mbgl/style/expression/format_expression.cpp b/src/mbgl/style/expression/format_expression.cpp
index b5e4ba62c4..743942c769 100644
--- a/src/mbgl/style/expression/format_expression.cpp
+++ b/src/mbgl/style/expression/format_expression.cpp
@@ -152,7 +152,7 @@ mbgl::Value FormatExpression::serialize() const {
if (section.textColor) {
options.emplace(kFormattedSectionTextColor, (*section.textColor)->serialize());
}
- serialized.push_back(options);
+ serialized.emplace_back(options);
}
return serialized;
}
diff --git a/src/mbgl/style/expression/formatted.cpp b/src/mbgl/style/expression/formatted.cpp
index 3fa39b2cdc..5d45806ecb 100644
--- a/src/mbgl/style/expression/formatted.cpp
+++ b/src/mbgl/style/expression/formatted.cpp
@@ -104,7 +104,7 @@ optional<Formatted> Converter<Formatted>::operator()(const Convertible& value, E
}
}
- sections.push_back(FormattedSection(*sectionText, fontScale, textFont, textColor));
+ sections.emplace_back(*sectionText, fontScale, textFont, textColor);
}
return Formatted(sections);
} else if (optional<std::string> result = toString(value)) {
diff --git a/src/mbgl/style/expression/let.cpp b/src/mbgl/style/expression/let.cpp
index 592ceed58a..5acd52f578 100644
--- a/src/mbgl/style/expression/let.cpp
+++ b/src/mbgl/style/expression/let.cpp
@@ -12,8 +12,8 @@ EvaluationResult Let::evaluate(const EvaluationContext& params) const {
}
void Let::eachChild(const std::function<void(const Expression&)>& visit) const {
- for (auto it = bindings.begin(); it != bindings.end(); it++) {
- visit(*it->second);
+ for (const auto& binding : bindings) {
+ visit(*binding.second);
}
visit(*result);
}
diff --git a/src/mbgl/style/expression/match.cpp b/src/mbgl/style/expression/match.cpp
index 93627e9df1..70d3ac8d6d 100644
--- a/src/mbgl/style/expression/match.cpp
+++ b/src/mbgl/style/expression/match.cpp
@@ -287,7 +287,7 @@ ParseResult parseMatch(const Convertible& value, ParsingContext& ctx) {
outputType = (*output)->getType();
}
- branches.push_back(std::make_pair(std::move(labels), std::move(*output)));
+ branches.emplace_back(std::move(labels), std::move(*output));
}
auto input = ctx.parse(arrayMember(value, 1), 1, {type::Value});
diff --git a/src/mbgl/style/expression/step.cpp b/src/mbgl/style/expression/step.cpp
index 39b04c04a0..170e84bfc6 100644
--- a/src/mbgl/style/expression/step.cpp
+++ b/src/mbgl/style/expression/step.cpp
@@ -46,13 +46,13 @@ EvaluationResult Step::evaluate(const EvaluationContext& params) const {
void Step::eachChild(const std::function<void(const Expression&)>& visit) const {
visit(*input);
- for (auto it = stops.begin(); it != stops.end(); it++) {
- visit(*it->second);
+ for (const auto& stop : stops) {
+ visit(*stop.second);
}
}
void Step::eachStop(const std::function<void(double, const Expression&)>& visit) const {
- for (const auto &stop : stops) {
+ for (const auto& stop : stops) {
visit(stop.first, *stop.second);
}
}
diff --git a/src/mbgl/style/expression/value.cpp b/src/mbgl/style/expression/value.cpp
index e826a8a3cc..7e11efaa09 100644
--- a/src/mbgl/style/expression/value.cpp
+++ b/src/mbgl/style/expression/value.cpp
@@ -171,7 +171,7 @@ mbgl::Value ValueConverter<mbgl::Value>::fromExpressionValue(const Value& value)
options.emplace("text-color", fromExpressionValue(*section.textColor));
}
- serialized.push_back(options);
+ serialized.emplace_back(options);
}
return serialized;
},
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp
index 89b367b632..8d2b1b144b 100644
--- a/src/mbgl/style/layers/background_layer.cpp
+++ b/src/mbgl/style/layers/background_layer.cpp
@@ -66,11 +66,11 @@ PropertyValue<Color> BackgroundLayer::getDefaultBackgroundColor() {
return { Color::black() };
}
-PropertyValue<Color> BackgroundLayer::getBackgroundColor() const {
+const PropertyValue<Color>& BackgroundLayer::getBackgroundColor() const {
return impl().paint.template get<BackgroundColor>().value;
}
-void BackgroundLayer::setBackgroundColor(PropertyValue<Color> value) {
+void BackgroundLayer::setBackgroundColor(const PropertyValue<Color>& value) {
if (value == getBackgroundColor())
return;
auto impl_ = mutableImpl();
@@ -93,11 +93,11 @@ PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() {
return { "" };
}
-PropertyValue<std::string> BackgroundLayer::getBackgroundPattern() const {
+const PropertyValue<std::string>& BackgroundLayer::getBackgroundPattern() const {
return impl().paint.template get<BackgroundPattern>().value;
}
-void BackgroundLayer::setBackgroundPattern(PropertyValue<std::string> value) {
+void BackgroundLayer::setBackgroundPattern(const PropertyValue<std::string>& value) {
if (value == getBackgroundPattern())
return;
auto impl_ = mutableImpl();
@@ -120,11 +120,11 @@ PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() {
return { 1 };
}
-PropertyValue<float> BackgroundLayer::getBackgroundOpacity() const {
+const PropertyValue<float>& BackgroundLayer::getBackgroundOpacity() const {
return impl().paint.template get<BackgroundOpacity>().value;
}
-void BackgroundLayer::setBackgroundOpacity(PropertyValue<float> value) {
+void BackgroundLayer::setBackgroundOpacity(const PropertyValue<float>& value) {
if (value == getBackgroundOpacity())
return;
auto impl_ = mutableImpl();
@@ -169,7 +169,7 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::BackgroundColor) {
diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp
index 18f9a62f74..f2e3649c5a 100644
--- a/src/mbgl/style/layers/circle_layer.cpp
+++ b/src/mbgl/style/layers/circle_layer.cpp
@@ -66,11 +66,11 @@ PropertyValue<float> CircleLayer::getDefaultCircleRadius() {
return { 5 };
}
-PropertyValue<float> CircleLayer::getCircleRadius() const {
+const PropertyValue<float>& CircleLayer::getCircleRadius() const {
return impl().paint.template get<CircleRadius>().value;
}
-void CircleLayer::setCircleRadius(PropertyValue<float> value) {
+void CircleLayer::setCircleRadius(const PropertyValue<float>& value) {
if (value == getCircleRadius())
return;
auto impl_ = mutableImpl();
@@ -93,11 +93,11 @@ PropertyValue<Color> CircleLayer::getDefaultCircleColor() {
return { Color::black() };
}
-PropertyValue<Color> CircleLayer::getCircleColor() const {
+const PropertyValue<Color>& CircleLayer::getCircleColor() const {
return impl().paint.template get<CircleColor>().value;
}
-void CircleLayer::setCircleColor(PropertyValue<Color> value) {
+void CircleLayer::setCircleColor(const PropertyValue<Color>& value) {
if (value == getCircleColor())
return;
auto impl_ = mutableImpl();
@@ -120,11 +120,11 @@ PropertyValue<float> CircleLayer::getDefaultCircleBlur() {
return { 0 };
}
-PropertyValue<float> CircleLayer::getCircleBlur() const {
+const PropertyValue<float>& CircleLayer::getCircleBlur() const {
return impl().paint.template get<CircleBlur>().value;
}
-void CircleLayer::setCircleBlur(PropertyValue<float> value) {
+void CircleLayer::setCircleBlur(const PropertyValue<float>& value) {
if (value == getCircleBlur())
return;
auto impl_ = mutableImpl();
@@ -147,11 +147,11 @@ PropertyValue<float> CircleLayer::getDefaultCircleOpacity() {
return { 1 };
}
-PropertyValue<float> CircleLayer::getCircleOpacity() const {
+const PropertyValue<float>& CircleLayer::getCircleOpacity() const {
return impl().paint.template get<CircleOpacity>().value;
}
-void CircleLayer::setCircleOpacity(PropertyValue<float> value) {
+void CircleLayer::setCircleOpacity(const PropertyValue<float>& value) {
if (value == getCircleOpacity())
return;
auto impl_ = mutableImpl();
@@ -174,11 +174,11 @@ PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() {
return { {{ 0, 0 }} };
}
-PropertyValue<std::array<float, 2>> CircleLayer::getCircleTranslate() const {
+const PropertyValue<std::array<float, 2>>& CircleLayer::getCircleTranslate() const {
return impl().paint.template get<CircleTranslate>().value;
}
-void CircleLayer::setCircleTranslate(PropertyValue<std::array<float, 2>> value) {
+void CircleLayer::setCircleTranslate(const PropertyValue<std::array<float, 2>>& value) {
if (value == getCircleTranslate())
return;
auto impl_ = mutableImpl();
@@ -201,11 +201,11 @@ PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor(
return { TranslateAnchorType::Map };
}
-PropertyValue<TranslateAnchorType> CircleLayer::getCircleTranslateAnchor() const {
+const PropertyValue<TranslateAnchorType>& CircleLayer::getCircleTranslateAnchor() const {
return impl().paint.template get<CircleTranslateAnchor>().value;
}
-void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> value) {
+void CircleLayer::setCircleTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
if (value == getCircleTranslateAnchor())
return;
auto impl_ = mutableImpl();
@@ -228,11 +228,11 @@ PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() {
return { CirclePitchScaleType::Map };
}
-PropertyValue<CirclePitchScaleType> CircleLayer::getCirclePitchScale() const {
+const PropertyValue<CirclePitchScaleType>& CircleLayer::getCirclePitchScale() const {
return impl().paint.template get<CirclePitchScale>().value;
}
-void CircleLayer::setCirclePitchScale(PropertyValue<CirclePitchScaleType> value) {
+void CircleLayer::setCirclePitchScale(const PropertyValue<CirclePitchScaleType>& value) {
if (value == getCirclePitchScale())
return;
auto impl_ = mutableImpl();
@@ -255,11 +255,11 @@ PropertyValue<AlignmentType> CircleLayer::getDefaultCirclePitchAlignment() {
return { AlignmentType::Viewport };
}
-PropertyValue<AlignmentType> CircleLayer::getCirclePitchAlignment() const {
+const PropertyValue<AlignmentType>& CircleLayer::getCirclePitchAlignment() const {
return impl().paint.template get<CirclePitchAlignment>().value;
}
-void CircleLayer::setCirclePitchAlignment(PropertyValue<AlignmentType> value) {
+void CircleLayer::setCirclePitchAlignment(const PropertyValue<AlignmentType>& value) {
if (value == getCirclePitchAlignment())
return;
auto impl_ = mutableImpl();
@@ -282,11 +282,11 @@ PropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() {
return { 0 };
}
-PropertyValue<float> CircleLayer::getCircleStrokeWidth() const {
+const PropertyValue<float>& CircleLayer::getCircleStrokeWidth() const {
return impl().paint.template get<CircleStrokeWidth>().value;
}
-void CircleLayer::setCircleStrokeWidth(PropertyValue<float> value) {
+void CircleLayer::setCircleStrokeWidth(const PropertyValue<float>& value) {
if (value == getCircleStrokeWidth())
return;
auto impl_ = mutableImpl();
@@ -309,11 +309,11 @@ PropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() {
return { Color::black() };
}
-PropertyValue<Color> CircleLayer::getCircleStrokeColor() const {
+const PropertyValue<Color>& CircleLayer::getCircleStrokeColor() const {
return impl().paint.template get<CircleStrokeColor>().value;
}
-void CircleLayer::setCircleStrokeColor(PropertyValue<Color> value) {
+void CircleLayer::setCircleStrokeColor(const PropertyValue<Color>& value) {
if (value == getCircleStrokeColor())
return;
auto impl_ = mutableImpl();
@@ -336,11 +336,11 @@ PropertyValue<float> CircleLayer::getDefaultCircleStrokeOpacity() {
return { 1 };
}
-PropertyValue<float> CircleLayer::getCircleStrokeOpacity() const {
+const PropertyValue<float>& CircleLayer::getCircleStrokeOpacity() const {
return impl().paint.template get<CircleStrokeOpacity>().value;
}
-void CircleLayer::setCircleStrokeOpacity(PropertyValue<float> value) {
+void CircleLayer::setCircleStrokeOpacity(const PropertyValue<float>& value) {
if (value == getCircleStrokeOpacity())
return;
auto impl_ = mutableImpl();
@@ -417,7 +417,7 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::CircleRadius || property == Property::CircleBlur || property == Property::CircleOpacity || property == Property::CircleStrokeWidth || property == Property::CircleStrokeOpacity) {
diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp
index 3bbaebfe6d..913f8e3127 100644
--- a/src/mbgl/style/layers/fill_extrusion_layer.cpp
+++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp
@@ -66,11 +66,11 @@ PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionOpacity() {
return { 1 };
}
-PropertyValue<float> FillExtrusionLayer::getFillExtrusionOpacity() const {
+const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionOpacity() const {
return impl().paint.template get<FillExtrusionOpacity>().value;
}
-void FillExtrusionLayer::setFillExtrusionOpacity(PropertyValue<float> value) {
+void FillExtrusionLayer::setFillExtrusionOpacity(const PropertyValue<float>& value) {
if (value == getFillExtrusionOpacity())
return;
auto impl_ = mutableImpl();
@@ -93,11 +93,11 @@ PropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() {
return { Color::black() };
}
-PropertyValue<Color> FillExtrusionLayer::getFillExtrusionColor() const {
+const PropertyValue<Color>& FillExtrusionLayer::getFillExtrusionColor() const {
return impl().paint.template get<FillExtrusionColor>().value;
}
-void FillExtrusionLayer::setFillExtrusionColor(PropertyValue<Color> value) {
+void FillExtrusionLayer::setFillExtrusionColor(const PropertyValue<Color>& value) {
if (value == getFillExtrusionColor())
return;
auto impl_ = mutableImpl();
@@ -120,11 +120,11 @@ PropertyValue<std::array<float, 2>> FillExtrusionLayer::getDefaultFillExtrusionT
return { {{ 0, 0 }} };
}
-PropertyValue<std::array<float, 2>> FillExtrusionLayer::getFillExtrusionTranslate() const {
+const PropertyValue<std::array<float, 2>>& FillExtrusionLayer::getFillExtrusionTranslate() const {
return impl().paint.template get<FillExtrusionTranslate>().value;
}
-void FillExtrusionLayer::setFillExtrusionTranslate(PropertyValue<std::array<float, 2>> value) {
+void FillExtrusionLayer::setFillExtrusionTranslate(const PropertyValue<std::array<float, 2>>& value) {
if (value == getFillExtrusionTranslate())
return;
auto impl_ = mutableImpl();
@@ -147,11 +147,11 @@ PropertyValue<TranslateAnchorType> FillExtrusionLayer::getDefaultFillExtrusionTr
return { TranslateAnchorType::Map };
}
-PropertyValue<TranslateAnchorType> FillExtrusionLayer::getFillExtrusionTranslateAnchor() const {
+const PropertyValue<TranslateAnchorType>& FillExtrusionLayer::getFillExtrusionTranslateAnchor() const {
return impl().paint.template get<FillExtrusionTranslateAnchor>().value;
}
-void FillExtrusionLayer::setFillExtrusionTranslateAnchor(PropertyValue<TranslateAnchorType> value) {
+void FillExtrusionLayer::setFillExtrusionTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
if (value == getFillExtrusionTranslateAnchor())
return;
auto impl_ = mutableImpl();
@@ -174,11 +174,11 @@ PropertyValue<std::string> FillExtrusionLayer::getDefaultFillExtrusionPattern()
return { "" };
}
-PropertyValue<std::string> FillExtrusionLayer::getFillExtrusionPattern() const {
+const PropertyValue<std::string>& FillExtrusionLayer::getFillExtrusionPattern() const {
return impl().paint.template get<FillExtrusionPattern>().value;
}
-void FillExtrusionLayer::setFillExtrusionPattern(PropertyValue<std::string> value) {
+void FillExtrusionLayer::setFillExtrusionPattern(const PropertyValue<std::string>& value) {
if (value == getFillExtrusionPattern())
return;
auto impl_ = mutableImpl();
@@ -201,11 +201,11 @@ PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() {
return { 0 };
}
-PropertyValue<float> FillExtrusionLayer::getFillExtrusionHeight() const {
+const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionHeight() const {
return impl().paint.template get<FillExtrusionHeight>().value;
}
-void FillExtrusionLayer::setFillExtrusionHeight(PropertyValue<float> value) {
+void FillExtrusionLayer::setFillExtrusionHeight(const PropertyValue<float>& value) {
if (value == getFillExtrusionHeight())
return;
auto impl_ = mutableImpl();
@@ -228,11 +228,11 @@ PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() {
return { 0 };
}
-PropertyValue<float> FillExtrusionLayer::getFillExtrusionBase() const {
+const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionBase() const {
return impl().paint.template get<FillExtrusionBase>().value;
}
-void FillExtrusionLayer::setFillExtrusionBase(PropertyValue<float> value) {
+void FillExtrusionLayer::setFillExtrusionBase(const PropertyValue<float>& value) {
if (value == getFillExtrusionBase())
return;
auto impl_ = mutableImpl();
@@ -255,11 +255,11 @@ PropertyValue<bool> FillExtrusionLayer::getDefaultFillExtrusionVerticalGradient(
return { true };
}
-PropertyValue<bool> FillExtrusionLayer::getFillExtrusionVerticalGradient() const {
+const PropertyValue<bool>& FillExtrusionLayer::getFillExtrusionVerticalGradient() const {
return impl().paint.template get<FillExtrusionVerticalGradient>().value;
}
-void FillExtrusionLayer::setFillExtrusionVerticalGradient(PropertyValue<bool> value) {
+void FillExtrusionLayer::setFillExtrusionVerticalGradient(const PropertyValue<bool>& value) {
if (value == getFillExtrusionVerticalGradient())
return;
auto impl_ = mutableImpl();
@@ -324,7 +324,7 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::FillExtrusionOpacity) {
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp
index 6f3c163825..afcb2cae37 100644
--- a/src/mbgl/style/layers/fill_layer.cpp
+++ b/src/mbgl/style/layers/fill_layer.cpp
@@ -66,11 +66,11 @@ PropertyValue<bool> FillLayer::getDefaultFillAntialias() {
return { true };
}
-PropertyValue<bool> FillLayer::getFillAntialias() const {
+const PropertyValue<bool>& FillLayer::getFillAntialias() const {
return impl().paint.template get<FillAntialias>().value;
}
-void FillLayer::setFillAntialias(PropertyValue<bool> value) {
+void FillLayer::setFillAntialias(const PropertyValue<bool>& value) {
if (value == getFillAntialias())
return;
auto impl_ = mutableImpl();
@@ -93,11 +93,11 @@ PropertyValue<float> FillLayer::getDefaultFillOpacity() {
return { 1 };
}
-PropertyValue<float> FillLayer::getFillOpacity() const {
+const PropertyValue<float>& FillLayer::getFillOpacity() const {
return impl().paint.template get<FillOpacity>().value;
}
-void FillLayer::setFillOpacity(PropertyValue<float> value) {
+void FillLayer::setFillOpacity(const PropertyValue<float>& value) {
if (value == getFillOpacity())
return;
auto impl_ = mutableImpl();
@@ -120,11 +120,11 @@ PropertyValue<Color> FillLayer::getDefaultFillColor() {
return { Color::black() };
}
-PropertyValue<Color> FillLayer::getFillColor() const {
+const PropertyValue<Color>& FillLayer::getFillColor() const {
return impl().paint.template get<FillColor>().value;
}
-void FillLayer::setFillColor(PropertyValue<Color> value) {
+void FillLayer::setFillColor(const PropertyValue<Color>& value) {
if (value == getFillColor())
return;
auto impl_ = mutableImpl();
@@ -147,11 +147,11 @@ PropertyValue<Color> FillLayer::getDefaultFillOutlineColor() {
return { {} };
}
-PropertyValue<Color> FillLayer::getFillOutlineColor() const {
+const PropertyValue<Color>& FillLayer::getFillOutlineColor() const {
return impl().paint.template get<FillOutlineColor>().value;
}
-void FillLayer::setFillOutlineColor(PropertyValue<Color> value) {
+void FillLayer::setFillOutlineColor(const PropertyValue<Color>& value) {
if (value == getFillOutlineColor())
return;
auto impl_ = mutableImpl();
@@ -174,11 +174,11 @@ PropertyValue<std::array<float, 2>> FillLayer::getDefaultFillTranslate() {
return { {{ 0, 0 }} };
}
-PropertyValue<std::array<float, 2>> FillLayer::getFillTranslate() const {
+const PropertyValue<std::array<float, 2>>& FillLayer::getFillTranslate() const {
return impl().paint.template get<FillTranslate>().value;
}
-void FillLayer::setFillTranslate(PropertyValue<std::array<float, 2>> value) {
+void FillLayer::setFillTranslate(const PropertyValue<std::array<float, 2>>& value) {
if (value == getFillTranslate())
return;
auto impl_ = mutableImpl();
@@ -201,11 +201,11 @@ PropertyValue<TranslateAnchorType> FillLayer::getDefaultFillTranslateAnchor() {
return { TranslateAnchorType::Map };
}
-PropertyValue<TranslateAnchorType> FillLayer::getFillTranslateAnchor() const {
+const PropertyValue<TranslateAnchorType>& FillLayer::getFillTranslateAnchor() const {
return impl().paint.template get<FillTranslateAnchor>().value;
}
-void FillLayer::setFillTranslateAnchor(PropertyValue<TranslateAnchorType> value) {
+void FillLayer::setFillTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
if (value == getFillTranslateAnchor())
return;
auto impl_ = mutableImpl();
@@ -228,11 +228,11 @@ PropertyValue<std::string> FillLayer::getDefaultFillPattern() {
return { "" };
}
-PropertyValue<std::string> FillLayer::getFillPattern() const {
+const PropertyValue<std::string>& FillLayer::getFillPattern() const {
return impl().paint.template get<FillPattern>().value;
}
-void FillLayer::setFillPattern(PropertyValue<std::string> value) {
+void FillLayer::setFillPattern(const PropertyValue<std::string>& value) {
if (value == getFillPattern())
return;
auto impl_ = mutableImpl();
@@ -293,7 +293,7 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::FillAntialias) {
diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp
index d548ee9b74..9e0fe93557 100644
--- a/src/mbgl/style/layers/heatmap_layer.cpp
+++ b/src/mbgl/style/layers/heatmap_layer.cpp
@@ -66,11 +66,11 @@ PropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() {
return { 30 };
}
-PropertyValue<float> HeatmapLayer::getHeatmapRadius() const {
+const PropertyValue<float>& HeatmapLayer::getHeatmapRadius() const {
return impl().paint.template get<HeatmapRadius>().value;
}
-void HeatmapLayer::setHeatmapRadius(PropertyValue<float> value) {
+void HeatmapLayer::setHeatmapRadius(const PropertyValue<float>& value) {
if (value == getHeatmapRadius())
return;
auto impl_ = mutableImpl();
@@ -93,11 +93,11 @@ PropertyValue<float> HeatmapLayer::getDefaultHeatmapWeight() {
return { 1 };
}
-PropertyValue<float> HeatmapLayer::getHeatmapWeight() const {
+const PropertyValue<float>& HeatmapLayer::getHeatmapWeight() const {
return impl().paint.template get<HeatmapWeight>().value;
}
-void HeatmapLayer::setHeatmapWeight(PropertyValue<float> value) {
+void HeatmapLayer::setHeatmapWeight(const PropertyValue<float>& value) {
if (value == getHeatmapWeight())
return;
auto impl_ = mutableImpl();
@@ -120,11 +120,11 @@ PropertyValue<float> HeatmapLayer::getDefaultHeatmapIntensity() {
return { 1 };
}
-PropertyValue<float> HeatmapLayer::getHeatmapIntensity() const {
+const PropertyValue<float>& HeatmapLayer::getHeatmapIntensity() const {
return impl().paint.template get<HeatmapIntensity>().value;
}
-void HeatmapLayer::setHeatmapIntensity(PropertyValue<float> value) {
+void HeatmapLayer::setHeatmapIntensity(const PropertyValue<float>& value) {
if (value == getHeatmapIntensity())
return;
auto impl_ = mutableImpl();
@@ -149,11 +149,11 @@ ColorRampPropertyValue HeatmapLayer::getDefaultHeatmapColor() {
return *conversion::convertJSON<ColorRampPropertyValue>(rawValue, error);
}
-ColorRampPropertyValue HeatmapLayer::getHeatmapColor() const {
+const ColorRampPropertyValue& HeatmapLayer::getHeatmapColor() const {
return impl().paint.template get<HeatmapColor>().value;
}
-void HeatmapLayer::setHeatmapColor(ColorRampPropertyValue value) {
+void HeatmapLayer::setHeatmapColor(const ColorRampPropertyValue& value) {
if (value == getHeatmapColor())
return;
auto impl_ = mutableImpl();
@@ -176,11 +176,11 @@ PropertyValue<float> HeatmapLayer::getDefaultHeatmapOpacity() {
return { 1 };
}
-PropertyValue<float> HeatmapLayer::getHeatmapOpacity() const {
+const PropertyValue<float>& HeatmapLayer::getHeatmapOpacity() const {
return impl().paint.template get<HeatmapOpacity>().value;
}
-void HeatmapLayer::setHeatmapOpacity(PropertyValue<float> value) {
+void HeatmapLayer::setHeatmapOpacity(const PropertyValue<float>& value) {
if (value == getHeatmapOpacity())
return;
auto impl_ = mutableImpl();
@@ -233,7 +233,7 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::HeatmapRadius || property == Property::HeatmapWeight) {
diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp
index 49d3217a3b..ac26e331fc 100644
--- a/src/mbgl/style/layers/hillshade_layer.cpp
+++ b/src/mbgl/style/layers/hillshade_layer.cpp
@@ -66,11 +66,11 @@ PropertyValue<float> HillshadeLayer::getDefaultHillshadeIlluminationDirection()
return { 335 };
}
-PropertyValue<float> HillshadeLayer::getHillshadeIlluminationDirection() const {
+const PropertyValue<float>& HillshadeLayer::getHillshadeIlluminationDirection() const {
return impl().paint.template get<HillshadeIlluminationDirection>().value;
}
-void HillshadeLayer::setHillshadeIlluminationDirection(PropertyValue<float> value) {
+void HillshadeLayer::setHillshadeIlluminationDirection(const PropertyValue<float>& value) {
if (value == getHillshadeIlluminationDirection())
return;
auto impl_ = mutableImpl();
@@ -93,11 +93,11 @@ PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getDefaultHillsha
return { HillshadeIlluminationAnchorType::Viewport };
}
-PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getHillshadeIlluminationAnchor() const {
+const PropertyValue<HillshadeIlluminationAnchorType>& HillshadeLayer::getHillshadeIlluminationAnchor() const {
return impl().paint.template get<HillshadeIlluminationAnchor>().value;
}
-void HillshadeLayer::setHillshadeIlluminationAnchor(PropertyValue<HillshadeIlluminationAnchorType> value) {
+void HillshadeLayer::setHillshadeIlluminationAnchor(const PropertyValue<HillshadeIlluminationAnchorType>& value) {
if (value == getHillshadeIlluminationAnchor())
return;
auto impl_ = mutableImpl();
@@ -120,11 +120,11 @@ PropertyValue<float> HillshadeLayer::getDefaultHillshadeExaggeration() {
return { 0.5 };
}
-PropertyValue<float> HillshadeLayer::getHillshadeExaggeration() const {
+const PropertyValue<float>& HillshadeLayer::getHillshadeExaggeration() const {
return impl().paint.template get<HillshadeExaggeration>().value;
}
-void HillshadeLayer::setHillshadeExaggeration(PropertyValue<float> value) {
+void HillshadeLayer::setHillshadeExaggeration(const PropertyValue<float>& value) {
if (value == getHillshadeExaggeration())
return;
auto impl_ = mutableImpl();
@@ -147,11 +147,11 @@ PropertyValue<Color> HillshadeLayer::getDefaultHillshadeShadowColor() {
return { Color::black() };
}
-PropertyValue<Color> HillshadeLayer::getHillshadeShadowColor() const {
+const PropertyValue<Color>& HillshadeLayer::getHillshadeShadowColor() const {
return impl().paint.template get<HillshadeShadowColor>().value;
}
-void HillshadeLayer::setHillshadeShadowColor(PropertyValue<Color> value) {
+void HillshadeLayer::setHillshadeShadowColor(const PropertyValue<Color>& value) {
if (value == getHillshadeShadowColor())
return;
auto impl_ = mutableImpl();
@@ -174,11 +174,11 @@ PropertyValue<Color> HillshadeLayer::getDefaultHillshadeHighlightColor() {
return { Color::white() };
}
-PropertyValue<Color> HillshadeLayer::getHillshadeHighlightColor() const {
+const PropertyValue<Color>& HillshadeLayer::getHillshadeHighlightColor() const {
return impl().paint.template get<HillshadeHighlightColor>().value;
}
-void HillshadeLayer::setHillshadeHighlightColor(PropertyValue<Color> value) {
+void HillshadeLayer::setHillshadeHighlightColor(const PropertyValue<Color>& value) {
if (value == getHillshadeHighlightColor())
return;
auto impl_ = mutableImpl();
@@ -201,11 +201,11 @@ PropertyValue<Color> HillshadeLayer::getDefaultHillshadeAccentColor() {
return { Color::black() };
}
-PropertyValue<Color> HillshadeLayer::getHillshadeAccentColor() const {
+const PropertyValue<Color>& HillshadeLayer::getHillshadeAccentColor() const {
return impl().paint.template get<HillshadeAccentColor>().value;
}
-void HillshadeLayer::setHillshadeAccentColor(PropertyValue<Color> value) {
+void HillshadeLayer::setHillshadeAccentColor(const PropertyValue<Color>& value) {
if (value == getHillshadeAccentColor())
return;
auto impl_ = mutableImpl();
@@ -262,7 +262,7 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::HillshadeIlluminationDirection || property == Property::HillshadeExaggeration) {
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs
index 201189c849..107c3cb527 100644
--- a/src/mbgl/style/layers/layer.cpp.ejs
+++ b/src/mbgl/style/layers/layer.cpp.ejs
@@ -118,11 +118,11 @@ void <%- camelize(type) %>Layer::Impl::stringifyLayout(rapidjson::Writer<rapidjs
return <%- camelize(property.name) %>::defaultValue();
}
-<%- propertyValueType(property) %> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>() const {
+const <%- propertyValueType(property) %>& <%- camelize(type) %>Layer::get<%- camelize(property.name) %>() const {
return impl().layout.get<<%- camelize(property.name) %>>();
}
-void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> value) {
+void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(const <%- propertyValueType(property) %>& value) {
if (value == get<%- camelize(property.name) %>())
return;
auto impl_ = mutableImpl();
@@ -144,11 +144,11 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyV
<% } -%>
}
-<%- propertyValueType(property) %> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>() const {
+const <%- propertyValueType(property) %>& <%- camelize(type) %>Layer::get<%- camelize(property.name) %>() const {
return impl().paint.template get<<%- camelize(property.name) %>>().value;
}
-void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> value) {
+void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(const <%- propertyValueType(property) %>& value) {
if (value == get<%- camelize(property.name) %>())
return;
auto impl_ = mutableImpl();
@@ -193,7 +193,7 @@ optional<Error> <%- camelize(type) %>Layer::setPaintProperty(const std::string&
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
<%
const paintConversions = {};
@@ -260,7 +260,7 @@ optional<Error> <%- camelize(type) %>Layer::setLayoutProperty(const std::string&
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
<%
const layoutConversions = {};
diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp
index 0a20762697..d52a552605 100644
--- a/src/mbgl/style/layers/line_layer.cpp
+++ b/src/mbgl/style/layers/line_layer.cpp
@@ -64,11 +64,11 @@ PropertyValue<LineCapType> LineLayer::getDefaultLineCap() {
return LineCap::defaultValue();
}
-PropertyValue<LineCapType> LineLayer::getLineCap() const {
+const PropertyValue<LineCapType>& LineLayer::getLineCap() const {
return impl().layout.get<LineCap>();
}
-void LineLayer::setLineCap(PropertyValue<LineCapType> value) {
+void LineLayer::setLineCap(const PropertyValue<LineCapType>& value) {
if (value == getLineCap())
return;
auto impl_ = mutableImpl();
@@ -80,11 +80,11 @@ PropertyValue<LineJoinType> LineLayer::getDefaultLineJoin() {
return LineJoin::defaultValue();
}
-PropertyValue<LineJoinType> LineLayer::getLineJoin() const {
+const PropertyValue<LineJoinType>& LineLayer::getLineJoin() const {
return impl().layout.get<LineJoin>();
}
-void LineLayer::setLineJoin(PropertyValue<LineJoinType> value) {
+void LineLayer::setLineJoin(const PropertyValue<LineJoinType>& value) {
if (value == getLineJoin())
return;
auto impl_ = mutableImpl();
@@ -96,11 +96,11 @@ PropertyValue<float> LineLayer::getDefaultLineMiterLimit() {
return LineMiterLimit::defaultValue();
}
-PropertyValue<float> LineLayer::getLineMiterLimit() const {
+const PropertyValue<float>& LineLayer::getLineMiterLimit() const {
return impl().layout.get<LineMiterLimit>();
}
-void LineLayer::setLineMiterLimit(PropertyValue<float> value) {
+void LineLayer::setLineMiterLimit(const PropertyValue<float>& value) {
if (value == getLineMiterLimit())
return;
auto impl_ = mutableImpl();
@@ -112,11 +112,11 @@ PropertyValue<float> LineLayer::getDefaultLineRoundLimit() {
return LineRoundLimit::defaultValue();
}
-PropertyValue<float> LineLayer::getLineRoundLimit() const {
+const PropertyValue<float>& LineLayer::getLineRoundLimit() const {
return impl().layout.get<LineRoundLimit>();
}
-void LineLayer::setLineRoundLimit(PropertyValue<float> value) {
+void LineLayer::setLineRoundLimit(const PropertyValue<float>& value) {
if (value == getLineRoundLimit())
return;
auto impl_ = mutableImpl();
@@ -131,11 +131,11 @@ PropertyValue<float> LineLayer::getDefaultLineOpacity() {
return { 1 };
}
-PropertyValue<float> LineLayer::getLineOpacity() const {
+const PropertyValue<float>& LineLayer::getLineOpacity() const {
return impl().paint.template get<LineOpacity>().value;
}
-void LineLayer::setLineOpacity(PropertyValue<float> value) {
+void LineLayer::setLineOpacity(const PropertyValue<float>& value) {
if (value == getLineOpacity())
return;
auto impl_ = mutableImpl();
@@ -158,11 +158,11 @@ PropertyValue<Color> LineLayer::getDefaultLineColor() {
return { Color::black() };
}
-PropertyValue<Color> LineLayer::getLineColor() const {
+const PropertyValue<Color>& LineLayer::getLineColor() const {
return impl().paint.template get<LineColor>().value;
}
-void LineLayer::setLineColor(PropertyValue<Color> value) {
+void LineLayer::setLineColor(const PropertyValue<Color>& value) {
if (value == getLineColor())
return;
auto impl_ = mutableImpl();
@@ -185,11 +185,11 @@ PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() {
return { {{ 0, 0 }} };
}
-PropertyValue<std::array<float, 2>> LineLayer::getLineTranslate() const {
+const PropertyValue<std::array<float, 2>>& LineLayer::getLineTranslate() const {
return impl().paint.template get<LineTranslate>().value;
}
-void LineLayer::setLineTranslate(PropertyValue<std::array<float, 2>> value) {
+void LineLayer::setLineTranslate(const PropertyValue<std::array<float, 2>>& value) {
if (value == getLineTranslate())
return;
auto impl_ = mutableImpl();
@@ -212,11 +212,11 @@ PropertyValue<TranslateAnchorType> LineLayer::getDefaultLineTranslateAnchor() {
return { TranslateAnchorType::Map };
}
-PropertyValue<TranslateAnchorType> LineLayer::getLineTranslateAnchor() const {
+const PropertyValue<TranslateAnchorType>& LineLayer::getLineTranslateAnchor() const {
return impl().paint.template get<LineTranslateAnchor>().value;
}
-void LineLayer::setLineTranslateAnchor(PropertyValue<TranslateAnchorType> value) {
+void LineLayer::setLineTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
if (value == getLineTranslateAnchor())
return;
auto impl_ = mutableImpl();
@@ -239,11 +239,11 @@ PropertyValue<float> LineLayer::getDefaultLineWidth() {
return { 1 };
}
-PropertyValue<float> LineLayer::getLineWidth() const {
+const PropertyValue<float>& LineLayer::getLineWidth() const {
return impl().paint.template get<LineWidth>().value;
}
-void LineLayer::setLineWidth(PropertyValue<float> value) {
+void LineLayer::setLineWidth(const PropertyValue<float>& value) {
if (value == getLineWidth())
return;
auto impl_ = mutableImpl();
@@ -267,11 +267,11 @@ PropertyValue<float> LineLayer::getDefaultLineGapWidth() {
return { 0 };
}
-PropertyValue<float> LineLayer::getLineGapWidth() const {
+const PropertyValue<float>& LineLayer::getLineGapWidth() const {
return impl().paint.template get<LineGapWidth>().value;
}
-void LineLayer::setLineGapWidth(PropertyValue<float> value) {
+void LineLayer::setLineGapWidth(const PropertyValue<float>& value) {
if (value == getLineGapWidth())
return;
auto impl_ = mutableImpl();
@@ -294,11 +294,11 @@ PropertyValue<float> LineLayer::getDefaultLineOffset() {
return { 0 };
}
-PropertyValue<float> LineLayer::getLineOffset() const {
+const PropertyValue<float>& LineLayer::getLineOffset() const {
return impl().paint.template get<LineOffset>().value;
}
-void LineLayer::setLineOffset(PropertyValue<float> value) {
+void LineLayer::setLineOffset(const PropertyValue<float>& value) {
if (value == getLineOffset())
return;
auto impl_ = mutableImpl();
@@ -321,11 +321,11 @@ PropertyValue<float> LineLayer::getDefaultLineBlur() {
return { 0 };
}
-PropertyValue<float> LineLayer::getLineBlur() const {
+const PropertyValue<float>& LineLayer::getLineBlur() const {
return impl().paint.template get<LineBlur>().value;
}
-void LineLayer::setLineBlur(PropertyValue<float> value) {
+void LineLayer::setLineBlur(const PropertyValue<float>& value) {
if (value == getLineBlur())
return;
auto impl_ = mutableImpl();
@@ -348,11 +348,11 @@ PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() {
return { { } };
}
-PropertyValue<std::vector<float>> LineLayer::getLineDasharray() const {
+const PropertyValue<std::vector<float>>& LineLayer::getLineDasharray() const {
return impl().paint.template get<LineDasharray>().value;
}
-void LineLayer::setLineDasharray(PropertyValue<std::vector<float>> value) {
+void LineLayer::setLineDasharray(const PropertyValue<std::vector<float>>& value) {
if (value == getLineDasharray())
return;
auto impl_ = mutableImpl();
@@ -375,11 +375,11 @@ PropertyValue<std::string> LineLayer::getDefaultLinePattern() {
return { "" };
}
-PropertyValue<std::string> LineLayer::getLinePattern() const {
+const PropertyValue<std::string>& LineLayer::getLinePattern() const {
return impl().paint.template get<LinePattern>().value;
}
-void LineLayer::setLinePattern(PropertyValue<std::string> value) {
+void LineLayer::setLinePattern(const PropertyValue<std::string>& value) {
if (value == getLinePattern())
return;
auto impl_ = mutableImpl();
@@ -402,11 +402,11 @@ ColorRampPropertyValue LineLayer::getDefaultLineGradient() {
return { {} };
}
-ColorRampPropertyValue LineLayer::getLineGradient() const {
+const ColorRampPropertyValue& LineLayer::getLineGradient() const {
return impl().paint.template get<LineGradient>().value;
}
-void LineLayer::setLineGradient(ColorRampPropertyValue value) {
+void LineLayer::setLineGradient(const ColorRampPropertyValue& value) {
if (value == getLineGradient())
return;
auto impl_ = mutableImpl();
@@ -483,7 +483,7 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::LineOpacity || property == Property::LineWidth || property == Property::LineGapWidth || property == Property::LineOffset || property == Property::LineBlur) {
@@ -680,7 +680,7 @@ optional<Error> LineLayer::setLayoutProperty(const std::string& name, const Conv
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::LineCap) {
diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp
index b0820456e1..dc7dd4a74f 100644
--- a/src/mbgl/style/layers/raster_layer.cpp
+++ b/src/mbgl/style/layers/raster_layer.cpp
@@ -66,11 +66,11 @@ PropertyValue<float> RasterLayer::getDefaultRasterOpacity() {
return { 1 };
}
-PropertyValue<float> RasterLayer::getRasterOpacity() const {
+const PropertyValue<float>& RasterLayer::getRasterOpacity() const {
return impl().paint.template get<RasterOpacity>().value;
}
-void RasterLayer::setRasterOpacity(PropertyValue<float> value) {
+void RasterLayer::setRasterOpacity(const PropertyValue<float>& value) {
if (value == getRasterOpacity())
return;
auto impl_ = mutableImpl();
@@ -93,11 +93,11 @@ PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() {
return { 0 };
}
-PropertyValue<float> RasterLayer::getRasterHueRotate() const {
+const PropertyValue<float>& RasterLayer::getRasterHueRotate() const {
return impl().paint.template get<RasterHueRotate>().value;
}
-void RasterLayer::setRasterHueRotate(PropertyValue<float> value) {
+void RasterLayer::setRasterHueRotate(const PropertyValue<float>& value) {
if (value == getRasterHueRotate())
return;
auto impl_ = mutableImpl();
@@ -120,11 +120,11 @@ PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMin() {
return { 0 };
}
-PropertyValue<float> RasterLayer::getRasterBrightnessMin() const {
+const PropertyValue<float>& RasterLayer::getRasterBrightnessMin() const {
return impl().paint.template get<RasterBrightnessMin>().value;
}
-void RasterLayer::setRasterBrightnessMin(PropertyValue<float> value) {
+void RasterLayer::setRasterBrightnessMin(const PropertyValue<float>& value) {
if (value == getRasterBrightnessMin())
return;
auto impl_ = mutableImpl();
@@ -147,11 +147,11 @@ PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() {
return { 1 };
}
-PropertyValue<float> RasterLayer::getRasterBrightnessMax() const {
+const PropertyValue<float>& RasterLayer::getRasterBrightnessMax() const {
return impl().paint.template get<RasterBrightnessMax>().value;
}
-void RasterLayer::setRasterBrightnessMax(PropertyValue<float> value) {
+void RasterLayer::setRasterBrightnessMax(const PropertyValue<float>& value) {
if (value == getRasterBrightnessMax())
return;
auto impl_ = mutableImpl();
@@ -174,11 +174,11 @@ PropertyValue<float> RasterLayer::getDefaultRasterSaturation() {
return { 0 };
}
-PropertyValue<float> RasterLayer::getRasterSaturation() const {
+const PropertyValue<float>& RasterLayer::getRasterSaturation() const {
return impl().paint.template get<RasterSaturation>().value;
}
-void RasterLayer::setRasterSaturation(PropertyValue<float> value) {
+void RasterLayer::setRasterSaturation(const PropertyValue<float>& value) {
if (value == getRasterSaturation())
return;
auto impl_ = mutableImpl();
@@ -201,11 +201,11 @@ PropertyValue<float> RasterLayer::getDefaultRasterContrast() {
return { 0 };
}
-PropertyValue<float> RasterLayer::getRasterContrast() const {
+const PropertyValue<float>& RasterLayer::getRasterContrast() const {
return impl().paint.template get<RasterContrast>().value;
}
-void RasterLayer::setRasterContrast(PropertyValue<float> value) {
+void RasterLayer::setRasterContrast(const PropertyValue<float>& value) {
if (value == getRasterContrast())
return;
auto impl_ = mutableImpl();
@@ -228,11 +228,11 @@ PropertyValue<RasterResamplingType> RasterLayer::getDefaultRasterResampling() {
return { RasterResamplingType::Linear };
}
-PropertyValue<RasterResamplingType> RasterLayer::getRasterResampling() const {
+const PropertyValue<RasterResamplingType>& RasterLayer::getRasterResampling() const {
return impl().paint.template get<RasterResampling>().value;
}
-void RasterLayer::setRasterResampling(PropertyValue<RasterResamplingType> value) {
+void RasterLayer::setRasterResampling(const PropertyValue<RasterResamplingType>& value) {
if (value == getRasterResampling())
return;
auto impl_ = mutableImpl();
@@ -255,11 +255,11 @@ PropertyValue<float> RasterLayer::getDefaultRasterFadeDuration() {
return { 300 };
}
-PropertyValue<float> RasterLayer::getRasterFadeDuration() const {
+const PropertyValue<float>& RasterLayer::getRasterFadeDuration() const {
return impl().paint.template get<RasterFadeDuration>().value;
}
-void RasterLayer::setRasterFadeDuration(PropertyValue<float> value) {
+void RasterLayer::setRasterFadeDuration(const PropertyValue<float>& value) {
if (value == getRasterFadeDuration())
return;
auto impl_ = mutableImpl();
@@ -324,7 +324,7 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::RasterOpacity || property == Property::RasterHueRotate || property == Property::RasterBrightnessMin || property == Property::RasterBrightnessMax || property == Property::RasterSaturation || property == Property::RasterContrast || property == Property::RasterFadeDuration) {
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index 1c56888f73..c8d7816180 100644
--- a/src/mbgl/style/layers/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -64,11 +64,11 @@ PropertyValue<SymbolPlacementType> SymbolLayer::getDefaultSymbolPlacement() {
return SymbolPlacement::defaultValue();
}
-PropertyValue<SymbolPlacementType> SymbolLayer::getSymbolPlacement() const {
+const PropertyValue<SymbolPlacementType>& SymbolLayer::getSymbolPlacement() const {
return impl().layout.get<SymbolPlacement>();
}
-void SymbolLayer::setSymbolPlacement(PropertyValue<SymbolPlacementType> value) {
+void SymbolLayer::setSymbolPlacement(const PropertyValue<SymbolPlacementType>& value) {
if (value == getSymbolPlacement())
return;
auto impl_ = mutableImpl();
@@ -80,11 +80,11 @@ PropertyValue<float> SymbolLayer::getDefaultSymbolSpacing() {
return SymbolSpacing::defaultValue();
}
-PropertyValue<float> SymbolLayer::getSymbolSpacing() const {
+const PropertyValue<float>& SymbolLayer::getSymbolSpacing() const {
return impl().layout.get<SymbolSpacing>();
}
-void SymbolLayer::setSymbolSpacing(PropertyValue<float> value) {
+void SymbolLayer::setSymbolSpacing(const PropertyValue<float>& value) {
if (value == getSymbolSpacing())
return;
auto impl_ = mutableImpl();
@@ -96,11 +96,11 @@ PropertyValue<bool> SymbolLayer::getDefaultSymbolAvoidEdges() {
return SymbolAvoidEdges::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getSymbolAvoidEdges() const {
+const PropertyValue<bool>& SymbolLayer::getSymbolAvoidEdges() const {
return impl().layout.get<SymbolAvoidEdges>();
}
-void SymbolLayer::setSymbolAvoidEdges(PropertyValue<bool> value) {
+void SymbolLayer::setSymbolAvoidEdges(const PropertyValue<bool>& value) {
if (value == getSymbolAvoidEdges())
return;
auto impl_ = mutableImpl();
@@ -112,11 +112,11 @@ PropertyValue<SymbolZOrderType> SymbolLayer::getDefaultSymbolZOrder() {
return SymbolZOrder::defaultValue();
}
-PropertyValue<SymbolZOrderType> SymbolLayer::getSymbolZOrder() const {
+const PropertyValue<SymbolZOrderType>& SymbolLayer::getSymbolZOrder() const {
return impl().layout.get<SymbolZOrder>();
}
-void SymbolLayer::setSymbolZOrder(PropertyValue<SymbolZOrderType> value) {
+void SymbolLayer::setSymbolZOrder(const PropertyValue<SymbolZOrderType>& value) {
if (value == getSymbolZOrder())
return;
auto impl_ = mutableImpl();
@@ -128,11 +128,11 @@ PropertyValue<bool> SymbolLayer::getDefaultIconAllowOverlap() {
return IconAllowOverlap::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getIconAllowOverlap() const {
+const PropertyValue<bool>& SymbolLayer::getIconAllowOverlap() const {
return impl().layout.get<IconAllowOverlap>();
}
-void SymbolLayer::setIconAllowOverlap(PropertyValue<bool> value) {
+void SymbolLayer::setIconAllowOverlap(const PropertyValue<bool>& value) {
if (value == getIconAllowOverlap())
return;
auto impl_ = mutableImpl();
@@ -144,11 +144,11 @@ PropertyValue<bool> SymbolLayer::getDefaultIconIgnorePlacement() {
return IconIgnorePlacement::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getIconIgnorePlacement() const {
+const PropertyValue<bool>& SymbolLayer::getIconIgnorePlacement() const {
return impl().layout.get<IconIgnorePlacement>();
}
-void SymbolLayer::setIconIgnorePlacement(PropertyValue<bool> value) {
+void SymbolLayer::setIconIgnorePlacement(const PropertyValue<bool>& value) {
if (value == getIconIgnorePlacement())
return;
auto impl_ = mutableImpl();
@@ -160,11 +160,11 @@ PropertyValue<bool> SymbolLayer::getDefaultIconOptional() {
return IconOptional::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getIconOptional() const {
+const PropertyValue<bool>& SymbolLayer::getIconOptional() const {
return impl().layout.get<IconOptional>();
}
-void SymbolLayer::setIconOptional(PropertyValue<bool> value) {
+void SymbolLayer::setIconOptional(const PropertyValue<bool>& value) {
if (value == getIconOptional())
return;
auto impl_ = mutableImpl();
@@ -176,11 +176,11 @@ PropertyValue<AlignmentType> SymbolLayer::getDefaultIconRotationAlignment() {
return IconRotationAlignment::defaultValue();
}
-PropertyValue<AlignmentType> SymbolLayer::getIconRotationAlignment() const {
+const PropertyValue<AlignmentType>& SymbolLayer::getIconRotationAlignment() const {
return impl().layout.get<IconRotationAlignment>();
}
-void SymbolLayer::setIconRotationAlignment(PropertyValue<AlignmentType> value) {
+void SymbolLayer::setIconRotationAlignment(const PropertyValue<AlignmentType>& value) {
if (value == getIconRotationAlignment())
return;
auto impl_ = mutableImpl();
@@ -192,11 +192,11 @@ PropertyValue<float> SymbolLayer::getDefaultIconSize() {
return IconSize::defaultValue();
}
-PropertyValue<float> SymbolLayer::getIconSize() const {
+const PropertyValue<float>& SymbolLayer::getIconSize() const {
return impl().layout.get<IconSize>();
}
-void SymbolLayer::setIconSize(PropertyValue<float> value) {
+void SymbolLayer::setIconSize(const PropertyValue<float>& value) {
if (value == getIconSize())
return;
auto impl_ = mutableImpl();
@@ -208,11 +208,11 @@ PropertyValue<IconTextFitType> SymbolLayer::getDefaultIconTextFit() {
return IconTextFit::defaultValue();
}
-PropertyValue<IconTextFitType> SymbolLayer::getIconTextFit() const {
+const PropertyValue<IconTextFitType>& SymbolLayer::getIconTextFit() const {
return impl().layout.get<IconTextFit>();
}
-void SymbolLayer::setIconTextFit(PropertyValue<IconTextFitType> value) {
+void SymbolLayer::setIconTextFit(const PropertyValue<IconTextFitType>& value) {
if (value == getIconTextFit())
return;
auto impl_ = mutableImpl();
@@ -224,11 +224,11 @@ PropertyValue<std::array<float, 4>> SymbolLayer::getDefaultIconTextFitPadding()
return IconTextFitPadding::defaultValue();
}
-PropertyValue<std::array<float, 4>> SymbolLayer::getIconTextFitPadding() const {
+const PropertyValue<std::array<float, 4>>& SymbolLayer::getIconTextFitPadding() const {
return impl().layout.get<IconTextFitPadding>();
}
-void SymbolLayer::setIconTextFitPadding(PropertyValue<std::array<float, 4>> value) {
+void SymbolLayer::setIconTextFitPadding(const PropertyValue<std::array<float, 4>>& value) {
if (value == getIconTextFitPadding())
return;
auto impl_ = mutableImpl();
@@ -240,11 +240,11 @@ PropertyValue<std::string> SymbolLayer::getDefaultIconImage() {
return IconImage::defaultValue();
}
-PropertyValue<std::string> SymbolLayer::getIconImage() const {
+const PropertyValue<std::string>& SymbolLayer::getIconImage() const {
return impl().layout.get<IconImage>();
}
-void SymbolLayer::setIconImage(PropertyValue<std::string> value) {
+void SymbolLayer::setIconImage(const PropertyValue<std::string>& value) {
if (value == getIconImage())
return;
auto impl_ = mutableImpl();
@@ -256,11 +256,11 @@ PropertyValue<float> SymbolLayer::getDefaultIconRotate() {
return IconRotate::defaultValue();
}
-PropertyValue<float> SymbolLayer::getIconRotate() const {
+const PropertyValue<float>& SymbolLayer::getIconRotate() const {
return impl().layout.get<IconRotate>();
}
-void SymbolLayer::setIconRotate(PropertyValue<float> value) {
+void SymbolLayer::setIconRotate(const PropertyValue<float>& value) {
if (value == getIconRotate())
return;
auto impl_ = mutableImpl();
@@ -272,11 +272,11 @@ PropertyValue<float> SymbolLayer::getDefaultIconPadding() {
return IconPadding::defaultValue();
}
-PropertyValue<float> SymbolLayer::getIconPadding() const {
+const PropertyValue<float>& SymbolLayer::getIconPadding() const {
return impl().layout.get<IconPadding>();
}
-void SymbolLayer::setIconPadding(PropertyValue<float> value) {
+void SymbolLayer::setIconPadding(const PropertyValue<float>& value) {
if (value == getIconPadding())
return;
auto impl_ = mutableImpl();
@@ -288,11 +288,11 @@ PropertyValue<bool> SymbolLayer::getDefaultIconKeepUpright() {
return IconKeepUpright::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getIconKeepUpright() const {
+const PropertyValue<bool>& SymbolLayer::getIconKeepUpright() const {
return impl().layout.get<IconKeepUpright>();
}
-void SymbolLayer::setIconKeepUpright(PropertyValue<bool> value) {
+void SymbolLayer::setIconKeepUpright(const PropertyValue<bool>& value) {
if (value == getIconKeepUpright())
return;
auto impl_ = mutableImpl();
@@ -304,11 +304,11 @@ PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconOffset() {
return IconOffset::defaultValue();
}
-PropertyValue<std::array<float, 2>> SymbolLayer::getIconOffset() const {
+const PropertyValue<std::array<float, 2>>& SymbolLayer::getIconOffset() const {
return impl().layout.get<IconOffset>();
}
-void SymbolLayer::setIconOffset(PropertyValue<std::array<float, 2>> value) {
+void SymbolLayer::setIconOffset(const PropertyValue<std::array<float, 2>>& value) {
if (value == getIconOffset())
return;
auto impl_ = mutableImpl();
@@ -320,11 +320,11 @@ PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultIconAnchor() {
return IconAnchor::defaultValue();
}
-PropertyValue<SymbolAnchorType> SymbolLayer::getIconAnchor() const {
+const PropertyValue<SymbolAnchorType>& SymbolLayer::getIconAnchor() const {
return impl().layout.get<IconAnchor>();
}
-void SymbolLayer::setIconAnchor(PropertyValue<SymbolAnchorType> value) {
+void SymbolLayer::setIconAnchor(const PropertyValue<SymbolAnchorType>& value) {
if (value == getIconAnchor())
return;
auto impl_ = mutableImpl();
@@ -336,11 +336,11 @@ PropertyValue<AlignmentType> SymbolLayer::getDefaultIconPitchAlignment() {
return IconPitchAlignment::defaultValue();
}
-PropertyValue<AlignmentType> SymbolLayer::getIconPitchAlignment() const {
+const PropertyValue<AlignmentType>& SymbolLayer::getIconPitchAlignment() const {
return impl().layout.get<IconPitchAlignment>();
}
-void SymbolLayer::setIconPitchAlignment(PropertyValue<AlignmentType> value) {
+void SymbolLayer::setIconPitchAlignment(const PropertyValue<AlignmentType>& value) {
if (value == getIconPitchAlignment())
return;
auto impl_ = mutableImpl();
@@ -352,11 +352,11 @@ PropertyValue<AlignmentType> SymbolLayer::getDefaultTextPitchAlignment() {
return TextPitchAlignment::defaultValue();
}
-PropertyValue<AlignmentType> SymbolLayer::getTextPitchAlignment() const {
+const PropertyValue<AlignmentType>& SymbolLayer::getTextPitchAlignment() const {
return impl().layout.get<TextPitchAlignment>();
}
-void SymbolLayer::setTextPitchAlignment(PropertyValue<AlignmentType> value) {
+void SymbolLayer::setTextPitchAlignment(const PropertyValue<AlignmentType>& value) {
if (value == getTextPitchAlignment())
return;
auto impl_ = mutableImpl();
@@ -368,11 +368,11 @@ PropertyValue<AlignmentType> SymbolLayer::getDefaultTextRotationAlignment() {
return TextRotationAlignment::defaultValue();
}
-PropertyValue<AlignmentType> SymbolLayer::getTextRotationAlignment() const {
+const PropertyValue<AlignmentType>& SymbolLayer::getTextRotationAlignment() const {
return impl().layout.get<TextRotationAlignment>();
}
-void SymbolLayer::setTextRotationAlignment(PropertyValue<AlignmentType> value) {
+void SymbolLayer::setTextRotationAlignment(const PropertyValue<AlignmentType>& value) {
if (value == getTextRotationAlignment())
return;
auto impl_ = mutableImpl();
@@ -384,11 +384,11 @@ PropertyValue<expression::Formatted> SymbolLayer::getDefaultTextField() {
return TextField::defaultValue();
}
-PropertyValue<expression::Formatted> SymbolLayer::getTextField() const {
+const PropertyValue<expression::Formatted>& SymbolLayer::getTextField() const {
return impl().layout.get<TextField>();
}
-void SymbolLayer::setTextField(PropertyValue<expression::Formatted> value) {
+void SymbolLayer::setTextField(const PropertyValue<expression::Formatted>& value) {
if (value == getTextField())
return;
auto impl_ = mutableImpl();
@@ -400,11 +400,11 @@ PropertyValue<std::vector<std::string>> SymbolLayer::getDefaultTextFont() {
return TextFont::defaultValue();
}
-PropertyValue<std::vector<std::string>> SymbolLayer::getTextFont() const {
+const PropertyValue<std::vector<std::string>>& SymbolLayer::getTextFont() const {
return impl().layout.get<TextFont>();
}
-void SymbolLayer::setTextFont(PropertyValue<std::vector<std::string>> value) {
+void SymbolLayer::setTextFont(const PropertyValue<std::vector<std::string>>& value) {
if (value == getTextFont())
return;
auto impl_ = mutableImpl();
@@ -416,11 +416,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextSize() {
return TextSize::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextSize() const {
+const PropertyValue<float>& SymbolLayer::getTextSize() const {
return impl().layout.get<TextSize>();
}
-void SymbolLayer::setTextSize(PropertyValue<float> value) {
+void SymbolLayer::setTextSize(const PropertyValue<float>& value) {
if (value == getTextSize())
return;
auto impl_ = mutableImpl();
@@ -432,11 +432,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextMaxWidth() {
return TextMaxWidth::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextMaxWidth() const {
+const PropertyValue<float>& SymbolLayer::getTextMaxWidth() const {
return impl().layout.get<TextMaxWidth>();
}
-void SymbolLayer::setTextMaxWidth(PropertyValue<float> value) {
+void SymbolLayer::setTextMaxWidth(const PropertyValue<float>& value) {
if (value == getTextMaxWidth())
return;
auto impl_ = mutableImpl();
@@ -448,11 +448,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextLineHeight() {
return TextLineHeight::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextLineHeight() const {
+const PropertyValue<float>& SymbolLayer::getTextLineHeight() const {
return impl().layout.get<TextLineHeight>();
}
-void SymbolLayer::setTextLineHeight(PropertyValue<float> value) {
+void SymbolLayer::setTextLineHeight(const PropertyValue<float>& value) {
if (value == getTextLineHeight())
return;
auto impl_ = mutableImpl();
@@ -464,11 +464,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextLetterSpacing() {
return TextLetterSpacing::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextLetterSpacing() const {
+const PropertyValue<float>& SymbolLayer::getTextLetterSpacing() const {
return impl().layout.get<TextLetterSpacing>();
}
-void SymbolLayer::setTextLetterSpacing(PropertyValue<float> value) {
+void SymbolLayer::setTextLetterSpacing(const PropertyValue<float>& value) {
if (value == getTextLetterSpacing())
return;
auto impl_ = mutableImpl();
@@ -480,11 +480,11 @@ PropertyValue<TextJustifyType> SymbolLayer::getDefaultTextJustify() {
return TextJustify::defaultValue();
}
-PropertyValue<TextJustifyType> SymbolLayer::getTextJustify() const {
+const PropertyValue<TextJustifyType>& SymbolLayer::getTextJustify() const {
return impl().layout.get<TextJustify>();
}
-void SymbolLayer::setTextJustify(PropertyValue<TextJustifyType> value) {
+void SymbolLayer::setTextJustify(const PropertyValue<TextJustifyType>& value) {
if (value == getTextJustify())
return;
auto impl_ = mutableImpl();
@@ -496,11 +496,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextRadialOffset() {
return TextRadialOffset::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextRadialOffset() const {
+const PropertyValue<float>& SymbolLayer::getTextRadialOffset() const {
return impl().layout.get<TextRadialOffset>();
}
-void SymbolLayer::setTextRadialOffset(PropertyValue<float> value) {
+void SymbolLayer::setTextRadialOffset(const PropertyValue<float>& value) {
if (value == getTextRadialOffset())
return;
auto impl_ = mutableImpl();
@@ -512,11 +512,11 @@ PropertyValue<std::vector<TextVariableAnchorType>> SymbolLayer::getDefaultTextVa
return TextVariableAnchor::defaultValue();
}
-PropertyValue<std::vector<TextVariableAnchorType>> SymbolLayer::getTextVariableAnchor() const {
+const PropertyValue<std::vector<TextVariableAnchorType>>& SymbolLayer::getTextVariableAnchor() const {
return impl().layout.get<TextVariableAnchor>();
}
-void SymbolLayer::setTextVariableAnchor(PropertyValue<std::vector<TextVariableAnchorType>> value) {
+void SymbolLayer::setTextVariableAnchor(const PropertyValue<std::vector<TextVariableAnchorType>>& value) {
if (value == getTextVariableAnchor())
return;
auto impl_ = mutableImpl();
@@ -528,11 +528,11 @@ PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultTextAnchor() {
return TextAnchor::defaultValue();
}
-PropertyValue<SymbolAnchorType> SymbolLayer::getTextAnchor() const {
+const PropertyValue<SymbolAnchorType>& SymbolLayer::getTextAnchor() const {
return impl().layout.get<TextAnchor>();
}
-void SymbolLayer::setTextAnchor(PropertyValue<SymbolAnchorType> value) {
+void SymbolLayer::setTextAnchor(const PropertyValue<SymbolAnchorType>& value) {
if (value == getTextAnchor())
return;
auto impl_ = mutableImpl();
@@ -544,11 +544,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextMaxAngle() {
return TextMaxAngle::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextMaxAngle() const {
+const PropertyValue<float>& SymbolLayer::getTextMaxAngle() const {
return impl().layout.get<TextMaxAngle>();
}
-void SymbolLayer::setTextMaxAngle(PropertyValue<float> value) {
+void SymbolLayer::setTextMaxAngle(const PropertyValue<float>& value) {
if (value == getTextMaxAngle())
return;
auto impl_ = mutableImpl();
@@ -560,11 +560,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextRotate() {
return TextRotate::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextRotate() const {
+const PropertyValue<float>& SymbolLayer::getTextRotate() const {
return impl().layout.get<TextRotate>();
}
-void SymbolLayer::setTextRotate(PropertyValue<float> value) {
+void SymbolLayer::setTextRotate(const PropertyValue<float>& value) {
if (value == getTextRotate())
return;
auto impl_ = mutableImpl();
@@ -576,11 +576,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextPadding() {
return TextPadding::defaultValue();
}
-PropertyValue<float> SymbolLayer::getTextPadding() const {
+const PropertyValue<float>& SymbolLayer::getTextPadding() const {
return impl().layout.get<TextPadding>();
}
-void SymbolLayer::setTextPadding(PropertyValue<float> value) {
+void SymbolLayer::setTextPadding(const PropertyValue<float>& value) {
if (value == getTextPadding())
return;
auto impl_ = mutableImpl();
@@ -592,11 +592,11 @@ PropertyValue<bool> SymbolLayer::getDefaultTextKeepUpright() {
return TextKeepUpright::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getTextKeepUpright() const {
+const PropertyValue<bool>& SymbolLayer::getTextKeepUpright() const {
return impl().layout.get<TextKeepUpright>();
}
-void SymbolLayer::setTextKeepUpright(PropertyValue<bool> value) {
+void SymbolLayer::setTextKeepUpright(const PropertyValue<bool>& value) {
if (value == getTextKeepUpright())
return;
auto impl_ = mutableImpl();
@@ -608,11 +608,11 @@ PropertyValue<TextTransformType> SymbolLayer::getDefaultTextTransform() {
return TextTransform::defaultValue();
}
-PropertyValue<TextTransformType> SymbolLayer::getTextTransform() const {
+const PropertyValue<TextTransformType>& SymbolLayer::getTextTransform() const {
return impl().layout.get<TextTransform>();
}
-void SymbolLayer::setTextTransform(PropertyValue<TextTransformType> value) {
+void SymbolLayer::setTextTransform(const PropertyValue<TextTransformType>& value) {
if (value == getTextTransform())
return;
auto impl_ = mutableImpl();
@@ -624,11 +624,11 @@ PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextOffset() {
return TextOffset::defaultValue();
}
-PropertyValue<std::array<float, 2>> SymbolLayer::getTextOffset() const {
+const PropertyValue<std::array<float, 2>>& SymbolLayer::getTextOffset() const {
return impl().layout.get<TextOffset>();
}
-void SymbolLayer::setTextOffset(PropertyValue<std::array<float, 2>> value) {
+void SymbolLayer::setTextOffset(const PropertyValue<std::array<float, 2>>& value) {
if (value == getTextOffset())
return;
auto impl_ = mutableImpl();
@@ -640,11 +640,11 @@ PropertyValue<bool> SymbolLayer::getDefaultTextAllowOverlap() {
return TextAllowOverlap::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getTextAllowOverlap() const {
+const PropertyValue<bool>& SymbolLayer::getTextAllowOverlap() const {
return impl().layout.get<TextAllowOverlap>();
}
-void SymbolLayer::setTextAllowOverlap(PropertyValue<bool> value) {
+void SymbolLayer::setTextAllowOverlap(const PropertyValue<bool>& value) {
if (value == getTextAllowOverlap())
return;
auto impl_ = mutableImpl();
@@ -656,11 +656,11 @@ PropertyValue<bool> SymbolLayer::getDefaultTextIgnorePlacement() {
return TextIgnorePlacement::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getTextIgnorePlacement() const {
+const PropertyValue<bool>& SymbolLayer::getTextIgnorePlacement() const {
return impl().layout.get<TextIgnorePlacement>();
}
-void SymbolLayer::setTextIgnorePlacement(PropertyValue<bool> value) {
+void SymbolLayer::setTextIgnorePlacement(const PropertyValue<bool>& value) {
if (value == getTextIgnorePlacement())
return;
auto impl_ = mutableImpl();
@@ -672,11 +672,11 @@ PropertyValue<bool> SymbolLayer::getDefaultTextOptional() {
return TextOptional::defaultValue();
}
-PropertyValue<bool> SymbolLayer::getTextOptional() const {
+const PropertyValue<bool>& SymbolLayer::getTextOptional() const {
return impl().layout.get<TextOptional>();
}
-void SymbolLayer::setTextOptional(PropertyValue<bool> value) {
+void SymbolLayer::setTextOptional(const PropertyValue<bool>& value) {
if (value == getTextOptional())
return;
auto impl_ = mutableImpl();
@@ -691,11 +691,11 @@ PropertyValue<float> SymbolLayer::getDefaultIconOpacity() {
return { 1 };
}
-PropertyValue<float> SymbolLayer::getIconOpacity() const {
+const PropertyValue<float>& SymbolLayer::getIconOpacity() const {
return impl().paint.template get<IconOpacity>().value;
}
-void SymbolLayer::setIconOpacity(PropertyValue<float> value) {
+void SymbolLayer::setIconOpacity(const PropertyValue<float>& value) {
if (value == getIconOpacity())
return;
auto impl_ = mutableImpl();
@@ -718,11 +718,11 @@ PropertyValue<Color> SymbolLayer::getDefaultIconColor() {
return { Color::black() };
}
-PropertyValue<Color> SymbolLayer::getIconColor() const {
+const PropertyValue<Color>& SymbolLayer::getIconColor() const {
return impl().paint.template get<IconColor>().value;
}
-void SymbolLayer::setIconColor(PropertyValue<Color> value) {
+void SymbolLayer::setIconColor(const PropertyValue<Color>& value) {
if (value == getIconColor())
return;
auto impl_ = mutableImpl();
@@ -745,11 +745,11 @@ PropertyValue<Color> SymbolLayer::getDefaultIconHaloColor() {
return { {} };
}
-PropertyValue<Color> SymbolLayer::getIconHaloColor() const {
+const PropertyValue<Color>& SymbolLayer::getIconHaloColor() const {
return impl().paint.template get<IconHaloColor>().value;
}
-void SymbolLayer::setIconHaloColor(PropertyValue<Color> value) {
+void SymbolLayer::setIconHaloColor(const PropertyValue<Color>& value) {
if (value == getIconHaloColor())
return;
auto impl_ = mutableImpl();
@@ -772,11 +772,11 @@ PropertyValue<float> SymbolLayer::getDefaultIconHaloWidth() {
return { 0 };
}
-PropertyValue<float> SymbolLayer::getIconHaloWidth() const {
+const PropertyValue<float>& SymbolLayer::getIconHaloWidth() const {
return impl().paint.template get<IconHaloWidth>().value;
}
-void SymbolLayer::setIconHaloWidth(PropertyValue<float> value) {
+void SymbolLayer::setIconHaloWidth(const PropertyValue<float>& value) {
if (value == getIconHaloWidth())
return;
auto impl_ = mutableImpl();
@@ -799,11 +799,11 @@ PropertyValue<float> SymbolLayer::getDefaultIconHaloBlur() {
return { 0 };
}
-PropertyValue<float> SymbolLayer::getIconHaloBlur() const {
+const PropertyValue<float>& SymbolLayer::getIconHaloBlur() const {
return impl().paint.template get<IconHaloBlur>().value;
}
-void SymbolLayer::setIconHaloBlur(PropertyValue<float> value) {
+void SymbolLayer::setIconHaloBlur(const PropertyValue<float>& value) {
if (value == getIconHaloBlur())
return;
auto impl_ = mutableImpl();
@@ -826,11 +826,11 @@ PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultIconTranslate() {
return { {{ 0, 0 }} };
}
-PropertyValue<std::array<float, 2>> SymbolLayer::getIconTranslate() const {
+const PropertyValue<std::array<float, 2>>& SymbolLayer::getIconTranslate() const {
return impl().paint.template get<IconTranslate>().value;
}
-void SymbolLayer::setIconTranslate(PropertyValue<std::array<float, 2>> value) {
+void SymbolLayer::setIconTranslate(const PropertyValue<std::array<float, 2>>& value) {
if (value == getIconTranslate())
return;
auto impl_ = mutableImpl();
@@ -853,11 +853,11 @@ PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultIconTranslateAnchor()
return { TranslateAnchorType::Map };
}
-PropertyValue<TranslateAnchorType> SymbolLayer::getIconTranslateAnchor() const {
+const PropertyValue<TranslateAnchorType>& SymbolLayer::getIconTranslateAnchor() const {
return impl().paint.template get<IconTranslateAnchor>().value;
}
-void SymbolLayer::setIconTranslateAnchor(PropertyValue<TranslateAnchorType> value) {
+void SymbolLayer::setIconTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
if (value == getIconTranslateAnchor())
return;
auto impl_ = mutableImpl();
@@ -880,11 +880,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextOpacity() {
return { 1 };
}
-PropertyValue<float> SymbolLayer::getTextOpacity() const {
+const PropertyValue<float>& SymbolLayer::getTextOpacity() const {
return impl().paint.template get<TextOpacity>().value;
}
-void SymbolLayer::setTextOpacity(PropertyValue<float> value) {
+void SymbolLayer::setTextOpacity(const PropertyValue<float>& value) {
if (value == getTextOpacity())
return;
auto impl_ = mutableImpl();
@@ -907,11 +907,11 @@ PropertyValue<Color> SymbolLayer::getDefaultTextColor() {
return { Color::black() };
}
-PropertyValue<Color> SymbolLayer::getTextColor() const {
+const PropertyValue<Color>& SymbolLayer::getTextColor() const {
return impl().paint.template get<TextColor>().value;
}
-void SymbolLayer::setTextColor(PropertyValue<Color> value) {
+void SymbolLayer::setTextColor(const PropertyValue<Color>& value) {
if (value == getTextColor())
return;
auto impl_ = mutableImpl();
@@ -934,11 +934,11 @@ PropertyValue<Color> SymbolLayer::getDefaultTextHaloColor() {
return { {} };
}
-PropertyValue<Color> SymbolLayer::getTextHaloColor() const {
+const PropertyValue<Color>& SymbolLayer::getTextHaloColor() const {
return impl().paint.template get<TextHaloColor>().value;
}
-void SymbolLayer::setTextHaloColor(PropertyValue<Color> value) {
+void SymbolLayer::setTextHaloColor(const PropertyValue<Color>& value) {
if (value == getTextHaloColor())
return;
auto impl_ = mutableImpl();
@@ -961,11 +961,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextHaloWidth() {
return { 0 };
}
-PropertyValue<float> SymbolLayer::getTextHaloWidth() const {
+const PropertyValue<float>& SymbolLayer::getTextHaloWidth() const {
return impl().paint.template get<TextHaloWidth>().value;
}
-void SymbolLayer::setTextHaloWidth(PropertyValue<float> value) {
+void SymbolLayer::setTextHaloWidth(const PropertyValue<float>& value) {
if (value == getTextHaloWidth())
return;
auto impl_ = mutableImpl();
@@ -988,11 +988,11 @@ PropertyValue<float> SymbolLayer::getDefaultTextHaloBlur() {
return { 0 };
}
-PropertyValue<float> SymbolLayer::getTextHaloBlur() const {
+const PropertyValue<float>& SymbolLayer::getTextHaloBlur() const {
return impl().paint.template get<TextHaloBlur>().value;
}
-void SymbolLayer::setTextHaloBlur(PropertyValue<float> value) {
+void SymbolLayer::setTextHaloBlur(const PropertyValue<float>& value) {
if (value == getTextHaloBlur())
return;
auto impl_ = mutableImpl();
@@ -1015,11 +1015,11 @@ PropertyValue<std::array<float, 2>> SymbolLayer::getDefaultTextTranslate() {
return { {{ 0, 0 }} };
}
-PropertyValue<std::array<float, 2>> SymbolLayer::getTextTranslate() const {
+const PropertyValue<std::array<float, 2>>& SymbolLayer::getTextTranslate() const {
return impl().paint.template get<TextTranslate>().value;
}
-void SymbolLayer::setTextTranslate(PropertyValue<std::array<float, 2>> value) {
+void SymbolLayer::setTextTranslate(const PropertyValue<std::array<float, 2>>& value) {
if (value == getTextTranslate())
return;
auto impl_ = mutableImpl();
@@ -1042,11 +1042,11 @@ PropertyValue<TranslateAnchorType> SymbolLayer::getDefaultTextTranslateAnchor()
return { TranslateAnchorType::Map };
}
-PropertyValue<TranslateAnchorType> SymbolLayer::getTextTranslateAnchor() const {
+const PropertyValue<TranslateAnchorType>& SymbolLayer::getTextTranslateAnchor() const {
return impl().paint.template get<TextTranslateAnchor>().value;
}
-void SymbolLayer::setTextTranslateAnchor(PropertyValue<TranslateAnchorType> value) {
+void SymbolLayer::setTextTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
if (value == getTextTranslateAnchor())
return;
auto impl_ = mutableImpl();
@@ -1135,7 +1135,7 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::IconOpacity || property == Property::IconHaloWidth || property == Property::IconHaloBlur || property == Property::TextOpacity || property == Property::TextHaloWidth || property == Property::TextHaloBlur) {
@@ -1417,7 +1417,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co
return Error { "layer doesn't support this property" };
}
- Property property = static_cast<Property>(it->second);
+ auto property = static_cast<Property>(it->second);
if (property == Property::SymbolPlacement) {
diff --git a/src/mbgl/style/sources/raster_source.cpp b/src/mbgl/style/sources/raster_source.cpp
index c2f96dbd55..2d08e4be80 100644
--- a/src/mbgl/style/sources/raster_source.cpp
+++ b/src/mbgl/style/sources/raster_source.cpp
@@ -48,7 +48,7 @@ void RasterSource::loadDescription(FileSource& fileSource) {
return;
}
- const std::string& url = urlOrTileset.get<std::string>();
+ const auto& url = urlOrTileset.get<std::string>();
req = fileSource.request(Resource::source(url), [this, url](Response res) {
if (res.error) {
observer->onSourceError(*this, std::make_exception_ptr(std::runtime_error(res.error->message)));
diff --git a/src/mbgl/style/sources/vector_source.cpp b/src/mbgl/style/sources/vector_source.cpp
index 6cede8fae9..d141d291e1 100644
--- a/src/mbgl/style/sources/vector_source.cpp
+++ b/src/mbgl/style/sources/vector_source.cpp
@@ -45,7 +45,7 @@ void VectorSource::loadDescription(FileSource& fileSource) {
return;
}
- const std::string& url = urlOrTileset.get<std::string>();
+ const auto& url = urlOrTileset.get<std::string>();
req = fileSource.request(Resource::source(url), [this, url](Response res) {
if (res.error) {
observer->onSourceError(*this, std::make_exception_ptr(std::runtime_error(res.error->message)));
diff --git a/src/mbgl/text/cross_tile_symbol_index.cpp b/src/mbgl/text/cross_tile_symbol_index.cpp
index 0992433ccb..5170bfad75 100644
--- a/src/mbgl/text/cross_tile_symbol_index.cpp
+++ b/src/mbgl/text/cross_tile_symbol_index.cpp
@@ -59,8 +59,7 @@ void TileLayerIndex::findMatches(std::vector<SymbolInstance>& symbolInstances, c
}
}
-CrossTileSymbolLayerIndex::CrossTileSymbolLayerIndex() {
-}
+CrossTileSymbolLayerIndex::CrossTileSymbolLayerIndex() = default;
/*
* Sometimes when a user pans across the antimeridian the longitude value gets wrapped.
@@ -163,7 +162,7 @@ bool CrossTileSymbolLayerIndex::removeStaleBuckets(const std::unordered_set<uint
return tilesChanged;
}
-CrossTileSymbolIndex::CrossTileSymbolIndex() {}
+CrossTileSymbolIndex::CrossTileSymbolIndex() = default;
bool CrossTileSymbolIndex::addLayer(const RenderLayerSymbolInterface& symbolInterface, float lng) {
diff --git a/src/mbgl/text/language_tag.cpp b/src/mbgl/text/language_tag.cpp
index 90d2f26e16..bd785e4089 100644
--- a/src/mbgl/text/language_tag.cpp
+++ b/src/mbgl/text/language_tag.cpp
@@ -185,8 +185,8 @@ struct bcp47_parser : qi::grammar<Iterator>
};
LanguageTag LanguageTag::fromBCP47(const std::string& bcp47Tag) {
- typedef std::string::const_iterator iterator_type;
- typedef bcp47_parser<iterator_type> bcp47_parser;
+ using iterator_type = std::string::const_iterator;
+ using bcp47_parser = bcp47_parser<iterator_type>;
bcp47_parser parser;
std::string::const_iterator iter = bcp47Tag.begin();
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index f6c4ac1eb6..16295256c5 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -8,6 +8,7 @@
#include <mbgl/renderer/buckets/symbol_bucket.hpp>
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/util/math.hpp>
+#include <utility>
namespace mbgl {
@@ -62,7 +63,7 @@ Placement::Placement(const TransformState& state_, MapMode mapMode_, style::Tran
: collisionIndex(state_)
, state(state_)
, mapMode(mapMode_)
- , transitionOptions(transitionOptions_)
+ , transitionOptions(std::move(transitionOptions_))
, collisionGroups(crossSourceCollisions)
, prevPlacement(std::move(prevPlacement_))
{
@@ -80,7 +81,7 @@ void Placement::placeLayer(const RenderLayerSymbolInterface& symbolInterface, co
continue;
}
assert(renderTile.tile.kind == Tile::Kind::Geometry);
- GeometryTile& geometryTile = static_cast<GeometryTile&>(renderTile.tile);
+ auto& geometryTile = static_cast<GeometryTile&>(renderTile.tile);
auto bucket = symbolInterface.getSymbolBucket(renderTile);
if (!bucket) {
diff --git a/src/mbgl/tile/custom_geometry_tile.cpp b/src/mbgl/tile/custom_geometry_tile.cpp
index 7e99a4568c..7b1fc2e2d9 100644
--- a/src/mbgl/tile/custom_geometry_tile.cpp
+++ b/src/mbgl/tile/custom_geometry_tile.cpp
@@ -8,6 +8,7 @@
#include <mbgl/style/custom_tile_loader.hpp>
#include <mapbox/geojsonvt.hpp>
+#include <utility>
namespace mbgl {
@@ -19,7 +20,7 @@ CustomGeometryTile::CustomGeometryTile(const OverscaledTileID& overscaledTileID,
: GeometryTile(overscaledTileID, sourceID_, parameters),
necessity(TileNecessity::Optional),
options(options_),
- loader(loader_),
+ loader(std::move(loader_)),
mailbox(std::make_shared<Mailbox>(*Scheduler::GetCurrent())),
actorRef(*this, mailbox) {
}
diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp
index 0b703cd68b..0c8b7a4ca1 100644
--- a/src/mbgl/tile/geometry_tile_worker.cpp
+++ b/src/mbgl/tile/geometry_tile_worker.cpp
@@ -21,6 +21,7 @@
#include <mbgl/util/stopwatch.hpp>
#include <unordered_set>
+#include <utility>
namespace mbgl {
@@ -29,7 +30,7 @@ using namespace style;
GeometryTileWorker::GeometryTileWorker(ActorRef<GeometryTileWorker> self_,
ActorRef<GeometryTile> parent_,
OverscaledTileID id_,
- const std::string& sourceID_,
+ std::string sourceID_,
const std::atomic<bool>& obsolete_,
const MapMode mode_,
const float pixelRatio_,
@@ -37,7 +38,7 @@ GeometryTileWorker::GeometryTileWorker(ActorRef<GeometryTileWorker> self_,
: self(std::move(self_)),
parent(std::move(parent_)),
id(std::move(id_)),
- sourceID(sourceID_),
+ sourceID(std::move(sourceID_)),
obsolete(obsolete_),
mode(mode_),
pixelRatio(pixelRatio_),
diff --git a/src/mbgl/tile/geometry_tile_worker.hpp b/src/mbgl/tile/geometry_tile_worker.hpp
index 706bac0154..4402875603 100644
--- a/src/mbgl/tile/geometry_tile_worker.hpp
+++ b/src/mbgl/tile/geometry_tile_worker.hpp
@@ -32,7 +32,7 @@ public:
GeometryTileWorker(ActorRef<GeometryTileWorker> self,
ActorRef<GeometryTile> parent,
OverscaledTileID,
- const std::string&,
+ std::string,
const std::atomic<bool>&,
const MapMode,
const float pixelRatio,
diff --git a/src/mbgl/util/string.cpp b/src/mbgl/util/string.cpp
index 2f737e7436..5d3e44bff6 100644
--- a/src/mbgl/util/string.cpp
+++ b/src/mbgl/util/string.cpp
@@ -78,7 +78,7 @@ std::string toPaddedHex(T x) {
return result;
}
-}
+} // namespace
std::string toHex(size_t value) {
return toPaddedHex(value);
diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp
index 7979c550a9..5189b79f26 100644
--- a/src/mbgl/util/tile_cover.cpp
+++ b/src/mbgl/util/tile_cover.cpp
@@ -237,9 +237,7 @@ TileCover::TileCover(const Geometry<double>& geom, int32_t z, bool project/* = t
: impl( std::make_unique<TileCover::Impl>(z, geom, project)) {
}
-TileCover::~TileCover() {
-
-}
+TileCover::~TileCover() = default;
optional<UnwrappedTileID> TileCover::next() {
return impl->next();
diff --git a/src/mbgl/util/tile_cover_impl.cpp b/src/mbgl/util/tile_cover_impl.cpp
index f783dfc4bd..e7181eeb5f 100644
--- a/src/mbgl/util/tile_cover_impl.cpp
+++ b/src/mbgl/util/tile_cover_impl.cpp
@@ -3,8 +3,8 @@
#include <functional>
#include <cmath>
-#include <assert.h>
-#include <limits.h>
+#include <cassert>
+#include <climits>
#include <algorithm>
namespace mbgl {
diff --git a/test/actor/actor.test.cpp b/test/actor/actor.test.cpp
index 7493abe263..02308b7ce0 100644
--- a/test/actor/actor.test.cpp
+++ b/test/actor/actor.test.cpp
@@ -101,7 +101,7 @@ TEST(Actor, DestructionBlocksOnSend) {
waited(false) {
}
- ~TestScheduler() {
+ ~TestScheduler() override {
EXPECT_TRUE(waited.load());
}
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index c836ab81ac..4a0a34bafc 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -39,7 +39,7 @@ void main() {
class TestLayer : public mbgl::style::CustomLayerHost {
public:
- void initialize() {
+ void initialize() override {
program = MBGL_CHECK_ERROR(glCreateProgram());
vertexShader = MBGL_CHECK_ERROR(glCreateShader(GL_VERTEX_SHADER));
fragmentShader = MBGL_CHECK_ERROR(glCreateShader(GL_FRAGMENT_SHADER));
@@ -59,7 +59,7 @@ public:
MBGL_CHECK_ERROR(glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(GLfloat), triangle, GL_STATIC_DRAW));
}
- void render(const mbgl::style::CustomLayerRenderParameters&) {
+ void render(const mbgl::style::CustomLayerRenderParameters&) override {
MBGL_CHECK_ERROR(glUseProgram(program));
MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, buffer));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
@@ -67,9 +67,9 @@ public:
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, 3));
}
- void contextLost() {}
+ void contextLost() override {}
- void deinitialize() {
+ void deinitialize() override {
if (program) {
MBGL_CHECK_ERROR(glDeleteBuffers(1, &buffer));
MBGL_CHECK_ERROR(glDetachShader(program, vertexShader));
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index a2d36b2ca2..3af2acdb8b 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -48,7 +48,7 @@ public:
template <typename T = FileSource>
MapTest(const std::string& cachePath, const std::string& assetPath,
float pixelRatio = 1, MapMode mode = MapMode::Static,
- typename std::enable_if<std::is_same<T, DefaultFileSource>::value>::type* = 0)
+ typename std::enable_if<std::is_same<T, DefaultFileSource>::value>::type* = nullptr)
: fileSource(std::make_shared<T>(cachePath, assetPath))
, frontend(pixelRatio, threadPool)
, map(frontend, observer, fileSource, threadPool,
diff --git a/test/src/mbgl/test/sqlite3_test_fs.cpp b/test/src/mbgl/test/sqlite3_test_fs.cpp
index 16d411faff..e4f958c900 100644
--- a/test/src/mbgl/test/sqlite3_test_fs.cpp
+++ b/test/src/mbgl/test/sqlite3_test_fs.cpp
@@ -29,11 +29,11 @@ static int sqlite3_test_fs_close(sqlite3_file* pFile) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
const int rc = file->real->pMethods->xClose(file->real);
if (rc == SQLITE_OK) {
sqlite3_free((void*)file->base.pMethods);
- file->base.pMethods = 0;
+ file->base.pMethods = nullptr;
}
return rc;
}
@@ -52,7 +52,7 @@ static int sqlite3_test_fs_read(sqlite3_file* pFile, void* zBuf, int iAmt, sqlit
}
sqlite3_test_fs_read_limit -= iAmt;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xRead(file->real, zBuf, iAmt, iOfst);
}
@@ -70,7 +70,7 @@ static int sqlite3_test_fs_write(sqlite3_file* pFile, const void* zBuf, int iAmt
}
sqlite3_test_fs_write_limit -= iAmt;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xWrite(file->real, zBuf, iAmt, iOfst);
}
@@ -81,7 +81,7 @@ static int sqlite3_test_fs_truncate(sqlite3_file* pFile, sqlite3_int64 size) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xTruncate(file->real, size);
}
@@ -92,7 +92,7 @@ static int sqlite3_test_fs_sync(sqlite3_file* pFile, int flags) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xSync(file->real, flags);
}
@@ -103,7 +103,7 @@ static int sqlite3_test_fs_file_size(sqlite3_file* pFile, sqlite3_int64* pSize)
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xFileSize(file->real, pSize);
}
@@ -111,7 +111,7 @@ static int sqlite3_test_fs_lock(sqlite3_file* pFile, int eLock) {
if (sqlite3_test_fs_debug) {
fprintf(stderr, "SQLite3: lock(%p, %d)\n", pFile, eLock);
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xLock(file->real, eLock);
}
@@ -119,7 +119,7 @@ static int sqlite3_test_fs_unlock(sqlite3_file* pFile, int eLock) {
if (sqlite3_test_fs_debug) {
fprintf(stderr, "SQLite3: unlock(%p, %d)\n", pFile, eLock);
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xUnlock(file->real, eLock);
}
@@ -127,7 +127,7 @@ static int sqlite3_test_fs_check_reserved_lock(sqlite3_file* pFile, int* pResOut
if (sqlite3_test_fs_debug) {
fprintf(stderr, "SQLite3: check_reserved_lock(%p)\n", pFile);
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xCheckReservedLock(file->real, pResOut);
}
@@ -138,7 +138,7 @@ static int sqlite3_test_fs_file_control(sqlite3_file* pFile, int op, void* pArg)
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xFileControl(file->real, op, pArg);
}
@@ -149,7 +149,7 @@ static int sqlite3_test_fs_sector_size(sqlite3_file* pFile) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xSectorSize(file->real);
}
@@ -160,7 +160,7 @@ static int sqlite3_test_fs_device_characteristics(sqlite3_file* pFile) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xDeviceCharacteristics(file->real);
}
@@ -169,34 +169,34 @@ static int sqlite3_test_fs_open(sqlite3_vfs* vfs, const char* zName, sqlite3_fil
fprintf(stderr, "SQLite3: open(name=%s, flags=%d) -> %p\n", zName, flags, pFile);
}
if (!sqlite3_test_fs_io) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return SQLITE_AUTH;
}
if (!sqlite3_test_fs_file_open) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return SQLITE_CANTOPEN;
}
- File* file = (File*)pFile;
- sqlite3_vfs* unix_fs = (sqlite3_vfs*)vfs->pAppData;
+ auto* file = (File*)pFile;
+ auto* unix_fs = (sqlite3_vfs*)vfs->pAppData;
file->real = (sqlite3_file*)&file[1];
if (!sqlite3_test_fs_file_create) {
int res;
const int result = unix_fs->xAccess(vfs, zName, SQLITE_ACCESS_EXISTS, &res);
if (result != SQLITE_OK) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return result;
}
if (res != 1) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return SQLITE_CANTOPEN;
}
}
const int status = unix_fs->xOpen(unix_fs, zName, file->real, flags, pOutFlags);
if (file->real->pMethods) {
- sqlite3_io_methods* methods = (sqlite3_io_methods*)sqlite3_malloc(sizeof(sqlite3_io_methods));
+ auto* methods = (sqlite3_io_methods*)sqlite3_malloc(sizeof(sqlite3_io_methods));
memset(methods, 0, sizeof(sqlite3_io_methods));
methods->iVersion = 1;
methods->xClose = sqlite3_test_fs_close;
@@ -223,7 +223,7 @@ static int sqlite3_test_fs_delete(sqlite3_vfs* vfs, const char *zPath, int dirSy
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- sqlite3_vfs* unix_fs = (sqlite3_vfs*)vfs->pAppData;
+ auto* unix_fs = (sqlite3_vfs*)vfs->pAppData;
return unix_fs->xDelete(unix_fs, zPath, dirSync);
}
@@ -234,7 +234,7 @@ static int sqlite3_test_fs_access(sqlite3_vfs* vfs, const char *zPath, int flags
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- sqlite3_vfs* unix_fs = (sqlite3_vfs*)vfs->pAppData;
+ auto* unix_fs = (sqlite3_vfs*)vfs->pAppData;
return unix_fs->xAccess(unix_fs, zPath, flags, pResOut);
}
@@ -243,12 +243,12 @@ namespace test {
SQLite3TestFS::SQLite3TestFS() {
sqlite3_vfs* unix_fs = sqlite3_vfs_find("unix");
- if (unix_fs == 0) {
+ if (unix_fs == nullptr) {
abort();
}
- sqlite3_vfs* test_fs = (sqlite3_vfs*)sqlite3_malloc(sizeof(sqlite3_vfs));
- if (test_fs == 0) {
+ auto* test_fs = (sqlite3_vfs*)sqlite3_malloc(sizeof(sqlite3_vfs));
+ if (test_fs == nullptr) {
abort();
}
memset(test_fs, 0, sizeof(sqlite3_vfs));
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index 744803a4b2..90cdc13d7c 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -91,7 +91,7 @@ const Response response = [] {
return res;
}();
-} // namespace
+} // namespace fixture
TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Create)) {
FixtureLog log;
diff --git a/test/style/filter.test.cpp b/test/style/filter.test.cpp
index ef38a1a789..40219108bb 100644
--- a/test/style/filter.test.cpp
+++ b/test/style/filter.test.cpp
@@ -117,10 +117,10 @@ TEST(Filter, EqualsType) {
ASSERT_TRUE(filter(f, {{}}, {}, FeatureType::LineString, {}));
ASSERT_FALSE(filter(f, {{}}, {}, FeatureType::Point, {}));
- invalidFilter("[\"==\", \"$type\"]");
- invalidFilter("[\"==\", \"$type\", null]");
- invalidFilter("[\"==\", \"$type\", \"foo\", 1]");
- invalidFilter("[\"==\", \"$type\", \"foo\", \"Point\"]");
+ invalidFilter(R"(["==", "$type"])");
+ invalidFilter(R"(["==", "$type", null])");
+ invalidFilter(R"(["==", "$type", "foo", 1])");
+ invalidFilter(R"(["==", "$type", "foo", "Point"])");
}
TEST(Filter, InType) {
diff --git a/test/text/glyph_manager.test.cpp b/test/text/glyph_manager.test.cpp
index 3d7a220dc5..3dcf1e204c 100644
--- a/test/text/glyph_manager.test.cpp
+++ b/test/text/glyph_manager.test.cpp
@@ -19,11 +19,11 @@ static constexpr const size_t stubBitmapLength = 900;
class StubLocalGlyphRasterizer : public LocalGlyphRasterizer {
public:
- bool canRasterizeGlyph(const FontStack&, GlyphID glyphID) {
+ bool canRasterizeGlyph(const FontStack&, GlyphID glyphID) override {
return util::i18n::allowsIdeographicBreaking(glyphID);
}
- Glyph rasterizeGlyph(const FontStack&, GlyphID glyphID) {
+ Glyph rasterizeGlyph(const FontStack&, GlyphID glyphID) override {
Glyph stub;
stub.id = glyphID;
diff --git a/test/util/merge_lines.test.cpp b/test/util/merge_lines.test.cpp
index 1d4b0d230e..1c8c7aae8f 100644
--- a/test/util/merge_lines.test.cpp
+++ b/test/util/merge_lines.test.cpp
@@ -15,7 +15,7 @@ namespace {
PropertyMap properties;
LineString<int16_t> emptyLine;
-}
+} // namespace
class SymbolFeatureStub : public SymbolFeature {
public:
diff --git a/test/util/peer.test.cpp b/test/util/peer.test.cpp
index aa5a4cc538..a808dd27d1 100644
--- a/test/util/peer.test.cpp
+++ b/test/util/peer.test.cpp
@@ -6,7 +6,7 @@ using namespace mbgl::util;
class TestType {
public:
- TestType() : i1(0), i2(1) {
+ TestType() {
str[0] = 'a';
}
@@ -18,14 +18,14 @@ public:
TestType(const TestType&) = delete;
TestType& operator=(const TestType&) = delete;
- int i1;
- int i2;
+ int i1 = 0;
+ int i2 = 1;
char str[256];
};
bool IsStackAllocated (const peer& a, const void* obj1) {
- uintptr_t a_ptr = (uintptr_t)(&a);
- uintptr_t obj = (uintptr_t)(obj1);
+ auto a_ptr = (uintptr_t)(&a);
+ auto obj = (uintptr_t)(obj1);
return (obj >= a_ptr && obj < a_ptr + sizeof(peer));
};
@@ -163,7 +163,7 @@ TEST(Peer, UniquePtr) {
EXPECT_FALSE(u1.has_value());
peer u2;
- TestType * t3 = new TestType();
+ auto* t3 = new TestType();
u2 = std::unique_ptr<TestType>(t3);
EXPECT_TRUE(u2.has_value());
}
diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp
index 7045305625..3fc7681520 100644
--- a/test/util/tile_cover.test.cpp
+++ b/test/util/tile_cover.test.cpp
@@ -3,8 +3,8 @@
#include <mbgl/map/transform.hpp>
#include <algorithm>
-#include <stdlib.h> /* srand, rand */
-#include <time.h> /* time */
+#include <cstdlib> /* srand, rand */
+#include <ctime> /* time */
#include <gtest/gtest.h>
using namespace mbgl;
@@ -314,9 +314,9 @@ TEST(TileCount, BoundsCrossingAntimeridian) {
}
TEST(TileCover, DISABLED_FuzzPoly) {
- while(1)
+ while(true)
{
- std::srand (time(NULL));
+ std::srand (time(nullptr));
std::size_t len = std::rand() % 10000 + 3;
Polygon<double> polygon;
@@ -342,9 +342,9 @@ TEST(TileCover, DISABLED_FuzzPoly) {
}
TEST(TileCover, DISABLED_FuzzLine) {
- while(1)
+ while(true)
{
- std::srand (time(NULL));
+ std::srand (time(nullptr));
std::size_t len = std::rand() % 10000 + 3;
MultiLineString<double> mls;