[core] Fix modernize-pass-by-value errors
As reported by clang-tidy-8.
This commit is contained in:
@@ -32,19 +32,10 @@ public:
|
||||
|
||||
template <class T>
|
||||
optional<T> numericValue(const Value& value) {
|
||||
return value.match(
|
||||
[] (uint64_t t) {
|
||||
return optional<T>(t);
|
||||
},
|
||||
[] (int64_t t) {
|
||||
return optional<T>(t);
|
||||
},
|
||||
[] (double t) {
|
||||
return optional<T>(t);
|
||||
},
|
||||
[] (auto) {
|
||||
return optional<T>();
|
||||
});
|
||||
return value.match([](uint64_t t) { return optional<T>(t); },
|
||||
[](int64_t t) { return optional<T>(t); },
|
||||
[](double t) { return optional<T>(t); },
|
||||
[](const auto&) { return optional<T>(); });
|
||||
}
|
||||
|
||||
inline optional<std::string> featureIDtoString(const FeatureIdentifier& id) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include <utility>
|
||||
|
||||
using Writer = rapidjson::PrettyWriter<rapidjson::StringBuffer>;
|
||||
|
||||
@@ -19,7 +20,7 @@ public:
|
||||
|
||||
class SetCamera final : public TestOperationSerializer {
|
||||
public:
|
||||
SetCamera(const mbgl::CameraOptions& camera_) : camera(camera_) {}
|
||||
SetCamera(mbgl::CameraOptions camera_) : camera(std::move(camera_)) {}
|
||||
|
||||
void serialize(Writer& writer) const override {
|
||||
if (camera.zoom) {
|
||||
|
||||
@@ -5,16 +5,17 @@
|
||||
#include <mbgl/util/constants.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
LineBucket::LineBucket(const LineBucket::PossiblyEvaluatedLayoutProperties& layout_,
|
||||
LineBucket::LineBucket(LineBucket::PossiblyEvaluatedLayoutProperties layout_,
|
||||
const std::map<std::string, Immutable<LayerProperties>>& layerPaintProperties,
|
||||
const float zoom_,
|
||||
const uint32_t overscaling_)
|
||||
: layout(layout_), zoom(zoom_), overscaling(overscaling_) {
|
||||
: layout(std::move(layout_)), zoom(zoom_), overscaling(overscaling_) {
|
||||
for (const auto& pair : layerPaintProperties) {
|
||||
paintPropertyBinders.emplace(
|
||||
std::piecewise_construct,
|
||||
|
||||
@@ -19,7 +19,7 @@ class LineBucket final : public Bucket {
|
||||
public:
|
||||
using PossiblyEvaluatedLayoutProperties = style::LineLayoutProperties::PossiblyEvaluated;
|
||||
|
||||
LineBucket(const PossiblyEvaluatedLayoutProperties& layout,
|
||||
LineBucket(PossiblyEvaluatedLayoutProperties layout,
|
||||
const std::map<std::string, Immutable<style::LayerProperties>>& layerPaintProperties,
|
||||
const float zoom,
|
||||
const uint32_t overscaling);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <mbgl/text/glyph_atlas.hpp>
|
||||
#include <mbgl/text/placement.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
@@ -21,7 +23,7 @@ SymbolBucket::SymbolBucket(Immutable<style::SymbolLayoutProperties::PossiblyEval
|
||||
float zoom,
|
||||
bool iconsNeedLinear_,
|
||||
bool sortFeaturesByY_,
|
||||
const std::string& bucketName_,
|
||||
std::string bucketName_,
|
||||
const std::vector<SymbolInstance>&& symbolInstances_,
|
||||
const std::vector<SortKeyRange>&& sortKeyRanges_,
|
||||
float tilePixelRatio_,
|
||||
@@ -29,7 +31,7 @@ SymbolBucket::SymbolBucket(Immutable<style::SymbolLayoutProperties::PossiblyEval
|
||||
std::vector<style::TextWritingModeType> placementModes_,
|
||||
bool iconsInText_)
|
||||
: layout(std::move(layout_)),
|
||||
bucketLeaderID(bucketName_),
|
||||
bucketLeaderID(std::move(bucketName_)),
|
||||
iconsNeedLinear(iconsNeedLinear_ || iconSize.isDataDriven() || !iconSize.isZoomConstant()),
|
||||
sortFeaturesByY(sortFeaturesByY_),
|
||||
staticUploaded(false),
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
float zoom,
|
||||
bool iconsNeedLinear,
|
||||
bool sortFeaturesByY,
|
||||
const std::string& bucketLeaderID,
|
||||
std::string bucketLeaderID,
|
||||
const std::vector<SymbolInstance>&&,
|
||||
const std::vector<SortKeyRange>&&,
|
||||
const float tilePixelRatio,
|
||||
|
||||
@@ -23,11 +23,9 @@ std::string getJSONType(const Convertible& value) {
|
||||
// conversion succeeds.
|
||||
assert(v);
|
||||
|
||||
return v->match(
|
||||
[&] (const std::string&) { return "string"; },
|
||||
[&] (bool) { return "boolean"; },
|
||||
[&] (auto) { return "number"; }
|
||||
);
|
||||
return v->match([&](const std::string&) { return "string"; },
|
||||
[&](bool) { return "boolean"; },
|
||||
[&](const auto&) { return "number"; });
|
||||
}
|
||||
|
||||
} // namespace conversion
|
||||
|
||||
@@ -249,17 +249,15 @@ optional<double> featurePropertyAsDouble(const EvaluationContext& params, const
|
||||
return property->match([](double value) { return value; },
|
||||
[](uint64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](int64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](auto) -> optional<double> { return {}; });
|
||||
[](const auto&) -> optional<double> { return {}; });
|
||||
};
|
||||
|
||||
optional<std::string> featurePropertyAsString(const EvaluationContext& params, const std::string& key) {
|
||||
assert(params.feature);
|
||||
auto property = params.feature->getValue(key);
|
||||
if (!property) return {};
|
||||
return property->match(
|
||||
[](std::string value) { return value; },
|
||||
[](auto) { return optional<std::string>(); }
|
||||
);
|
||||
return property->match([](std::string value) { return value; },
|
||||
[](const auto&) { return optional<std::string>(); });
|
||||
};
|
||||
|
||||
optional<double> featureIdAsDouble(const EvaluationContext& params) {
|
||||
@@ -268,16 +266,13 @@ optional<double> featureIdAsDouble(const EvaluationContext& params) {
|
||||
return id.match([](double value) { return value; },
|
||||
[](uint64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](int64_t value) -> optional<double> { return {static_cast<double>(value)}; },
|
||||
[](auto) -> optional<double> { return {}; });
|
||||
[](const auto&) -> optional<double> { return {}; });
|
||||
};
|
||||
|
||||
optional<std::string> featureIdAsString(const EvaluationContext& params) {
|
||||
assert(params.feature);
|
||||
auto id = params.feature->getID();
|
||||
return id.match(
|
||||
[](std::string value) { return value; },
|
||||
[](auto) { return optional<std::string>(); }
|
||||
);
|
||||
return id.match([](std::string value) { return value; }, [](const auto&) { return optional<std::string>(); });
|
||||
};
|
||||
|
||||
const auto& eCompoundExpression() {
|
||||
|
||||
Reference in New Issue
Block a user