summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/actor/mailbox.cpp4
-rw-r--r--src/mbgl/map/map.cpp37
-rw-r--r--src/mbgl/map/transform.cpp7
-rw-r--r--src/mbgl/map/transform.hpp7
-rw-r--r--src/mbgl/map/transform_state.cpp2
-rw-r--r--src/mbgl/map/transform_state.hpp2
-rw-r--r--src/mbgl/platform/settings.cpp2
-rw-r--r--src/mbgl/renderer/buckets/fill_bucket.cpp3
-rw-r--r--src/mbgl/renderer/buckets/fill_bucket.hpp2
-rw-r--r--src/mbgl/renderer/buckets/line_bucket.cpp2
-rw-r--r--src/mbgl/renderer/buckets/line_bucket.hpp2
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.cpp2
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.hpp2
-rw-r--r--src/mbgl/renderer/render_orchestrator.cpp4
-rw-r--r--src/mbgl/renderer/render_orchestrator.hpp4
-rw-r--r--src/mbgl/renderer/render_source.cpp2
-rw-r--r--src/mbgl/renderer/render_source.hpp2
-rw-r--r--src/mbgl/renderer/renderer.cpp2
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp14
-rw-r--r--src/mbgl/renderer/renderer_impl.hpp4
-rw-r--r--src/mbgl/renderer/sources/render_geojson_source.cpp3
-rw-r--r--src/mbgl/sprite/sprite_parser.cpp17
-rw-r--r--src/mbgl/sprite/sprite_parser.hpp2
-rw-r--r--src/mbgl/style/conversion/filter.cpp17
-rw-r--r--src/mbgl/style/conversion/function.cpp108
-rw-r--r--src/mbgl/style/custom_tile_loader.cpp2
-rw-r--r--src/mbgl/style/custom_tile_loader.hpp2
-rw-r--r--src/mbgl/style/expression/assertion.cpp9
-rw-r--r--src/mbgl/style/expression/collator.cpp4
-rw-r--r--src/mbgl/style/expression/comparison.cpp40
-rw-r--r--src/mbgl/style/expression/compound_expression.cpp141
-rw-r--r--src/mbgl/style/expression/dsl.cpp15
-rw-r--r--src/mbgl/style/expression/expression.cpp12
-rw-r--r--src/mbgl/style/expression/in.cpp8
-rw-r--r--src/mbgl/style/expression/interpolate.cpp12
-rw-r--r--src/mbgl/style/expression/parsing_context.cpp25
-rw-r--r--src/mbgl/style/image.cpp2
-rw-r--r--src/mbgl/style/light.cpp10
-rw-r--r--src/mbgl/style/light.cpp.ejs4
-rw-r--r--src/mbgl/style/sources/custom_geometry_source.cpp2
-rw-r--r--src/mbgl/style/sources/custom_geometry_source_impl.cpp4
-rw-r--r--src/mbgl/style/sources/custom_geometry_source_impl.hpp4
-rw-r--r--src/mbgl/style/sources/geojson_source.cpp2
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp2
-rw-r--r--src/mbgl/style/sources/image_source.cpp2
-rw-r--r--src/mbgl/style/sources/raster_dem_source.cpp4
-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/style/style_impl.cpp4
-rw-r--r--src/mbgl/style/style_impl.hpp3
-rw-r--r--src/mbgl/text/collision_index.cpp4
-rw-r--r--src/mbgl/text/collision_index.hpp4
-rw-r--r--src/mbgl/text/glyph_manager.cpp6
-rw-r--r--src/mbgl/text/local_glyph_rasterizer.hpp2
-rw-r--r--src/mbgl/text/tagged_string.cpp2
-rw-r--r--src/mbgl/text/tagged_string.hpp2
-rw-r--r--src/mbgl/tile/custom_geometry_tile.cpp2
-rw-r--r--src/mbgl/tile/geojson_tile.cpp3
-rw-r--r--src/mbgl/tile/geometry_tile.cpp5
-rw-r--r--src/mbgl/tile/geometry_tile_data.cpp4
-rw-r--r--src/mbgl/tile/raster_dem_tile.cpp27
-rw-r--r--src/mbgl/tile/raster_dem_tile.hpp2
-rw-r--r--src/mbgl/tile/raster_dem_tile_worker.cpp9
-rw-r--r--src/mbgl/tile/raster_dem_tile_worker.hpp4
-rw-r--r--src/mbgl/tile/raster_tile.cpp27
-rw-r--r--src/mbgl/tile/raster_tile.hpp2
-rw-r--r--src/mbgl/tile/raster_tile_worker.cpp7
-rw-r--r--src/mbgl/tile/raster_tile_worker.hpp4
-rw-r--r--src/mbgl/tile/vector_tile.cpp14
-rw-r--r--src/mbgl/tile/vector_tile.hpp2
-rw-r--r--src/mbgl/util/string.cpp2
-rw-r--r--src/mbgl/util/tile_cover.cpp2
72 files changed, 383 insertions, 323 deletions
diff --git a/src/mbgl/actor/mailbox.cpp b/src/mbgl/actor/mailbox.cpp
index 79467a9258..095a5cc497 100644
--- a/src/mbgl/actor/mailbox.cpp
+++ b/src/mbgl/actor/mailbox.cpp
@@ -91,7 +91,7 @@ void Mailbox::receive() {
}
// static
-void Mailbox::maybeReceive(std::weak_ptr<Mailbox> mailbox) {
+void Mailbox::maybeReceive(const std::weak_ptr<Mailbox>& mailbox) {
if (auto locked = mailbox.lock()) {
locked->receive();
}
@@ -99,7 +99,7 @@ void Mailbox::maybeReceive(std::weak_ptr<Mailbox> mailbox) {
// static
std::function<void()> Mailbox::makeClosure(std::weak_ptr<Mailbox> mailbox) {
- return [mailbox]() { maybeReceive(mailbox); };
+ return [mailbox = std::move(mailbox)]() { maybeReceive(mailbox); };
}
} // namespace mbgl
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 7e72595149..eda16160ae 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -128,7 +128,7 @@ bool Map::isPanning() const {
#pragma mark -
-CameraOptions Map::getCameraOptions(optional<EdgeInsets> padding) const {
+CameraOptions Map::getCameraOptions(const optional<EdgeInsets>& padding) const {
return impl->transform.getCameraOptions(padding);
}
@@ -158,7 +158,7 @@ void Map::pitchBy(double pitch, const AnimationOptions& animation) {
easeTo(CameraOptions().withPitch((impl->transform.getPitch() * util::RAD2DEG) - pitch), animation);
}
-void Map::scaleBy(double scale, optional<ScreenCoordinate> anchor, const AnimationOptions& animation) {
+void Map::scaleBy(double scale, const optional<ScreenCoordinate>& anchor, const AnimationOptions& animation) {
const double zoom = impl->transform.getZoom() + impl->transform.getState().scaleZoom(scale);
easeTo(CameraOptions().withZoom(zoom).withAnchor(anchor), animation);
}
@@ -169,13 +169,20 @@ void Map::rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second
impl->onUpdate();
}
-CameraOptions Map::cameraForLatLngBounds(const LatLngBounds& bounds, const EdgeInsets& padding, optional<double> bearing, optional<double> pitch) const {
- return cameraForLatLngs({
- bounds.northwest(),
- bounds.southwest(),
- bounds.southeast(),
- bounds.northeast(),
- }, padding, bearing, pitch);
+CameraOptions Map::cameraForLatLngBounds(const LatLngBounds& bounds,
+ const EdgeInsets& padding,
+ const optional<double>& bearing,
+ const optional<double>& pitch) const {
+ return cameraForLatLngs(
+ {
+ bounds.northwest(),
+ bounds.southwest(),
+ bounds.southeast(),
+ bounds.northeast(),
+ },
+ padding,
+ bearing,
+ pitch);
}
CameraOptions cameraForLatLngs(const std::vector<LatLng>& latLngs, const Transform& transform, const EdgeInsets& padding) {
@@ -223,8 +230,10 @@ CameraOptions cameraForLatLngs(const std::vector<LatLng>& latLngs, const Transfo
.withZoom(zoom);
}
-CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const EdgeInsets& padding, optional<double> bearing, optional<double> pitch) const {
-
+CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs,
+ const EdgeInsets& padding,
+ const optional<double>& bearing,
+ const optional<double>& pitch) const {
if (!bearing && !pitch) {
return mbgl::cameraForLatLngs(latLngs, impl->transform, padding);
}
@@ -240,8 +249,10 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const Ed
.withPitch(transform.getPitch() * util::RAD2DEG);
}
-CameraOptions Map::cameraForGeometry(const Geometry<double>& geometry, const EdgeInsets& padding, optional<double> bearing, optional<double> pitch) const {
-
+CameraOptions Map::cameraForGeometry(const Geometry<double>& geometry,
+ const EdgeInsets& padding,
+ const optional<double>& bearing,
+ const optional<double>& pitch) const {
std::vector<LatLng> latLngs;
forEachPoint(geometry, [&](const Point<double>& pt) {
latLngs.emplace_back(pt.y, pt.x);
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index b40456ebdc..3e3584e5ba 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -11,8 +11,9 @@
#include <mbgl/util/logging.hpp>
#include <mbgl/util/platform.hpp>
-#include <cstdio>
#include <cmath>
+#include <cstdio>
+#include <utility>
namespace mbgl {
@@ -66,7 +67,7 @@ void Transform::resize(const Size size) {
#pragma mark - Camera
-CameraOptions Transform::getCameraOptions(optional<EdgeInsets> padding) const {
+CameraOptions Transform::getCameraOptions(const optional<EdgeInsets>& padding) const {
return state.getCameraOptions(padding);
}
@@ -491,7 +492,7 @@ ProjectionMode Transform::getProjectionMode() const {
void Transform::startTransition(const CameraOptions& camera,
const AnimationOptions& animation,
- std::function<void(double)> frame,
+ const std::function<void(double)>& frame,
const Duration& duration) {
if (transitionFinishFn) {
transitionFinishFn();
diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp
index 3f815fa3f1..38fb302b7b 100644
--- a/src/mbgl/map/transform.hpp
+++ b/src/mbgl/map/transform.hpp
@@ -29,7 +29,7 @@ public:
// Camera
/** Returns the current camera options. */
- CameraOptions getCameraOptions(optional<EdgeInsets>) const;
+ CameraOptions getCameraOptions(const optional<EdgeInsets>&) const;
/** Instantaneously, synchronously applies the given camera options. */
void jumpTo(const CameraOptions&);
@@ -117,7 +117,10 @@ private:
MapObserver& observer;
TransformState state;
- void startTransition(const CameraOptions&, const AnimationOptions&, std::function<void(double)>, const Duration&);
+ void startTransition(const CameraOptions&,
+ const AnimationOptions&,
+ const std::function<void(double)>&,
+ const Duration&);
// We don't want to show horizon: limit max pitch based on edge insets.
double getMaxPitchForEdgeInsets(const EdgeInsets &insets) const;
diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp
index da21487d67..8e297ae8cf 100644
--- a/src/mbgl/map/transform_state.cpp
+++ b/src/mbgl/map/transform_state.cpp
@@ -255,7 +255,7 @@ void TransformState::setViewportMode(ViewportMode val) {
#pragma mark - Camera options
-CameraOptions TransformState::getCameraOptions(optional<EdgeInsets> padding) const {
+CameraOptions TransformState::getCameraOptions(const optional<EdgeInsets>& padding) const {
return CameraOptions()
.withCenter(getLatLng())
.withPadding(padding ? padding : edgeInsets)
diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp
index 183400d417..b7fa97eea6 100644
--- a/src/mbgl/map/transform_state.hpp
+++ b/src/mbgl/map/transform_state.hpp
@@ -130,7 +130,7 @@ public:
ViewportMode getViewportMode() const;
void setViewportMode(ViewportMode val);
- CameraOptions getCameraOptions(optional<EdgeInsets>) const;
+ CameraOptions getCameraOptions(const optional<EdgeInsets>&) const;
// EdgeInsects
EdgeInsets getEdgeInsets() const { return edgeInsets; }
diff --git a/src/mbgl/platform/settings.cpp b/src/mbgl/platform/settings.cpp
index f586157919..10c8d109c6 100644
--- a/src/mbgl/platform/settings.cpp
+++ b/src/mbgl/platform/settings.cpp
@@ -33,7 +33,7 @@ void Settings::set(const std::string& key, mapbox::base::Value value) noexcept {
impl->settings[key] = std::move(value);
}
-void Settings::set(mapbox::base::ValueObject values) noexcept {
+void Settings::set(const mapbox::base::ValueObject& values) noexcept {
std::lock_guard<std::mutex> lock(impl->mutex);
for (const auto& pair : values) {
impl->settings[pair.first] = pair.second;
diff --git a/src/mbgl/renderer/buckets/fill_bucket.cpp b/src/mbgl/renderer/buckets/fill_bucket.cpp
index f42dc59579..4257d5ca6e 100644
--- a/src/mbgl/renderer/buckets/fill_bucket.cpp
+++ b/src/mbgl/renderer/buckets/fill_bucket.cpp
@@ -27,11 +27,10 @@ using namespace style;
struct GeometryTooLongException : std::exception {};
-FillBucket::FillBucket(const FillBucket::PossiblyEvaluatedLayoutProperties,
+FillBucket::FillBucket(const FillBucket::PossiblyEvaluatedLayoutProperties&,
const std::map<std::string, Immutable<style::LayerProperties>>& layerPaintProperties,
const float zoom,
const uint32_t) {
-
for (const auto& pair : layerPaintProperties) {
paintPropertyBinders.emplace(
std::piecewise_construct,
diff --git a/src/mbgl/renderer/buckets/fill_bucket.hpp b/src/mbgl/renderer/buckets/fill_bucket.hpp
index 4de97141a7..baa605a299 100644
--- a/src/mbgl/renderer/buckets/fill_bucket.hpp
+++ b/src/mbgl/renderer/buckets/fill_bucket.hpp
@@ -20,7 +20,7 @@ public:
~FillBucket() override;
using PossiblyEvaluatedLayoutProperties = style::FillLayoutProperties::PossiblyEvaluated;
- FillBucket(const PossiblyEvaluatedLayoutProperties layout,
+ FillBucket(const PossiblyEvaluatedLayoutProperties& layout,
const std::map<std::string, Immutable<style::LayerProperties>>& layerPaintProperties,
const float zoom,
const uint32_t overscaling);
diff --git a/src/mbgl/renderer/buckets/line_bucket.cpp b/src/mbgl/renderer/buckets/line_bucket.cpp
index 55593aaa66..809d8df6d3 100644
--- a/src/mbgl/renderer/buckets/line_bucket.cpp
+++ b/src/mbgl/renderer/buckets/line_bucket.cpp
@@ -10,7 +10,7 @@ namespace mbgl {
using namespace style;
-LineBucket::LineBucket(const LineBucket::PossiblyEvaluatedLayoutProperties layout_,
+LineBucket::LineBucket(const LineBucket::PossiblyEvaluatedLayoutProperties& layout_,
const std::map<std::string, Immutable<LayerProperties>>& layerPaintProperties,
const float zoom_,
const uint32_t overscaling_)
diff --git a/src/mbgl/renderer/buckets/line_bucket.hpp b/src/mbgl/renderer/buckets/line_bucket.hpp
index 111c16b348..5b6a65440e 100644
--- a/src/mbgl/renderer/buckets/line_bucket.hpp
+++ b/src/mbgl/renderer/buckets/line_bucket.hpp
@@ -19,7 +19,7 @@ class LineBucket final : public Bucket {
public:
using PossiblyEvaluatedLayoutProperties = style::LineLayoutProperties::PossiblyEvaluated;
- LineBucket(const PossiblyEvaluatedLayoutProperties layout,
+ LineBucket(const PossiblyEvaluatedLayoutProperties& layout,
const std::map<std::string, Immutable<style::LayerProperties>>& layerPaintProperties,
const float zoom,
const uint32_t overscaling);
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp
index de32d5ea49..234e81a9fd 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.cpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp
@@ -21,7 +21,7 @@ SymbolBucket::SymbolBucket(Immutable<style::SymbolLayoutProperties::PossiblyEval
float zoom,
bool iconsNeedLinear_,
bool sortFeaturesByY_,
- const std::string bucketName_,
+ const std::string& bucketName_,
const std::vector<SymbolInstance>&& symbolInstances_,
const std::vector<SortKeyRange>&& sortKeyRanges_,
float tilePixelRatio_,
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp
index 752f92e889..fa845a589a 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.hpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp
@@ -72,7 +72,7 @@ public:
float zoom,
bool iconsNeedLinear,
bool sortFeaturesByY,
- const std::string bucketLeaderID,
+ const std::string& bucketLeaderID,
const std::vector<SymbolInstance>&&,
const std::vector<SortKeyRange>&&,
const float tilePixelRatio,
diff --git a/src/mbgl/renderer/render_orchestrator.cpp b/src/mbgl/renderer/render_orchestrator.cpp
index 8acadd04b9..bf14813492 100644
--- a/src/mbgl/renderer/render_orchestrator.cpp
+++ b/src/mbgl/renderer/render_orchestrator.cpp
@@ -103,9 +103,9 @@ public:
} // namespace
-RenderOrchestrator::RenderOrchestrator(bool backgroundLayerAsColor_, optional<std::string> localFontFamily_)
+RenderOrchestrator::RenderOrchestrator(bool backgroundLayerAsColor_, const optional<std::string>& localFontFamily_)
: observer(&nullObserver()),
- glyphManager(std::make_unique<GlyphManager>(std::make_unique<LocalGlyphRasterizer>(std::move(localFontFamily_)))),
+ glyphManager(std::make_unique<GlyphManager>(std::make_unique<LocalGlyphRasterizer>(localFontFamily_))),
imageManager(std::make_unique<ImageManager>()),
lineAtlas(std::make_unique<LineAtlas>()),
patternAtlas(std::make_unique<PatternAtlas>()),
diff --git a/src/mbgl/renderer/render_orchestrator.hpp b/src/mbgl/renderer/render_orchestrator.hpp
index 7c1abfe1f4..a8a6d04901 100644
--- a/src/mbgl/renderer/render_orchestrator.hpp
+++ b/src/mbgl/renderer/render_orchestrator.hpp
@@ -41,9 +41,7 @@ class RenderOrchestrator final : public GlyphManagerObserver,
public ImageManagerObserver,
public RenderSourceObserver {
public:
- RenderOrchestrator(
- bool backgroundLayerAsColor_,
- optional<std::string> localFontFamily_);
+ RenderOrchestrator(bool backgroundLayerAsColor_, const optional<std::string>& localFontFamily_);
~RenderOrchestrator() override;
void markContextLost() {
diff --git a/src/mbgl/renderer/render_source.cpp b/src/mbgl/renderer/render_source.cpp
index 7b47602cd1..f39d3089d7 100644
--- a/src/mbgl/renderer/render_source.cpp
+++ b/src/mbgl/renderer/render_source.cpp
@@ -18,7 +18,7 @@ namespace mbgl {
using namespace style;
-std::unique_ptr<RenderSource> RenderSource::create(Immutable<Source::Impl> impl) {
+std::unique_ptr<RenderSource> RenderSource::create(const Immutable<Source::Impl>& impl) {
switch (impl->type) {
case SourceType::Vector:
return std::make_unique<RenderVectorSource>(staticImmutableCast<VectorSource::Impl>(impl));
diff --git a/src/mbgl/renderer/render_source.hpp b/src/mbgl/renderer/render_source.hpp
index ee90e1c4d0..5b6c9de1b7 100644
--- a/src/mbgl/renderer/render_source.hpp
+++ b/src/mbgl/renderer/render_source.hpp
@@ -47,7 +47,7 @@ using RenderTiles = std::shared_ptr<const std::vector<std::reference_wrapper<con
class RenderSource : protected TileObserver {
public:
- static std::unique_ptr<RenderSource> create(Immutable<style::Source::Impl>);
+ static std::unique_ptr<RenderSource> create(const Immutable<style::Source::Impl>&);
virtual ~RenderSource();
bool isEnabled() const;
diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp
index ac2f327a4e..0ec73671d1 100644
--- a/src/mbgl/renderer/renderer.cpp
+++ b/src/mbgl/renderer/renderer.cpp
@@ -8,7 +8,7 @@
namespace mbgl {
-Renderer::Renderer(gfx::RendererBackend& backend, float pixelRatio_, const optional<std::string> localFontFamily_)
+Renderer::Renderer(gfx::RendererBackend& backend, float pixelRatio_, const optional<std::string>& localFontFamily_)
: impl(std::make_unique<Impl>(backend, pixelRatio_, localFontFamily_)) {}
Renderer::~Renderer() {
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 113840d059..cdb85385ed 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -24,15 +24,11 @@ static RendererObserver& nullObserver() {
return observer;
}
-Renderer::Impl::Impl(gfx::RendererBackend& backend_,
- float pixelRatio_,
- optional<std::string> localFontFamily_)
- : orchestrator(!backend_.contextIsShared(), std::move(localFontFamily_))
- , backend(backend_)
- , observer(&nullObserver())
- , pixelRatio(pixelRatio_) {
-
-}
+Renderer::Impl::Impl(gfx::RendererBackend& backend_, float pixelRatio_, const optional<std::string>& localFontFamily_)
+ : orchestrator(!backend_.contextIsShared(), localFontFamily_),
+ backend(backend_),
+ observer(&nullObserver()),
+ pixelRatio(pixelRatio_) {}
Renderer::Impl::~Impl() {
assert(gfx::BackendScope::exists());
diff --git a/src/mbgl/renderer/renderer_impl.hpp b/src/mbgl/renderer/renderer_impl.hpp
index 5f04bfdfed..53c5b8d4dd 100644
--- a/src/mbgl/renderer/renderer_impl.hpp
+++ b/src/mbgl/renderer/renderer_impl.hpp
@@ -17,9 +17,7 @@ class RendererBackend;
class Renderer::Impl {
public:
- Impl(gfx::RendererBackend&,
- float pixelRatio_,
- optional<std::string> localFontFamily_);
+ Impl(gfx::RendererBackend&, float pixelRatio_, const optional<std::string>& localFontFamily_);
~Impl();
private:
diff --git a/src/mbgl/renderer/sources/render_geojson_source.cpp b/src/mbgl/renderer/sources/render_geojson_source.cpp
index 45a91e3fa0..490abe8a6b 100644
--- a/src/mbgl/renderer/sources/render_geojson_source.cpp
+++ b/src/mbgl/renderer/sources/render_geojson_source.cpp
@@ -25,12 +25,14 @@ using FeatureExtensionGetterPtr = FeatureExtensionValue (*)(std::shared_ptr<styl
std::uint32_t,
const optional<std::map<std::string, Value>>&);
+// NOLINTNEXTLINE(performance-unnecessary-value-param)
FeatureExtensionValue getChildren(std::shared_ptr<style::GeoJSONData> clusterData,
std::uint32_t clusterID,
const optional<std::map<std::string, Value>>&) {
return clusterData->getChildren(clusterID);
}
+// NOLINTNEXTLINE(performance-unnecessary-value-param)
FeatureExtensionValue getLeaves(std::shared_ptr<style::GeoJSONData> clusterData,
std::uint32_t clusterID,
const optional<std::map<std::string, Value>>& args) {
@@ -51,6 +53,7 @@ FeatureExtensionValue getLeaves(std::shared_ptr<style::GeoJSONData> clusterData,
return clusterData->getLeaves(clusterID);
}
+// NOLINTNEXTLINE(performance-unnecessary-value-param)
FeatureExtensionValue getClusterExpansionZoom(std::shared_ptr<style::GeoJSONData> clusterData,
std::uint32_t clusterID,
const optional<std::map<std::string, Value>>&) {
diff --git a/src/mbgl/sprite/sprite_parser.cpp b/src/mbgl/sprite/sprite_parser.cpp
index 155269cdbc..ac0b7f91f1 100644
--- a/src/mbgl/sprite/sprite_parser.cpp
+++ b/src/mbgl/sprite/sprite_parser.cpp
@@ -25,7 +25,7 @@ std::unique_ptr<style::Image> createStyleImage(const std::string& id,
const bool sdf,
style::ImageStretches&& stretchX,
style::ImageStretches&& stretchY,
- optional<style::ImageContent> content) {
+ const optional<style::ImageContent>& content) {
// Disallow invalid parameter configurations.
if (width <= 0 || height <= 0 || width > 1024 || height > 1024 || ratio <= 0 || ratio > 10 ||
srcX >= image.size.width || srcY >= image.size.height || srcX + width > image.size.width ||
@@ -49,7 +49,7 @@ std::unique_ptr<style::Image> createStyleImage(const std::string& id,
try {
return std::make_unique<style::Image>(
- id, std::move(dstImage), ratio, sdf, std::move(stretchX), std::move(stretchY), std::move(content));
+ id, std::move(dstImage), ratio, sdf, std::move(stretchX), std::move(stretchY), content);
} catch (const util::StyleImageException& ex) {
Log::Error(Event::Sprite, "Can't create image with invalid metadata: %s", ex.what());
return nullptr;
@@ -181,17 +181,8 @@ std::vector<Immutable<style::Image::Impl>> parseSprite(const std::string& encode
style::ImageStretches stretchY = getStretches(value, "stretchY", name.c_str());
optional<style::ImageContent> content = getContent(value, "content", name.c_str());
- auto image = createStyleImage(name,
- raster,
- x,
- y,
- width,
- height,
- pixelRatio,
- sdf,
- std::move(stretchX),
- std::move(stretchY),
- std::move(content));
+ auto image = createStyleImage(
+ name, raster, x, y, width, height, pixelRatio, sdf, std::move(stretchX), std::move(stretchY), content);
if (image) {
images.push_back(std::move(image->baseImpl));
}
diff --git a/src/mbgl/sprite/sprite_parser.hpp b/src/mbgl/sprite/sprite_parser.hpp
index f2e7358ac2..7d545a6d98 100644
--- a/src/mbgl/sprite/sprite_parser.hpp
+++ b/src/mbgl/sprite/sprite_parser.hpp
@@ -17,7 +17,7 @@ std::unique_ptr<style::Image> createStyleImage(const std::string& id,
bool sdf,
style::ImageStretches&& stretchX = {},
style::ImageStretches&& stretchY = {},
- optional<style::ImageContent> content = nullopt);
+ const optional<style::ImageContent>& content = nullopt);
// Parses an image and an associated JSON file and returns the sprite objects.
std::vector<Immutable<style::Image::Impl>> parseSprite(const std::string& image, const std::string& json);
diff --git a/src/mbgl/style/conversion/filter.cpp b/src/mbgl/style/conversion/filter.cpp
index 0a10d1e80a..d665a4b22e 100644
--- a/src/mbgl/style/conversion/filter.cpp
+++ b/src/mbgl/style/conversion/filter.cpp
@@ -1,11 +1,12 @@
#include <mbgl/style/conversion/filter.hpp>
#include <mbgl/style/conversion_impl.hpp>
-#include <mbgl/style/expression/literal.hpp>
+#include <mbgl/style/expression/boolean_operator.hpp>
+#include <mbgl/style/expression/compound_expression.hpp>
#include <mbgl/style/expression/expression.hpp>
+#include <mbgl/style/expression/literal.hpp>
#include <mbgl/style/expression/type.hpp>
-#include <mbgl/style/expression/compound_expression.hpp>
-#include <mbgl/style/expression/boolean_operator.hpp>
#include <mbgl/util/geometry.hpp>
+#include <utility>
namespace mbgl {
namespace style {
@@ -78,7 +79,9 @@ bool isExpression(const Convertible& filter) {
}
}
-ParseResult createExpression(std::string op, optional<std::vector<std::unique_ptr<Expression>>> args, Error& error) {
+ParseResult createExpression(const std::string& op,
+ optional<std::vector<std::unique_ptr<Expression>>> args,
+ Error& error) {
if (!args) return {};
assert(std::all_of(args->begin(), args->end(), [](const std::unique_ptr<Expression> &e) {
return bool(e.get());
@@ -100,7 +103,7 @@ ParseResult createExpression(std::string op, optional<std::vector<std::unique_pt
}
}
-ParseResult createExpression(std::string op, ParseResult arg, Error& error) {
+ParseResult createExpression(const std::string& op, ParseResult arg, Error& error) {
if (!arg) {
return {};
}
@@ -134,7 +137,9 @@ optional<std::vector<std::unique_ptr<Expression>>> convertLiteralArray(const Con
return {std::move(output)};
}
-ParseResult convertLegacyComparisonFilter(const Convertible& values, Error& error, optional<std::string> opOverride = {}) {
+ParseResult convertLegacyComparisonFilter(const Convertible& values,
+ Error& error,
+ const optional<std::string>& opOverride = {}) {
optional<std::string> op = opOverride ? opOverride : toString(arrayMember(values, 0));
optional<std::string> property = toString(arrayMember(values, 1));
diff --git a/src/mbgl/style/conversion/function.cpp b/src/mbgl/style/conversion/function.cpp
index e3beb44d22..6c2bcdf10f 100644
--- a/src/mbgl/style/conversion/function.cpp
+++ b/src/mbgl/style/conversion/function.cpp
@@ -12,6 +12,7 @@
#include <mbgl/util/string.hpp>
#include <cassert>
+#include <utility>
namespace mbgl {
namespace style {
@@ -320,7 +321,7 @@ static optional<std::unique_ptr<Expression>> convertLiteral(type::Type type, con
});
}
-static optional<std::map<double, std::unique_ptr<Expression>>> convertStops(type::Type type,
+static optional<std::map<double, std::unique_ptr<Expression>>> convertStops(const type::Type& type,
const Convertible& value,
Error& error,
bool convertTokens) {
@@ -382,7 +383,7 @@ static void omitFirstStop(std::map<double, std::unique_ptr<Expression>>& stops)
}
template <class T>
-optional<std::map<T, std::unique_ptr<Expression>>> convertBranches(type::Type type,
+optional<std::map<T, std::unique_ptr<Expression>>> convertBranches(const type::Type& type,
const Convertible& value,
Error& error) {
auto stopsValue = objectMember(value, "stops");
@@ -447,13 +448,15 @@ static optional<double> convertBase(const Convertible& value, Error& error) {
return *base;
}
-static std::unique_ptr<Expression> step(type::Type type, std::unique_ptr<Expression> input, std::map<double, std::unique_ptr<Expression>> stops) {
+static std::unique_ptr<Expression> step(const type::Type& type,
+ std::unique_ptr<Expression> input,
+ std::map<double, std::unique_ptr<Expression>> stops) {
return std::make_unique<Step>(type, std::move(input), std::move(stops));
}
static std::unique_ptr<Expression> interpolate(type::Type type, Interpolator interpolator, std::unique_ptr<Expression> input, std::map<double, std::unique_ptr<Expression>> stops) {
ParsingContext ctx;
- auto result = createInterpolate(type, std::move(interpolator), std::move(input), std::move(stops), ctx);
+ auto result = createInterpolate(std::move(type), std::move(interpolator), std::move(input), std::move(stops), ctx);
if (!result) {
assert(false);
return {};
@@ -462,7 +465,7 @@ static std::unique_ptr<Expression> interpolate(type::Type type, Interpolator int
}
template <class T>
-std::unique_ptr<Expression> categorical(type::Type type,
+std::unique_ptr<Expression> categorical(const type::Type& type,
const std::string& property,
std::map<T, std::unique_ptr<Expression>> branches,
std::unique_ptr<Expression> def) {
@@ -477,7 +480,7 @@ std::unique_ptr<Expression> categorical(type::Type type,
}
template <>
-std::unique_ptr<Expression> categorical<bool>(type::Type type,
+std::unique_ptr<Expression> categorical<bool>(const type::Type& type,
const std::string& property,
std::map<bool, std::unique_ptr<Expression>> branches,
std::unique_ptr<Expression> def) {
@@ -499,7 +502,7 @@ std::unique_ptr<Expression> categorical<bool>(type::Type type,
def ? std::move(def) : error("replaced with default"));
}
-static std::unique_ptr<Expression> numberOrDefault(type::Type type,
+static std::unique_ptr<Expression> numberOrDefault(const type::Type& type,
std::unique_ptr<Expression> get,
std::unique_ptr<Expression> expr,
std::unique_ptr<Expression> def) {
@@ -513,12 +516,13 @@ static std::unique_ptr<Expression> numberOrDefault(type::Type type,
return std::make_unique<Case>(type, std::move(branches), std::move(def));
}
-static optional<std::unique_ptr<Expression>> convertIntervalFunction(type::Type type,
- const Convertible& value,
- Error& error,
- std::function<std::unique_ptr<Expression> (bool)> makeInput,
- std::unique_ptr<Expression> def,
- bool convertTokens = false) {
+static optional<std::unique_ptr<Expression>> convertIntervalFunction(
+ const type::Type& type,
+ const Convertible& value,
+ Error& error,
+ const std::function<std::unique_ptr<Expression>(bool)>& makeInput,
+ std::unique_ptr<Expression> def,
+ bool convertTokens = false) {
auto stops = convertStops(type, value, error, convertTokens);
if (!stops) {
return nullopt;
@@ -531,12 +535,13 @@ static optional<std::unique_ptr<Expression>> convertIntervalFunction(type::Type
std::move(def));
}
-static optional<std::unique_ptr<Expression>> convertExponentialFunction(type::Type type,
- const Convertible& value,
- Error& error,
- std::function<std::unique_ptr<Expression> (bool)> makeInput,
- std::unique_ptr<Expression> def,
- bool convertTokens = false) {
+static optional<std::unique_ptr<Expression>> convertExponentialFunction(
+ const type::Type& type,
+ const Convertible& value,
+ Error& error,
+ const std::function<std::unique_ptr<Expression>(bool)>& makeInput,
+ std::unique_ptr<Expression> def,
+ bool convertTokens = false) {
auto stops = convertStops(type, value, error, convertTokens);
if (!stops) {
return nullopt;
@@ -552,7 +557,7 @@ static optional<std::unique_ptr<Expression>> convertExponentialFunction(type::Ty
std::move(def));
}
-static optional<std::unique_ptr<Expression>> convertCategoricalFunction(type::Type type,
+static optional<std::unique_ptr<Expression>> convertCategoricalFunction(const type::Type& type,
const Convertible& value,
Error& err,
const std::string& property,
@@ -849,9 +854,13 @@ optional<std::unique_ptr<Expression>> convertFunctionToExpression(type::Type typ
if (toBool(*sourceValue)) {
switch (functionType) {
case FunctionType::Categorical:
- return composite<bool>(type, value, err, [&] (type::Type type_, double, std::map<bool, std::unique_ptr<Expression>> stops) {
- return categorical<bool>(type_, *property, std::move(stops), defaultExpr());
- });
+ return composite<bool>(
+ type,
+ value,
+ err,
+ [&](const type::Type& type_, double, std::map<bool, std::unique_ptr<Expression>> stops) {
+ return categorical<bool>(type_, *property, std::move(stops), defaultExpr());
+ });
default:
err.message = "unsupported function type";
return nullopt;
@@ -861,24 +870,35 @@ optional<std::unique_ptr<Expression>> convertFunctionToExpression(type::Type typ
if (toNumber(*sourceValue)) {
switch (functionType) {
case FunctionType::Interval:
- return composite<double>(type, value, err, [&] (type::Type type_, double, std::map<double, std::unique_ptr<Expression>> stops) {
- omitFirstStop(stops);
- return numberOrDefault(type,
- getProperty(false),
- step(type_, getProperty(true), std::move(stops)),
- defaultExpr());
- });
+ return composite<double>(
+ type,
+ value,
+ err,
+ [&](const type::Type& type_, double, std::map<double, std::unique_ptr<Expression>> stops) {
+ omitFirstStop(stops);
+ return numberOrDefault(
+ type, getProperty(false), step(type_, getProperty(true), std::move(stops)), defaultExpr());
+ });
case FunctionType::Exponential:
- return composite<double>(type, value, err, [&] (type::Type type_, double base, std::map<double, std::unique_ptr<Expression>> stops) {
- return numberOrDefault(type,
- getProperty(false),
- interpolate(type_, exponential(base), getProperty(true), std::move(stops)),
- defaultExpr());
- });
+ return composite<double>(
+ type,
+ value,
+ err,
+ [&](type::Type type_, double base, std::map<double, std::unique_ptr<Expression>> stops) {
+ return numberOrDefault(
+ type,
+ getProperty(false),
+ interpolate(std::move(type_), exponential(base), getProperty(true), std::move(stops)),
+ defaultExpr());
+ });
case FunctionType::Categorical:
- return composite<int64_t>(type, value, err, [&] (type::Type type_, double, std::map<int64_t, std::unique_ptr<Expression>> stops) {
- return categorical<int64_t>(type_, *property, std::move(stops), defaultExpr());
- });
+ return composite<int64_t>(
+ type,
+ value,
+ err,
+ [&](const type::Type& type_, double, std::map<int64_t, std::unique_ptr<Expression>> stops) {
+ return categorical<int64_t>(type_, *property, std::move(stops), defaultExpr());
+ });
default:
err.message = "unsupported function type";
return nullopt;
@@ -888,9 +908,13 @@ optional<std::unique_ptr<Expression>> convertFunctionToExpression(type::Type typ
if (toString(*sourceValue)) {
switch (functionType) {
case FunctionType::Categorical:
- return composite<std::string>(type, value, err, [&] (type::Type type_, double, std::map<std::string, std::unique_ptr<Expression>> stops) {
- return categorical<std::string>(type_, *property, std::move(stops), defaultExpr());
- });
+ return composite<std::string>(
+ type,
+ value,
+ err,
+ [&](const type::Type& type_, double, std::map<std::string, std::unique_ptr<Expression>> stops) {
+ return categorical<std::string>(type_, *property, std::move(stops), defaultExpr());
+ });
default:
err.message = "unsupported function type";
return nullopt;
diff --git a/src/mbgl/style/custom_tile_loader.cpp b/src/mbgl/style/custom_tile_loader.cpp
index a266e60cfc..d0b4dd58bc 100644
--- a/src/mbgl/style/custom_tile_loader.cpp
+++ b/src/mbgl/style/custom_tile_loader.cpp
@@ -10,7 +10,7 @@ CustomTileLoader::CustomTileLoader(const TileFunction& fetchTileFn, const TileFu
cancelTileFunction = cancelTileFn;
}
-void CustomTileLoader::fetchTile(const OverscaledTileID& tileID, ActorRef<CustomGeometryTile> tileRef) {
+void CustomTileLoader::fetchTile(const OverscaledTileID& tileID, const ActorRef<CustomGeometryTile>& tileRef) {
std::lock_guard<std::mutex> guard(dataMutex);
auto cachedTileData = dataCache.find(tileID.canonical);
if (cachedTileData != dataCache.end()) {
diff --git a/src/mbgl/style/custom_tile_loader.hpp b/src/mbgl/style/custom_tile_loader.hpp
index 7d2d5cffe6..b27a8a1521 100644
--- a/src/mbgl/style/custom_tile_loader.hpp
+++ b/src/mbgl/style/custom_tile_loader.hpp
@@ -21,7 +21,7 @@ public:
CustomTileLoader(const TileFunction& fetchTileFn, const TileFunction& cancelTileFn);
- void fetchTile(const OverscaledTileID& tileID, ActorRef<CustomGeometryTile> tileRef);
+ void fetchTile(const OverscaledTileID& tileID, const ActorRef<CustomGeometryTile>& tileRef);
void cancelTile(const OverscaledTileID& tileID);
void removeTile(const OverscaledTileID& tileID);
diff --git a/src/mbgl/style/expression/assertion.cpp b/src/mbgl/style/expression/assertion.cpp
index 17f8925511..0b69943779 100644
--- a/src/mbgl/style/expression/assertion.cpp
+++ b/src/mbgl/style/expression/assertion.cpp
@@ -1,6 +1,7 @@
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/expression/assertion.hpp>
#include <mbgl/style/expression/check_subtype.hpp>
-#include <mbgl/style/conversion_impl.hpp>
+#include <utility>
namespace mbgl {
namespace style {
@@ -8,10 +9,8 @@ namespace expression {
using namespace mbgl::style::conversion;
-Assertion::Assertion(type::Type type_, std::vector<std::unique_ptr<Expression>> inputs_) :
- Expression(Kind::Assertion, type_),
- inputs(std::move(inputs_))
-{
+Assertion::Assertion(type::Type type_, std::vector<std::unique_ptr<Expression>> inputs_)
+ : Expression(Kind::Assertion, std::move(type_)), inputs(std::move(inputs_)) {
assert(!inputs.empty());
}
diff --git a/src/mbgl/style/expression/collator.cpp b/src/mbgl/style/expression/collator.cpp
index 185d713150..a5dbc614af 100644
--- a/src/mbgl/style/expression/collator.cpp
+++ b/src/mbgl/style/expression/collator.cpp
@@ -4,8 +4,8 @@ namespace mbgl {
namespace style {
namespace expression {
-Collator::Collator(bool caseSensitive, bool diacriticSensitive, optional<std::string> locale)
- : collator(platform::Collator(caseSensitive, diacriticSensitive, std::move(locale))) {}
+Collator::Collator(bool caseSensitive, bool diacriticSensitive, const optional<std::string>& locale)
+ : collator(platform::Collator(caseSensitive, diacriticSensitive, locale)) {}
bool Collator::operator==(const Collator& other) const {
return collator == other.collator;
diff --git a/src/mbgl/style/expression/comparison.cpp b/src/mbgl/style/expression/comparison.cpp
index aa5808a975..ca29ace0dd 100644
--- a/src/mbgl/style/expression/comparison.cpp
+++ b/src/mbgl/style/expression/comparison.cpp
@@ -22,30 +22,34 @@ static bool isComparableType(const std::string& op, const type::Type& type) {
}
}
-bool eq(Value a, Value b) { return a == b; }
-bool neq(Value a, Value b) { return a != b; }
-bool lt(Value lhs, Value rhs) {
+bool eq(const Value& a, const Value& b) {
+ return a == b;
+}
+bool neq(const Value& a, const Value& b) {
+ return a != b;
+}
+bool lt(const Value& lhs, const Value& rhs) {
return lhs.match(
[&](const std::string& a) { return a < rhs.get<std::string>(); },
[&](double a) { return a < rhs.get<double>(); },
[&](const auto&) { assert(false); return false; }
);
}
-bool gt(Value lhs, Value rhs) {
+bool gt(const Value& lhs, const Value& rhs) {
return lhs.match(
[&](const std::string& a) { return a > rhs.get<std::string>(); },
[&](double a) { return a > rhs.get<double>(); },
[&](const auto&) { assert(false); return false; }
);
}
-bool lteq(Value lhs, Value rhs) {
+bool lteq(const Value& lhs, const Value& rhs) {
return lhs.match(
[&](const std::string& a) { return a <= rhs.get<std::string>(); },
[&](double a) { return a <= rhs.get<double>(); },
[&](const auto&) { assert(false); return false; }
);
}
-bool gteq(Value lhs, Value rhs) {
+bool gteq(const Value& lhs, const Value& rhs) {
return lhs.match(
[&](const std::string& a) { return a >= rhs.get<std::string>(); },
[&](double a) { return a >= rhs.get<double>(); },
@@ -53,12 +57,24 @@ bool gteq(Value lhs, Value rhs) {
);
}
-bool eqCollate(std::string a, std::string b, Collator c) { return c.compare(a, b) == 0; }
-bool neqCollate(std::string a, std::string b, Collator c) { return !eqCollate(a, b, c); }
-bool ltCollate(std::string a, std::string b, Collator c) { return c.compare(a, b) < 0; }
-bool gtCollate(std::string a, std::string b, Collator c) { return c.compare(a, b) > 0; }
-bool lteqCollate(std::string a, std::string b, Collator c) { return c.compare(a, b) <= 0; }
-bool gteqCollate(std::string a, std::string b, Collator c) { return c.compare(a, b) >= 0; }
+bool eqCollate(const std::string& a, const std::string& b, const Collator& c) {
+ return c.compare(a, b) == 0;
+}
+bool neqCollate(const std::string& a, const std::string& b, const Collator& c) {
+ return !eqCollate(a, b, c);
+}
+bool ltCollate(const std::string& a, const std::string& b, const Collator& c) {
+ return c.compare(a, b) < 0;
+}
+bool gtCollate(const std::string& a, const std::string& b, const Collator& c) {
+ return c.compare(a, b) > 0;
+}
+bool lteqCollate(const std::string& a, const std::string& b, const Collator& c) {
+ return c.compare(a, b) <= 0;
+}
+bool gteqCollate(const std::string& a, const std::string& b, const Collator& c) {
+ return c.compare(a, b) >= 0;
+}
static BasicComparison::CompareFunctionType getBasicCompareFunction(const std::string& op) {
if (op == "==") return eq;
diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp
index f735f57162..30abe37d2e 100644
--- a/src/mbgl/style/expression/compound_expression.cpp
+++ b/src/mbgl/style/expression/compound_expression.cpp
@@ -84,13 +84,11 @@ struct Signature;
// Simple evaluate function (const T0&, const T1&, ...) -> Result<U>
template <class R, class... Params>
struct Signature<R (Params...)> : SignatureBase {
- Signature(R (*evaluate_)(Params...), std::string name_) :
- SignatureBase(
- valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
- std::vector<type::Type> {valueTypeToExpressionType<std::decay_t<Params>>()...},
- std::move(name_)
- ),
- evaluate(evaluate_) {}
+ Signature(R (*evaluate_)(Params...), const std::string& name_)
+ : SignatureBase(valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
+ std::vector<type::Type>{valueTypeToExpressionType<std::decay_t<Params>>()...},
+ name_),
+ evaluate(evaluate_) {}
EvaluationResult apply(const EvaluationContext& evaluationParameters, const Args& args) const override {
return applyImpl(evaluationParameters, args, std::index_sequence_for<Params...>{});
@@ -116,14 +114,11 @@ private:
// Varargs evaluate function (const Varargs<T>&) -> Result<U>
template <class R, typename T>
struct Signature<R (const Varargs<T>&)> : SignatureBase {
- Signature(R (*evaluate_)(const Varargs<T>&), std::string name_) :
- SignatureBase(
- valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
- VarargsType { valueTypeToExpressionType<T>() },
- std::move(name_)
- ),
- evaluate(evaluate_)
- {}
+ Signature(R (*evaluate_)(const Varargs<T>&), const std::string& name_)
+ : SignatureBase(valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
+ VarargsType{valueTypeToExpressionType<T>()},
+ name_),
+ evaluate(evaluate_) {}
EvaluationResult apply(const EvaluationContext& evaluationParameters, const Args& args) const override {
Varargs<T> evaluated;
@@ -145,14 +140,11 @@ struct Signature<R (const Varargs<T>&)> : SignatureBase {
// (const EvaluationParams&, const T0&, const T1&, ...) -> Result<U>
template <class R, class... Params>
struct Signature<R (const EvaluationContext&, Params...)> : SignatureBase {
- Signature(R (*evaluate_)(const EvaluationContext&, Params...), std::string name_) :
- SignatureBase(
- valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
- std::vector<type::Type> {valueTypeToExpressionType<std::decay_t<Params>>()...},
- std::move(name_)
- ),
- evaluate(evaluate_)
- {}
+ Signature(R (*evaluate_)(const EvaluationContext&, Params...), const std::string& name_)
+ : SignatureBase(valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
+ std::vector<type::Type>{valueTypeToExpressionType<std::decay_t<Params>>()...},
+ name_),
+ evaluate(evaluate_) {}
EvaluationResult apply(const EvaluationContext& evaluationParameters, const Args& args) const override {
return applyImpl(evaluationParameters, args, std::index_sequence_for<Params...>{});
@@ -179,14 +171,11 @@ private:
// (const EvaluationContext&, const Varargs<T>&) -> Result<U>
template <class R, typename T>
struct Signature<R (const EvaluationContext&, const Varargs<T>&)> : SignatureBase {
- Signature(R (*evaluate_)(const EvaluationContext&, const Varargs<T>&), std::string name_) :
- SignatureBase(
- valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
- VarargsType { valueTypeToExpressionType<T>() },
- std::move(name_)
- ),
- evaluate(evaluate_)
- {}
+ Signature(R (*evaluate_)(const EvaluationContext&, const Varargs<T>&), const std::string& name_)
+ : SignatureBase(valueTypeToExpressionType<std::decay_t<typename R::Value>>(),
+ VarargsType{valueTypeToExpressionType<T>()},
+ name_),
+ evaluate(evaluate_) {}
EvaluationResult apply(const EvaluationContext& evaluationParameters, const Args& args) const override {
Varargs<T> evaluated;
@@ -223,7 +212,7 @@ static std::unique_ptr<detail::SignatureBase> makeSignature(std::string name, Fn
} // namespace detail
-Value featureIdAsExpressionValue(EvaluationContext params) {
+Value featureIdAsExpressionValue(const EvaluationContext& params) {
assert(params.feature);
auto id = params.feature->getID();
if (id.is<NullValue>()) return Null;
@@ -232,7 +221,7 @@ Value featureIdAsExpressionValue(EvaluationContext params) {
});
};
-optional<Value> featurePropertyAsExpressionValue(EvaluationContext params, const std::string& key) {
+optional<Value> featurePropertyAsExpressionValue(const EvaluationContext& params, const std::string& key) {
assert(params.feature);
auto property = params.feature->getValue(key);
return property ? toExpressionValue(*property) : optional<Value>();
@@ -253,7 +242,7 @@ optional<std::string> featureTypeAsString(FeatureType type) {
}
};
-optional<double> featurePropertyAsDouble(EvaluationContext params, const std::string& key) {
+optional<double> featurePropertyAsDouble(const EvaluationContext& params, const std::string& key) {
assert(params.feature);
auto property = params.feature->getValue(key);
if (!property) return {};
@@ -265,7 +254,7 @@ optional<double> featurePropertyAsDouble(EvaluationContext params, const std::st
);
};
-optional<std::string> featurePropertyAsString(EvaluationContext params, const std::string& key) {
+optional<std::string> featurePropertyAsString(const EvaluationContext& params, const std::string& key) {
assert(params.feature);
auto property = params.feature->getValue(key);
if (!property) return {};
@@ -275,7 +264,7 @@ optional<std::string> featurePropertyAsString(EvaluationContext params, const st
);
};
-optional<double> featureIdAsDouble(EvaluationContext params) {
+optional<double> featureIdAsDouble(const EvaluationContext& params) {
assert(params.feature);
auto id = params.feature->getID();
return id.match(
@@ -286,7 +275,7 @@ optional<double> featureIdAsDouble(EvaluationContext params) {
);
};
-optional<std::string> featureIdAsString(EvaluationContext params) {
+optional<std::string> featureIdAsString(const EvaluationContext& params) {
assert(params.feature);
auto id = params.feature->getID();
return id.match(
@@ -723,10 +712,12 @@ const auto& filterLessThanNumberCompoundExpression() {
}
const auto& filterLessThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter-<", [](const EvaluationContext& params, const std::string& key, std::string lhs) -> Result<bool> {
- auto rhs = featurePropertyAsString(params, key);
- return rhs ? rhs < lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter-<",
+ [](const EvaluationContext& params, const std::string& key, const std::string& lhs) -> Result<bool> {
+ auto rhs = featurePropertyAsString(params, key);
+ return rhs ? rhs < lhs : false;
+ });
return signature;
}
@@ -739,10 +730,11 @@ const auto& filterIdLessThanNumberCompoundExpression() {
}
const auto& filterIdLessThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter-id-<", [](const EvaluationContext& params, std::string lhs) -> Result<bool> {
- auto rhs = featureIdAsString(params);
- return rhs ? rhs < lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter-id-<", [](const EvaluationContext& params, const std::string& lhs) -> Result<bool> {
+ auto rhs = featureIdAsString(params);
+ return rhs ? rhs < lhs : false;
+ });
return signature;
}
@@ -755,10 +747,12 @@ const auto& filterMoreThanNumberCompoundExpression() {
}
const auto& filterMoreThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter->", [](const EvaluationContext& params, const std::string& key, std::string lhs) -> Result<bool> {
- auto rhs = featurePropertyAsString(params, key);
- return rhs ? rhs > lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter->",
+ [](const EvaluationContext& params, const std::string& key, const std::string& lhs) -> Result<bool> {
+ auto rhs = featurePropertyAsString(params, key);
+ return rhs ? rhs > lhs : false;
+ });
return signature;
}
@@ -771,10 +765,11 @@ const auto& filterIdMoreThanNumberCompoundExpression() {
}
const auto& filterIdMoreThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter-id->", [](const EvaluationContext& params, std::string lhs) -> Result<bool> {
- auto rhs = featureIdAsString(params);
- return rhs ? rhs > lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter-id->", [](const EvaluationContext& params, const std::string& lhs) -> Result<bool> {
+ auto rhs = featureIdAsString(params);
+ return rhs ? rhs > lhs : false;
+ });
return signature;
}
@@ -787,10 +782,12 @@ const auto& filterLessOrEqualThanNumberCompoundExpression() {
}
const auto& filterLessOrEqualThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter-<=", [](const EvaluationContext& params, const std::string& key, std::string lhs) -> Result<bool> {
- auto rhs = featurePropertyAsString(params, key);
- return rhs ? rhs <= lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter-<=",
+ [](const EvaluationContext& params, const std::string& key, const std::string& lhs) -> Result<bool> {
+ auto rhs = featurePropertyAsString(params, key);
+ return rhs ? rhs <= lhs : false;
+ });
return signature;
}
@@ -803,10 +800,11 @@ const auto& filterIdLessOrEqualThanNumberCompoundExpression() {
}
const auto& filterIdLessOrEqualThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter-id-<=", [](const EvaluationContext& params, std::string lhs) -> Result<bool> {
- auto rhs = featureIdAsString(params);
- return rhs ? rhs <= lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter-id-<=", [](const EvaluationContext& params, const std::string& lhs) -> Result<bool> {
+ auto rhs = featureIdAsString(params);
+ return rhs ? rhs <= lhs : false;
+ });
return signature;
}
@@ -819,10 +817,12 @@ const auto& filterGreaterOrEqualThanNumberCompoundExpression() {
}
const auto& filterGreaterOrEqualThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter->=", [](const EvaluationContext& params, const std::string& key, std::string lhs) -> Result<bool> {
- auto rhs = featurePropertyAsString(params, key);
- return rhs ? rhs >= lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter->=",
+ [](const EvaluationContext& params, const std::string& key, const std::string& lhs) -> Result<bool> {
+ auto rhs = featurePropertyAsString(params, key);
+ return rhs ? rhs >= lhs : false;
+ });
return signature;
}
@@ -835,10 +835,11 @@ const auto& filterIdGreaterOrEqualThanNumberCompoundExpression() {
}
const auto& filterIdGreaterOrEqualThanStringCompoundExpression() {
- static auto signature = detail::makeSignature("filter-id->=", [](const EvaluationContext& params, std::string lhs) -> Result<bool> {
- auto rhs = featureIdAsString(params);
- return rhs ? rhs >= lhs : false;
- });
+ static auto signature = detail::makeSignature(
+ "filter-id->=", [](const EvaluationContext& params, const std::string& lhs) -> Result<bool> {
+ auto rhs = featureIdAsString(params);
+ return rhs ? rhs >= lhs : false;
+ });
return signature;
}
@@ -1065,7 +1066,7 @@ static ParseResult createCompoundExpression(const Definitions& definitions,
return ParseResult();
}
-ParseResult parseCompoundExpression(const std::string name, const Convertible& value, ParsingContext& ctx) {
+ParseResult parseCompoundExpression(const std::string& name, const Convertible& value, ParsingContext& ctx) {
assert(isArray(value) && arrayLength(value) > 0);
const auto definitions = compoundExpressionRegistry.equal_range(name.c_str());
diff --git a/src/mbgl/style/expression/dsl.cpp b/src/mbgl/style/expression/dsl.cpp
index c8d98e61a4..d8c105633f 100644
--- a/src/mbgl/style/expression/dsl.cpp
+++ b/src/mbgl/style/expression/dsl.cpp
@@ -11,9 +11,10 @@
#include <mbgl/style/expression/literal.hpp>
#include <mbgl/style/expression/step.hpp>
+#include <rapidjson/document.h>
#include <mapbox/geojsonvt.hpp>
#include <mbgl/style/conversion/json.hpp>
-#include <rapidjson/document.h>
+#include <utility>
namespace mbgl {
namespace style {
@@ -54,7 +55,7 @@ std::unique_ptr<Expression> literal(const char* value) {
return literal(std::string(value));
}
-std::unique_ptr<Expression> literal(Value value) {
+std::unique_ptr<Expression> literal(const Value& value) {
return std::make_unique<Literal>(value);
}
@@ -74,7 +75,7 @@ std::unique_ptr<Expression> literal(std::initializer_list<const char *> value) {
return literal(values);
}
-std::unique_ptr<Expression> assertion(type::Type type,
+std::unique_ptr<Expression> assertion(const type::Type& type,
std::unique_ptr<Expression> value,
std::unique_ptr<Expression> def) {
std::vector<std::unique_ptr<Expression>> v = vec(std::move(value));
@@ -99,7 +100,7 @@ std::unique_ptr<Expression> boolean(std::unique_ptr<Expression> value,
return assertion(type::Boolean, std::move(value), std::move(def));
}
-std::unique_ptr<Expression> coercion(type::Type type,
+std::unique_ptr<Expression> coercion(const type::Type& type,
std::unique_ptr<Expression> value,
std::unique_ptr<Expression> def) {
std::vector<std::unique_ptr<Expression>> v = vec(std::move(value));
@@ -193,7 +194,7 @@ std::unique_ptr<Expression> interpolate(Interpolator interpolator,
std::map<double, std::unique_ptr<Expression>> stops;
stops[input1] = std::move(output1);
ParsingContext ctx;
- ParseResult result = createInterpolate(type, interpolator, std::move(input), std::move(stops), ctx);
+ ParseResult result = createInterpolate(type, std::move(interpolator), std::move(input), std::move(stops), ctx);
assert(result);
return std::move(*result);
}
@@ -207,7 +208,7 @@ std::unique_ptr<Expression> interpolate(Interpolator interpolator,
stops[input1] = std::move(output1);
stops[input2] = std::move(output2);
ParsingContext ctx;
- ParseResult result = createInterpolate(type, interpolator, std::move(input), std::move(stops), ctx);
+ ParseResult result = createInterpolate(type, std::move(interpolator), std::move(input), std::move(stops), ctx);
assert(result);
return std::move(*result);
}
@@ -223,7 +224,7 @@ std::unique_ptr<Expression> interpolate(Interpolator interpolator,
stops[input2] = std::move(output2);
stops[input3] = std::move(output3);
ParsingContext ctx;
- ParseResult result = createInterpolate(type, interpolator, std::move(input), std::move(stops), ctx);
+ ParseResult result = createInterpolate(type, std::move(interpolator), std::move(input), std::move(stops), ctx);
assert(result);
return std::move(*result);
}
diff --git a/src/mbgl/style/expression/expression.cpp b/src/mbgl/style/expression/expression.cpp
index 66e2e30b14..4f5e3848d5 100644
--- a/src/mbgl/style/expression/expression.cpp
+++ b/src/mbgl/style/expression/expression.cpp
@@ -1,6 +1,7 @@
-#include <mbgl/style/expression/expression.hpp>
#include <mbgl/style/expression/compound_expression.hpp>
+#include <mbgl/style/expression/expression.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
+#include <utility>
namespace mbgl {
namespace style {
@@ -43,7 +44,7 @@ EvaluationResult Expression::evaluate(optional<float> zoom,
const Feature& feature,
optional<double> colorRampParameter) const {
GeoJSONFeature f(feature);
- return this->evaluate(EvaluationContext(zoom, &f, colorRampParameter));
+ return this->evaluate(EvaluationContext(std::move(zoom), &f, std::move(colorRampParameter)));
}
EvaluationResult Expression::evaluate(optional<float> zoom,
@@ -51,7 +52,8 @@ EvaluationResult Expression::evaluate(optional<float> zoom,
optional<double> colorRampParameter,
const std::set<std::string>& availableImages) const {
GeoJSONFeature f(feature);
- return this->evaluate(EvaluationContext(zoom, &f, colorRampParameter).withAvailableImages(&availableImages));
+ return this->evaluate(
+ EvaluationContext(std::move(zoom), &f, std::move(colorRampParameter)).withAvailableImages(&availableImages));
}
EvaluationResult Expression::evaluate(optional<float> zoom,
@@ -60,14 +62,14 @@ EvaluationResult Expression::evaluate(optional<float> zoom,
const std::set<std::string>& availableImages,
const CanonicalTileID& canonical) const {
GeoJSONFeature f(feature, canonical);
- return this->evaluate(EvaluationContext(zoom, &f, colorRampParameter)
+ return this->evaluate(EvaluationContext(std::move(zoom), &f, std::move(colorRampParameter))
.withAvailableImages(&availableImages)
.withCanonicalTileID(&canonical));
}
EvaluationResult Expression::evaluate(optional<mbgl::Value> accumulated, const Feature& feature) const {
GeoJSONFeature f(feature);
- return this->evaluate(EvaluationContext(accumulated, &f));
+ return this->evaluate(EvaluationContext(std::move(accumulated), &f));
}
} // namespace expression
diff --git a/src/mbgl/style/expression/in.cpp b/src/mbgl/style/expression/in.cpp
index fa2bd83656..f77a0b7f91 100644
--- a/src/mbgl/style/expression/in.cpp
+++ b/src/mbgl/style/expression/in.cpp
@@ -9,20 +9,20 @@ namespace style {
namespace expression {
namespace {
-bool isComparableType(type::Type type) {
+bool isComparableType(const type::Type& type) {
return type == type::Boolean || type == type::String || type == type::Number || type == type::Null ||
type == type::Value;
}
-bool isComparableRuntimeType(type::Type type) {
+bool isComparableRuntimeType(const type::Type& type) {
return type == type::Boolean || type == type::String || type == type::Number || type == type::Null;
}
-bool isSearchableType(type::Type type) {
+bool isSearchableType(const type::Type& type) {
return type == type::String || type.is<type::Array>() || type == type::Null || type == type::Value;
}
-bool isSearchableRuntimeType(type::Type type) {
+bool isSearchableRuntimeType(const type::Type& type) {
return type == type::String || type.is<type::Array>() || type == type::Null;
}
} // namespace
diff --git a/src/mbgl/style/expression/interpolate.cpp b/src/mbgl/style/expression/interpolate.cpp
index 8725e9e86d..3a7c76819d 100644
--- a/src/mbgl/style/expression/interpolate.cpp
+++ b/src/mbgl/style/expression/interpolate.cpp
@@ -11,12 +11,12 @@ using namespace mbgl::style::conversion;
template <typename T>
class InterpolateImpl : public Interpolate {
public:
- InterpolateImpl(type::Type type_,
- Interpolator interpolator_,
- std::unique_ptr<Expression> input_,
- std::map<double, std::unique_ptr<Expression>> stops_
- ) : Interpolate(std::move(type_), std::move(interpolator_), std::move(input_), std::move(stops_))
- {
+ InterpolateImpl(const type::Type& type_,
+ const Interpolator& interpolator_,
+ std::unique_ptr<Expression> input_,
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
+ std::map<double, std::unique_ptr<Expression>> stops_)
+ : Interpolate(type_, interpolator_, std::move(input_), std::move(stops_)) {
static_assert(util::Interpolatable<T>::value, "Interpolate expression requires an interpolatable value type.");
}
diff --git a/src/mbgl/style/expression/parsing_context.cpp b/src/mbgl/style/expression/parsing_context.cpp
index 2f1e1c1820..ad1a46b8d6 100644
--- a/src/mbgl/style/expression/parsing_context.cpp
+++ b/src/mbgl/style/expression/parsing_context.cpp
@@ -34,6 +34,7 @@
#include <mbgl/util/string.hpp>
#include <mapbox/eternal.hpp>
+#include <utility>
namespace mbgl {
namespace style {
@@ -85,7 +86,7 @@ using namespace mbgl::style::conversion;
ParseResult ParsingContext::parse(const Convertible& value,
std::size_t index_,
optional<type::Type> expected_,
- optional<TypeAnnotationOption> typeAnnotationOption) {
+ const optional<TypeAnnotationOption>& typeAnnotationOption) {
ParsingContext child(key + "[" + util::toString(index_) + "]",
errors,
std::move(expected_),
@@ -144,7 +145,8 @@ bool isExpression(const std::string& name) {
return expressionRegistry.contains(name.c_str());
}
-ParseResult ParsingContext::parse(const Convertible& value, optional<TypeAnnotationOption> typeAnnotationOption) {
+ParseResult ParsingContext::parse(const Convertible& value,
+ const optional<TypeAnnotationOption>& typeAnnotationOption) {
ParseResult parsed;
if (isArray(value)) {
@@ -179,14 +181,16 @@ ParseResult ParsingContext::parse(const Convertible& value, optional<TypeAnnotat
return parsed;
}
- auto annotate = [] (std::unique_ptr<Expression> expression, type::Type type, TypeAnnotationOption typeAnnotation) -> std::unique_ptr<Expression> {
+ auto annotate = [](std::unique_ptr<Expression> expression,
+ const type::Type& type,
+ TypeAnnotationOption typeAnnotation) -> std::unique_ptr<Expression> {
switch (typeAnnotation) {
- case TypeAnnotationOption::assert:
- return std::make_unique<Assertion>(type, dsl::vec(std::move(expression)));
- case TypeAnnotationOption::coerce:
- return std::make_unique<Coercion>(type, dsl::vec(std::move(expression)));
- case TypeAnnotationOption::omit:
- return expression;
+ case TypeAnnotationOption::assert:
+ return std::make_unique<Assertion>(type, dsl::vec(std::move(expression)));
+ case TypeAnnotationOption::coerce:
+ return std::make_unique<Coercion>(type, dsl::vec(std::move(expression)));
+ case TypeAnnotationOption::omit:
+ return expression;
}
// Not reachable, but placate GCC.
@@ -237,7 +241,8 @@ ParseResult ParsingContext::parse(const Convertible& value, optional<TypeAnnotat
return parsed;
}
-ParseResult ParsingContext::parseExpression(const Convertible& value, optional<TypeAnnotationOption> typeAnnotationOption) {
+ParseResult ParsingContext::parseExpression(const Convertible& value,
+ const optional<TypeAnnotationOption>& typeAnnotationOption) {
return parse(value, typeAnnotationOption);
}
diff --git a/src/mbgl/style/image.cpp b/src/mbgl/style/image.cpp
index be7e52abfa..eb0b5ab24b 100644
--- a/src/mbgl/style/image.cpp
+++ b/src/mbgl/style/image.cpp
@@ -11,7 +11,7 @@ Image::Image(std::string id,
bool sdf,
ImageStretches stretchX,
ImageStretches stretchY,
- optional<ImageContent> content)
+ const optional<ImageContent>& content)
: baseImpl(makeMutable<Impl>(
std::move(id), std::move(image), pixelRatio, sdf, std::move(stretchX), std::move(stretchY), content)) {}
diff --git a/src/mbgl/style/light.cpp b/src/mbgl/style/light.cpp
index 2ef4c2f940..e4ceed0ce6 100644
--- a/src/mbgl/style/light.cpp
+++ b/src/mbgl/style/light.cpp
@@ -12,6 +12,8 @@
#include <mapbox/eternal.hpp>
+#include <utility>
+
namespace mbgl {
namespace style {
@@ -188,7 +190,7 @@ PropertyValue<LightAnchorType> Light::getAnchor() const {
void Light::setAnchor(PropertyValue<LightAnchorType> property) {
auto impl_ = mutableImpl();
- impl_->properties.template get<LightAnchor>().value = property;
+ impl_->properties.template get<LightAnchor>().value = std::move(property);
impl = std::move(impl_);
observer->onLightChanged(*this);
}
@@ -214,7 +216,7 @@ PropertyValue<Color> Light::getColor() const {
void Light::setColor(PropertyValue<Color> property) {
auto impl_ = mutableImpl();
- impl_->properties.template get<LightColor>().value = property;
+ impl_->properties.template get<LightColor>().value = std::move(property);
impl = std::move(impl_);
observer->onLightChanged(*this);
}
@@ -240,7 +242,7 @@ PropertyValue<float> Light::getIntensity() const {
void Light::setIntensity(PropertyValue<float> property) {
auto impl_ = mutableImpl();
- impl_->properties.template get<LightIntensity>().value = property;
+ impl_->properties.template get<LightIntensity>().value = std::move(property);
impl = std::move(impl_);
observer->onLightChanged(*this);
}
@@ -266,7 +268,7 @@ PropertyValue<Position> Light::getPosition() const {
void Light::setPosition(PropertyValue<Position> property) {
auto impl_ = mutableImpl();
- impl_->properties.template get<LightPosition>().value = property;
+ impl_->properties.template get<LightPosition>().value = std::move(property);
impl = std::move(impl_);
observer->onLightChanged(*this);
}
diff --git a/src/mbgl/style/light.cpp.ejs b/src/mbgl/style/light.cpp.ejs
index 9f84238839..fb0c47dc62 100644
--- a/src/mbgl/style/light.cpp.ejs
+++ b/src/mbgl/style/light.cpp.ejs
@@ -15,6 +15,8 @@
#include <mapbox/eternal.hpp>
+#include <utility>
+
namespace mbgl {
namespace style {
@@ -142,7 +144,7 @@ StyleProperty Light::getProperty(const std::string& name) const {
void Light::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> property) {
auto impl_ = mutableImpl();
- impl_->properties.template get<Light<%- camelize(property.name) %>>().value = property;
+ impl_->properties.template get<Light<%- camelize(property.name) %>>().value = std::move(property);
impl = std::move(impl_);
observer->onLightChanged(*this);
}
diff --git a/src/mbgl/style/sources/custom_geometry_source.cpp b/src/mbgl/style/sources/custom_geometry_source.cpp
index 44401c1a8f..9d3a58c151 100644
--- a/src/mbgl/style/sources/custom_geometry_source.cpp
+++ b/src/mbgl/style/sources/custom_geometry_source.cpp
@@ -14,7 +14,7 @@
namespace mbgl {
namespace style {
-CustomGeometrySource::CustomGeometrySource(std::string id, CustomGeometrySource::Options options)
+CustomGeometrySource::CustomGeometrySource(std::string id, const CustomGeometrySource::Options& options)
: Source(makeMutable<CustomGeometrySource::Impl>(std::move(id), options)),
loader(std::make_unique<Actor<CustomTileLoader>>(
Scheduler::GetBackground(), options.fetchTileFunction, options.cancelTileFunction)) {}
diff --git a/src/mbgl/style/sources/custom_geometry_source_impl.cpp b/src/mbgl/style/sources/custom_geometry_source_impl.cpp
index e456bd8719..184718fd76 100644
--- a/src/mbgl/style/sources/custom_geometry_source_impl.cpp
+++ b/src/mbgl/style/sources/custom_geometry_source_impl.cpp
@@ -4,13 +4,13 @@
namespace mbgl {
namespace style {
-CustomGeometrySource::Impl::Impl(std::string id_, CustomGeometrySource::Options options)
+CustomGeometrySource::Impl::Impl(std::string id_, const CustomGeometrySource::Options& options)
: Source::Impl(SourceType::CustomVector, std::move(id_)),
tileOptions(makeMutable<CustomGeometrySource::TileOptions>(options.tileOptions)),
zoomRange(options.zoomRange),
loaderRef({}) {}
-CustomGeometrySource::Impl::Impl(const Impl& impl, ActorRef<CustomTileLoader> loaderRef_)
+CustomGeometrySource::Impl::Impl(const Impl& impl, const ActorRef<CustomTileLoader>& loaderRef_)
: Source::Impl(impl), tileOptions(impl.tileOptions), zoomRange(impl.zoomRange), loaderRef(loaderRef_) {}
bool CustomGeometrySource::Impl::operator!=(const Impl& other) const noexcept {
diff --git a/src/mbgl/style/sources/custom_geometry_source_impl.hpp b/src/mbgl/style/sources/custom_geometry_source_impl.hpp
index 04e301f198..a441b38f69 100644
--- a/src/mbgl/style/sources/custom_geometry_source_impl.hpp
+++ b/src/mbgl/style/sources/custom_geometry_source_impl.hpp
@@ -10,8 +10,8 @@ namespace style {
class CustomGeometrySource::Impl : public Source::Impl {
public:
- Impl(std::string id, CustomGeometrySource::Options options);
- Impl(const Impl&, ActorRef<CustomTileLoader>);
+ Impl(std::string id, const CustomGeometrySource::Options& options);
+ Impl(const Impl&, const ActorRef<CustomTileLoader>&);
optional<std::string> getAttribution() const final;
diff --git a/src/mbgl/style/sources/geojson_source.cpp b/src/mbgl/style/sources/geojson_source.cpp
index 2880b9b131..d750d6b1d2 100644
--- a/src/mbgl/style/sources/geojson_source.cpp
+++ b/src/mbgl/style/sources/geojson_source.cpp
@@ -79,7 +79,7 @@ void GeoJSONSource::loadDescription(FileSource& fileSource) {
return;
}
- req = fileSource.request(Resource::source(*url), [this](Response res) {
+ req = fileSource.request(Resource::source(*url), [this](const 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/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index bb5445f02b..fb33eee8f9 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -80,7 +80,7 @@ T evaluateFeature(const mapbox::feature::feature<double>& f,
// static
std::shared_ptr<GeoJSONData> GeoJSONData::create(const GeoJSON& geoJSON,
- Immutable<GeoJSONOptions> options,
+ const Immutable<GeoJSONOptions>& options,
std::shared_ptr<Scheduler> scheduler) {
constexpr double scale = util::EXTENT / util::tileSize;
if (options->cluster && geoJSON.is<Features>() && !geoJSON.get<Features>().empty()) {
diff --git a/src/mbgl/style/sources/image_source.cpp b/src/mbgl/style/sources/image_source.cpp
index ec727a33bd..144d007cc5 100644
--- a/src/mbgl/style/sources/image_source.cpp
+++ b/src/mbgl/style/sources/image_source.cpp
@@ -64,7 +64,7 @@ void ImageSource::loadDescription(FileSource& fileSource) {
}
const Resource imageResource { Resource::Image, *url, {} };
- req = fileSource.request(imageResource, [this](Response res) {
+ req = fileSource.request(imageResource, [this](const Response& res) {
if (res.error) {
observer->onSourceError(*this, std::make_exception_ptr(std::runtime_error(res.error->message)));
} else if (res.notModified) {
diff --git a/src/mbgl/style/sources/raster_dem_source.cpp b/src/mbgl/style/sources/raster_dem_source.cpp
index dd859cc6d1..98a83ee870 100644
--- a/src/mbgl/style/sources/raster_dem_source.cpp
+++ b/src/mbgl/style/sources/raster_dem_source.cpp
@@ -6,13 +6,13 @@
#include <mbgl/style/sources/raster_source_impl.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/util/mapbox.hpp>
+#include <utility>
namespace mbgl {
namespace style {
RasterDEMSource::RasterDEMSource(std::string id, variant<std::string, Tileset> urlOrTileset_, uint16_t tileSize)
- : RasterSource(std::move(id), urlOrTileset_, tileSize, SourceType::RasterDEM){
-}
+ : RasterSource(std::move(id), std::move(urlOrTileset_), tileSize, SourceType::RasterDEM) {}
bool RasterDEMSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const {
return mbgl::underlying_type(Tile::Kind::RasterDEM) == mbgl::underlying_type(info->tileKind);
diff --git a/src/mbgl/style/sources/raster_source.cpp b/src/mbgl/style/sources/raster_source.cpp
index 8c41da3a23..aa56f9570b 100644
--- a/src/mbgl/style/sources/raster_source.cpp
+++ b/src/mbgl/style/sources/raster_source.cpp
@@ -53,7 +53,7 @@ void RasterSource::loadDescription(FileSource& fileSource) {
}
const auto& url = urlOrTileset.get<std::string>();
- req = fileSource.request(Resource::source(url), [this, url](Response res) {
+ req = fileSource.request(Resource::source(url), [this, url](const Response& res) {
if (res.error) {
observer->onSourceError(*this, std::make_exception_ptr(std::runtime_error(res.error->message)));
} else if (res.notModified) {
diff --git a/src/mbgl/style/sources/vector_source.cpp b/src/mbgl/style/sources/vector_source.cpp
index cc2319b302..b482449fbf 100644
--- a/src/mbgl/style/sources/vector_source.cpp
+++ b/src/mbgl/style/sources/vector_source.cpp
@@ -52,7 +52,7 @@ void VectorSource::loadDescription(FileSource& fileSource) {
}
const auto& url = urlOrTileset.get<std::string>();
- req = fileSource.request(Resource::source(url), [this, url](Response res) {
+ req = fileSource.request(Resource::source(url), [this, url](const Response& res) {
if (res.error) {
observer->onSourceError(*this, std::make_exception_ptr(std::runtime_error(res.error->message)));
} else if (res.notModified) {
diff --git a/src/mbgl/style/style_impl.cpp b/src/mbgl/style/style_impl.cpp
index 83570e40e0..52f39b52d4 100644
--- a/src/mbgl/style/style_impl.cpp
+++ b/src/mbgl/style/style_impl.cpp
@@ -62,7 +62,7 @@ void Style::Impl::loadURL(const std::string& url_) {
loaded = false;
url = url_;
- styleRequest = fileSource->request(Resource::style(url), [this](Response res) {
+ styleRequest = fileSource->request(Resource::style(url), [this](const Response& res) {
// Don't allow a loaded, mutated style to be overwritten with a new version.
if (mutated && loaded) {
return;
@@ -190,7 +190,7 @@ Layer* Style::Impl::getLayer(const std::string& id) const {
return layers.get(id);
}
-Layer* Style::Impl::addLayer(std::unique_ptr<Layer> layer, optional<std::string> before) {
+Layer* Style::Impl::addLayer(std::unique_ptr<Layer> layer, const optional<std::string>& before) {
// TODO: verify source
if (Source* source = sources.get(layer->getSourceID())) {
if (!source->supportsLayerType(layer->baseImpl->getTypeInfo())) {
diff --git a/src/mbgl/style/style_impl.hpp b/src/mbgl/style/style_impl.hpp
index c16b82e90b..4573a3966a 100644
--- a/src/mbgl/style/style_impl.hpp
+++ b/src/mbgl/style/style_impl.hpp
@@ -65,8 +65,7 @@ public:
std::vector<const Layer*> getLayers() const;
Layer* getLayer(const std::string& id) const;
- Layer* addLayer(std::unique_ptr<Layer>,
- optional<std::string> beforeLayerID = {});
+ Layer* addLayer(std::unique_ptr<Layer>, const optional<std::string>& beforeLayerID = {});
std::unique_ptr<Layer> removeLayer(const std::string& layerID);
std::string getName() const;
diff --git a/src/mbgl/text/collision_index.cpp b/src/mbgl/text/collision_index.cpp
index 0447886166..20cb6514b6 100644
--- a/src/mbgl/text/collision_index.cpp
+++ b/src/mbgl/text/collision_index.cpp
@@ -126,7 +126,7 @@ std::pair<bool, bool> CollisionIndex::placeFeature(
const bool pitchWithMap,
const bool collisionDebug,
const optional<CollisionBoundaries>& avoidEdges,
- const optional<std::function<bool(const IndexedSubfeature&)>> collisionGroupPredicate,
+ const optional<std::function<bool(const IndexedSubfeature&)>>& collisionGroupPredicate,
std::vector<ProjectedCollisionBox>& projectedBoxes) {
assert(projectedBoxes.empty());
if (!feature.alongLine) {
@@ -157,7 +157,7 @@ std::pair<bool, bool> CollisionIndex::placeLineFeature(
const bool pitchWithMap,
const bool collisionDebug,
const optional<CollisionBoundaries>& avoidEdges,
- const optional<std::function<bool(const IndexedSubfeature&)>> collisionGroupPredicate,
+ const optional<std::function<bool(const IndexedSubfeature&)>>& collisionGroupPredicate,
std::vector<ProjectedCollisionBox>& projectedBoxes) {
assert(feature.alongLine);
assert(projectedBoxes.empty());
diff --git a/src/mbgl/text/collision_index.hpp b/src/mbgl/text/collision_index.hpp
index 2effe452d9..dd1da03bdb 100644
--- a/src/mbgl/text/collision_index.hpp
+++ b/src/mbgl/text/collision_index.hpp
@@ -39,7 +39,7 @@ public:
const bool pitchWithMap,
const bool collisionDebug,
const optional<CollisionBoundaries>& avoidEdges,
- const optional<std::function<bool(const IndexedSubfeature&)>> collisionGroupPredicate,
+ const optional<std::function<bool(const IndexedSubfeature&)>>& collisionGroupPredicate,
std::vector<ProjectedCollisionBox>& /*out*/);
void insertFeature(const CollisionFeature& feature, const std::vector<ProjectedCollisionBox>&, bool ignorePlacement, uint32_t bucketInstanceId, uint16_t collisionGroupId);
@@ -68,7 +68,7 @@ private:
const bool pitchWithMap,
const bool collisionDebug,
const optional<CollisionBoundaries>& avoidEdges,
- const optional<std::function<bool(const IndexedSubfeature&)>> collisionGroupPredicate,
+ const optional<std::function<bool(const IndexedSubfeature&)>>& collisionGroupPredicate,
std::vector<ProjectedCollisionBox>& /*out*/);
float approximateTileDistance(const TileDistance& tileDistance, const float lastSegmentAngle, const float pixelsToTileUnits, const float cameraToAnchorDistance, const bool pitchWithMap);
diff --git a/src/mbgl/text/glyph_manager.cpp b/src/mbgl/text/glyph_manager.cpp
index 8caac1be31..8aa9063ea5 100644
--- a/src/mbgl/text/glyph_manager.cpp
+++ b/src/mbgl/text/glyph_manager.cpp
@@ -70,9 +70,9 @@ void GlyphManager::requestRange(GlyphRequest& request, const FontStack& fontStac
return;
}
- request.req = fileSource.request(Resource::glyphs(glyphURL, fontStack, range), [this, fontStack, range](Response res) {
- processResponse(res, fontStack, range);
- });
+ request.req =
+ fileSource.request(Resource::glyphs(glyphURL, fontStack, range),
+ [this, fontStack, range](const Response& res) { processResponse(res, fontStack, range); });
}
void GlyphManager::processResponse(const Response& res, const FontStack& fontStack, const GlyphRange& range) {
diff --git a/src/mbgl/text/local_glyph_rasterizer.hpp b/src/mbgl/text/local_glyph_rasterizer.hpp
index 82b16b534d..4582aab103 100644
--- a/src/mbgl/text/local_glyph_rasterizer.hpp
+++ b/src/mbgl/text/local_glyph_rasterizer.hpp
@@ -33,7 +33,7 @@ namespace mbgl {
class LocalGlyphRasterizer {
public:
virtual ~LocalGlyphRasterizer();
- LocalGlyphRasterizer(const optional<std::string> fontFamily = optional<std::string>());
+ LocalGlyphRasterizer(const optional<std::string>& fontFamily = optional<std::string>());
// virtual so that test harness can override platform-specific behavior
virtual bool canRasterizeGlyph(const FontStack&, GlyphID);
diff --git a/src/mbgl/text/tagged_string.cpp b/src/mbgl/text/tagged_string.cpp
index 83ccd610c2..b18ad4d148 100644
--- a/src/mbgl/text/tagged_string.cpp
+++ b/src/mbgl/text/tagged_string.cpp
@@ -12,7 +12,7 @@ namespace mbgl {
void TaggedString::addTextSection(const std::u16string& sectionText,
double scale,
- FontStack fontStack,
+ const FontStack& fontStack,
optional<Color> textColor) {
styledText.first += sectionText;
sections.emplace_back(scale, fontStack, std::move(textColor));
diff --git a/src/mbgl/text/tagged_string.hpp b/src/mbgl/text/tagged_string.hpp
index fba3bbf412..205bfbcc53 100644
--- a/src/mbgl/text/tagged_string.hpp
+++ b/src/mbgl/text/tagged_string.hpp
@@ -82,7 +82,7 @@ struct TaggedString {
void addTextSection(const std::u16string& text,
double scale,
- FontStack fontStack,
+ const FontStack& fontStack,
optional<Color> textColor_ = nullopt);
void addImageSection(const std::string& imageID);
diff --git a/src/mbgl/tile/custom_geometry_tile.cpp b/src/mbgl/tile/custom_geometry_tile.cpp
index 660dcf64d4..e13b16a4f1 100644
--- a/src/mbgl/tile/custom_geometry_tile.cpp
+++ b/src/mbgl/tile/custom_geometry_tile.cpp
@@ -17,7 +17,7 @@ CustomGeometryTile::CustomGeometryTile(const OverscaledTileID& overscaledTileID,
const TileParameters& parameters,
Immutable<style::CustomGeometrySource::TileOptions> options_,
ActorRef<style::CustomTileLoader> loader_)
- : GeometryTile(overscaledTileID, sourceID_, parameters),
+ : GeometryTile(overscaledTileID, std::move(sourceID_), parameters),
necessity(TileNecessity::Optional),
options(std::move(options_)),
loader(std::move(loader_)),
diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp
index 65a9d80aec..0b37510978 100644
--- a/src/mbgl/tile/geojson_tile.cpp
+++ b/src/mbgl/tile/geojson_tile.cpp
@@ -3,13 +3,14 @@
#include <mbgl/style/sources/geojson_source.hpp>
#include <mbgl/tile/geojson_tile.hpp>
#include <mbgl/tile/geojson_tile_data.hpp>
+#include <utility>
namespace mbgl {
GeoJSONTile::GeoJSONTile(const OverscaledTileID& overscaledTileID,
std::string sourceID_,
const TileParameters& parameters,
std::shared_ptr<style::GeoJSONData> data_)
- : GeometryTile(overscaledTileID, sourceID_, parameters) {
+ : GeometryTile(overscaledTileID, std::move(sourceID_), parameters) {
updateData(std::move(data_), false /*needsRelayout*/);
}
diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp
index 92b0a1fa9a..306c95baab 100644
--- a/src/mbgl/tile/geometry_tile.cpp
+++ b/src/mbgl/tile/geometry_tile.cpp
@@ -22,6 +22,7 @@
#include <mbgl/util/logging.hpp>
#include <mbgl/gfx/upload_pass.hpp>
+#include <utility>
namespace mbgl {
@@ -176,7 +177,7 @@ void GeometryTile::markObsolete() {
void GeometryTile::setError(std::exception_ptr err) {
loaded = true;
- observer->onTileError(*this, err);
+ observer->onTileError(*this, std::move(err));
}
void GeometryTile::setData(std::unique_ptr<const GeometryTileData> data_) {
@@ -257,7 +258,7 @@ void GeometryTile::onError(std::exception_ptr err, const uint64_t resultCorrelat
if (resultCorrelationID == correlationID) {
pending = false;
}
- observer->onTileError(*this, err);
+ observer->onTileError(*this, std::move(err));
}
void GeometryTile::onGlyphsAvailable(GlyphMap glyphs) {
diff --git a/src/mbgl/tile/geometry_tile_data.cpp b/src/mbgl/tile/geometry_tile_data.cpp
index d30875ab3b..472b07739b 100644
--- a/src/mbgl/tile/geometry_tile_data.cpp
+++ b/src/mbgl/tile/geometry_tile_data.cpp
@@ -224,7 +224,7 @@ GeometryCollection convertGeometry(const Feature::geometry_type& geometryTileFea
}
return result;
},
- [&](const Polygon<double> polygon) -> GeometryCollection {
+ [&](const Polygon<double>& polygon) -> GeometryCollection {
GeometryCollection result;
result.reserve(polygon.size());
for (const auto& ring : polygon) {
@@ -237,7 +237,7 @@ GeometryCollection convertGeometry(const Feature::geometry_type& geometryTileFea
}
return result;
},
- [&](const MultiPolygon<double> polygons) -> GeometryCollection {
+ [&](const MultiPolygon<double>& polygons) -> GeometryCollection {
GeometryCollection result;
result.reserve(polygons.size());
for (const auto& pg : polygons) {
diff --git a/src/mbgl/tile/raster_dem_tile.cpp b/src/mbgl/tile/raster_dem_tile.cpp
index c092809130..6d0c89048f 100644
--- a/src/mbgl/tile/raster_dem_tile.cpp
+++ b/src/mbgl/tile/raster_dem_tile.cpp
@@ -1,15 +1,16 @@
#include <mbgl/tile/raster_dem_tile.hpp>
-#include <mbgl/tile/raster_dem_tile_worker.hpp>
-#include <mbgl/tile/tile_observer.hpp>
-#include <mbgl/tile/tile_loader_impl.hpp>
-#include <mbgl/style/source.hpp>
-#include <mbgl/storage/resource.hpp>
-#include <mbgl/storage/response.hpp>
+#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/renderer/buckets/hillshade_bucket.hpp>
#include <mbgl/renderer/tile_parameters.hpp>
#include <mbgl/renderer/tile_render_data.hpp>
-#include <mbgl/renderer/buckets/hillshade_bucket.hpp>
-#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/storage/resource.hpp>
+#include <mbgl/storage/response.hpp>
+#include <mbgl/style/source.hpp>
+#include <mbgl/tile/raster_dem_tile_worker.hpp>
+#include <mbgl/tile/tile_loader_impl.hpp>
+#include <mbgl/tile/tile_observer.hpp>
+#include <utility>
namespace mbgl {
@@ -42,15 +43,15 @@ std::unique_ptr<TileRenderData> RasterDEMTile::createRenderData() {
void RasterDEMTile::setError(std::exception_ptr err) {
loaded = true;
- observer->onTileError(*this, err);
+ observer->onTileError(*this, std::move(err));
}
void RasterDEMTile::setMetadata(optional<Timestamp> modified_, optional<Timestamp> expires_) {
- modified = modified_;
- expires = expires_;
+ modified = std::move(modified_);
+ expires = std::move(expires_);
}
-void RasterDEMTile::setData(std::shared_ptr<const std::string> data) {
+void RasterDEMTile::setData(const std::shared_ptr<const std::string>& data) {
pending = true;
++correlationID;
worker.self().invoke(&RasterDEMTileWorker::parse, data, correlationID, encoding);
@@ -71,7 +72,7 @@ void RasterDEMTile::onError(std::exception_ptr err, const uint64_t resultCorrela
if (resultCorrelationID == correlationID) {
pending = false;
}
- observer->onTileError(*this, err);
+ observer->onTileError(*this, std::move(err));
}
bool RasterDEMTile::layerPropertiesUpdated(const Immutable<style::LayerProperties>&) {
diff --git a/src/mbgl/tile/raster_dem_tile.hpp b/src/mbgl/tile/raster_dem_tile.hpp
index e6a6b6f9f5..0cfaedd88d 100644
--- a/src/mbgl/tile/raster_dem_tile.hpp
+++ b/src/mbgl/tile/raster_dem_tile.hpp
@@ -71,7 +71,7 @@ public:
void setError(std::exception_ptr);
void setMetadata(optional<Timestamp> modified, optional<Timestamp> expires);
- void setData(std::shared_ptr<const std::string> data);
+ void setData(const std::shared_ptr<const std::string>& data);
bool layerPropertiesUpdated(const Immutable<style::LayerProperties>& layerProperties) override;
diff --git a/src/mbgl/tile/raster_dem_tile_worker.cpp b/src/mbgl/tile/raster_dem_tile_worker.cpp
index 7338e578c7..92fe3d919a 100644
--- a/src/mbgl/tile/raster_dem_tile_worker.cpp
+++ b/src/mbgl/tile/raster_dem_tile_worker.cpp
@@ -6,11 +6,12 @@
namespace mbgl {
-RasterDEMTileWorker::RasterDEMTileWorker(ActorRef<RasterDEMTileWorker>, ActorRef<RasterDEMTile> parent_)
- : parent(std::move(parent_)) {
-}
+RasterDEMTileWorker::RasterDEMTileWorker(const ActorRef<RasterDEMTileWorker>&, ActorRef<RasterDEMTile> parent_)
+ : parent(std::move(parent_)) {}
-void RasterDEMTileWorker::parse(std::shared_ptr<const std::string> data, uint64_t correlationID, Tileset::DEMEncoding encoding) {
+void RasterDEMTileWorker::parse(const std::shared_ptr<const std::string>& data,
+ uint64_t correlationID,
+ Tileset::DEMEncoding encoding) {
if (!data) {
parent.invoke(&RasterDEMTile::onParsed, nullptr, correlationID); // No data; empty tile.
return;
diff --git a/src/mbgl/tile/raster_dem_tile_worker.hpp b/src/mbgl/tile/raster_dem_tile_worker.hpp
index 5a8222bc2d..cce569c41e 100644
--- a/src/mbgl/tile/raster_dem_tile_worker.hpp
+++ b/src/mbgl/tile/raster_dem_tile_worker.hpp
@@ -12,9 +12,9 @@ class RasterDEMTile;
class RasterDEMTileWorker {
public:
- RasterDEMTileWorker(ActorRef<RasterDEMTileWorker>, ActorRef<RasterDEMTile>);
+ RasterDEMTileWorker(const ActorRef<RasterDEMTileWorker>&, ActorRef<RasterDEMTile>);
- void parse(std::shared_ptr<const std::string> data, uint64_t correlationID, Tileset::DEMEncoding encoding);
+ void parse(const std::shared_ptr<const std::string>& data, uint64_t correlationID, Tileset::DEMEncoding encoding);
private:
ActorRef<RasterDEMTile> parent;
diff --git a/src/mbgl/tile/raster_tile.cpp b/src/mbgl/tile/raster_tile.cpp
index 50a0d700b8..697e26d936 100644
--- a/src/mbgl/tile/raster_tile.cpp
+++ b/src/mbgl/tile/raster_tile.cpp
@@ -1,15 +1,16 @@
#include <mbgl/tile/raster_tile.hpp>
-#include <mbgl/tile/raster_tile_worker.hpp>
-#include <mbgl/tile/tile_observer.hpp>
-#include <mbgl/tile/tile_loader_impl.hpp>
-#include <mbgl/style/source.hpp>
-#include <mbgl/storage/resource.hpp>
-#include <mbgl/storage/response.hpp>
+#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/renderer/buckets/raster_bucket.hpp>
#include <mbgl/renderer/tile_parameters.hpp>
#include <mbgl/renderer/tile_render_data.hpp>
-#include <mbgl/renderer/buckets/raster_bucket.hpp>
-#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/storage/resource.hpp>
+#include <mbgl/storage/response.hpp>
+#include <mbgl/style/source.hpp>
+#include <mbgl/tile/raster_tile_worker.hpp>
+#include <mbgl/tile/tile_loader_impl.hpp>
+#include <mbgl/tile/tile_observer.hpp>
+#include <utility>
namespace mbgl {
@@ -31,15 +32,15 @@ std::unique_ptr<TileRenderData> RasterTile::createRenderData() {
void RasterTile::setError(std::exception_ptr err) {
loaded = true;
- observer->onTileError(*this, err);
+ observer->onTileError(*this, std::move(err));
}
void RasterTile::setMetadata(optional<Timestamp> modified_, optional<Timestamp> expires_) {
- modified = modified_;
- expires = expires_;
+ modified = std::move(modified_);
+ expires = std::move(expires_);
}
-void RasterTile::setData(std::shared_ptr<const std::string> data) {
+void RasterTile::setData(const std::shared_ptr<const std::string>& data) {
pending = true;
++correlationID;
worker.self().invoke(&RasterTileWorker::parse, data, correlationID);
@@ -60,7 +61,7 @@ void RasterTile::onError(std::exception_ptr err, const uint64_t resultCorrelatio
if (resultCorrelationID == correlationID) {
pending = false;
}
- observer->onTileError(*this, err);
+ observer->onTileError(*this, std::move(err));
}
bool RasterTile::layerPropertiesUpdated(const Immutable<style::LayerProperties>&) {
diff --git a/src/mbgl/tile/raster_tile.hpp b/src/mbgl/tile/raster_tile.hpp
index 49ca3239ef..3ff05d2f9d 100644
--- a/src/mbgl/tile/raster_tile.hpp
+++ b/src/mbgl/tile/raster_tile.hpp
@@ -27,7 +27,7 @@ public:
void setError(std::exception_ptr);
void setMetadata(optional<Timestamp> modified, optional<Timestamp> expires);
- void setData(std::shared_ptr<const std::string> data);
+ void setData(const std::shared_ptr<const std::string>& data);
bool layerPropertiesUpdated(const Immutable<style::LayerProperties>& layerProperties) override;
diff --git a/src/mbgl/tile/raster_tile_worker.cpp b/src/mbgl/tile/raster_tile_worker.cpp
index 4afa876429..2a4cfeaf31 100644
--- a/src/mbgl/tile/raster_tile_worker.cpp
+++ b/src/mbgl/tile/raster_tile_worker.cpp
@@ -6,11 +6,10 @@
namespace mbgl {
-RasterTileWorker::RasterTileWorker(ActorRef<RasterTileWorker>, ActorRef<RasterTile> parent_)
- : parent(std::move(parent_)) {
-}
+RasterTileWorker::RasterTileWorker(const ActorRef<RasterTileWorker>&, ActorRef<RasterTile> parent_)
+ : parent(std::move(parent_)) {}
-void RasterTileWorker::parse(std::shared_ptr<const std::string> data, uint64_t correlationID) {
+void RasterTileWorker::parse(const std::shared_ptr<const std::string>& data, uint64_t correlationID) {
if (!data) {
parent.invoke(&RasterTile::onParsed, nullptr, correlationID); // No data; empty tile.
return;
diff --git a/src/mbgl/tile/raster_tile_worker.hpp b/src/mbgl/tile/raster_tile_worker.hpp
index 520973c3c3..44e12557ca 100644
--- a/src/mbgl/tile/raster_tile_worker.hpp
+++ b/src/mbgl/tile/raster_tile_worker.hpp
@@ -11,9 +11,9 @@ class RasterTile;
class RasterTileWorker {
public:
- RasterTileWorker(ActorRef<RasterTileWorker>, ActorRef<RasterTile>);
+ RasterTileWorker(const ActorRef<RasterTileWorker>&, ActorRef<RasterTile>);
- void parse(std::shared_ptr<const std::string> data, uint64_t correlationID);
+ void parse(const std::shared_ptr<const std::string>& data, uint64_t correlationID);
private:
ActorRef<RasterTile> parent;
diff --git a/src/mbgl/tile/vector_tile.cpp b/src/mbgl/tile/vector_tile.cpp
index 0756d3e526..e3e7a2dff8 100644
--- a/src/mbgl/tile/vector_tile.cpp
+++ b/src/mbgl/tile/vector_tile.cpp
@@ -1,7 +1,8 @@
+#include <mbgl/renderer/tile_parameters.hpp>
+#include <mbgl/tile/tile_loader_impl.hpp>
#include <mbgl/tile/vector_tile.hpp>
#include <mbgl/tile/vector_tile_data.hpp>
-#include <mbgl/tile/tile_loader_impl.hpp>
-#include <mbgl/renderer/tile_parameters.hpp>
+#include <utility>
namespace mbgl {
@@ -9,19 +10,18 @@ VectorTile::VectorTile(const OverscaledTileID& id_,
std::string sourceID_,
const TileParameters& parameters,
const Tileset& tileset)
- : GeometryTile(id_, sourceID_, parameters), loader(*this, id_, parameters, tileset) {
-}
+ : GeometryTile(id_, std::move(sourceID_), parameters), loader(*this, id_, parameters, tileset) {}
void VectorTile::setNecessity(TileNecessity necessity) {
loader.setNecessity(necessity);
}
void VectorTile::setMetadata(optional<Timestamp> modified_, optional<Timestamp> expires_) {
- modified = modified_;
- expires = expires_;
+ modified = std::move(modified_);
+ expires = std::move(expires_);
}
-void VectorTile::setData(std::shared_ptr<const std::string> data_) {
+void VectorTile::setData(const std::shared_ptr<const std::string>& data_) {
GeometryTile::setData(data_ ? std::make_unique<VectorTileData>(data_) : nullptr);
}
diff --git a/src/mbgl/tile/vector_tile.hpp b/src/mbgl/tile/vector_tile.hpp
index 7dae414fef..205fd642f0 100644
--- a/src/mbgl/tile/vector_tile.hpp
+++ b/src/mbgl/tile/vector_tile.hpp
@@ -17,7 +17,7 @@ public:
void setNecessity(TileNecessity) final;
void setMetadata(optional<Timestamp> modified, optional<Timestamp> expires);
- void setData(std::shared_ptr<const std::string> data);
+ void setData(const std::shared_ptr<const std::string>& data);
private:
TileLoader<VectorTile> loader;
diff --git a/src/mbgl/util/string.cpp b/src/mbgl/util/string.cpp
index 6f7e02e5e2..718da5f1de 100644
--- a/src/mbgl/util/string.cpp
+++ b/src/mbgl/util/string.cpp
@@ -48,7 +48,7 @@ std::string toString(double t, bool decimal) {
return data;
}
-std::string toString(std::exception_ptr error) {
+std::string toString(const std::exception_ptr& error) {
assert(error);
if (!error) {
diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp
index 11d5e57d7f..106ad9aa57 100644
--- a/src/mbgl/util/tile_cover.cpp
+++ b/src/mbgl/util/tile_cover.cpp
@@ -34,7 +34,7 @@ struct edge {
};
// scan-line conversion
-static void scanSpans(edge e0, edge e1, int32_t ymin, int32_t ymax, ScanLine scanLine) {
+static void scanSpans(edge e0, edge e1, int32_t ymin, int32_t ymax, ScanLine& scanLine) {
double y0 = ::fmax(ymin, std::floor(e1.y0));
double y1 = ::fmin(ymax, std::ceil(e1.y1));