git-clang-format

This commit is contained in:
Vladimir Byko-Ianko 2016-05-25 18:44:08 +03:00
parent 6361f1f99a
commit 36c26c6389
8 changed files with 53 additions and 41 deletions

View file

@ -91,7 +91,11 @@ UNIT_TEST(SortUniquePred)
};
vector<Foo> v = {{1, 22}, {2, 33}, {1, 23}, {4, 54}, {3, 34}, {5, 23}, {2, 23}, {7, 32}, {1, 12}};
my::SortUnique<Foo>([](Foo const & f1, Foo const & f2) { return f1.i < f2.i; }, v);
my::SortUnique<Foo>([](Foo const & f1, Foo const & f2)
{
return f1.i < f2.i;
},
v);
TEST_EQUAL(v.size(), 6, ());
TEST_EQUAL(v[0].i, 1, ());

View file

@ -96,8 +96,10 @@ template <typename T>
void SortUnique(function<bool(T const &, T const &)> const & comp, vector<T> & v)
{
sort(v.begin(), v.end(), comp);
function<bool(T const &, T const &)> const pred =
[&comp](T const &t1, T const &t2) { return !comp(t1, t2) && !comp(t2, t1); };
function<bool(T const &, T const &)> const pred = [&comp](T const & t1, T const & t2)
{
return !comp(t1, t2) && !comp(t2, t1);
};
v.erase(unique(v.begin(), v.end(), pred), v.end());
}

View file

@ -94,9 +94,9 @@ unique_ptr<routing::IRouter> CreatePedestrianAStarTestRouter(Index & index, stor
auto UKGetter = [&](m2::PointD const & pt) { return cig.GetRegionCountryId(pt); };
unique_ptr<routing::IVehicleModelFactory> vehicleModelFactory(new SimplifiedPedestrianModelFactory());
unique_ptr<routing::IRoutingAlgorithm> algorithm(new routing::AStarRoutingAlgorithm());
unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter("test-astar-pedestrian", index, UKGetter,
true /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm), nullptr));
unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter(
"test-astar-pedestrian", index, UKGetter, true /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm), nullptr));
return router;
}
@ -105,9 +105,9 @@ unique_ptr<routing::IRouter> CreatePedestrianAStarBidirectionalTestRouter(Index
auto UKGetter = [&](m2::PointD const & pt) { return cig.GetRegionCountryId(pt); };
unique_ptr<routing::IVehicleModelFactory> vehicleModelFactory(new SimplifiedPedestrianModelFactory());
unique_ptr<routing::IRoutingAlgorithm> algorithm(new routing::AStarBidirectionalRoutingAlgorithm());
unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter("test-astar-bidirectional-pedestrian", index, UKGetter,
true /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm), nullptr));
unique_ptr<routing::IRouter> router(new routing::RoadGraphRouter(
"test-astar-bidirectional-pedestrian", index, UKGetter, true /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm), nullptr));
return router;
}
@ -124,7 +124,8 @@ m2::PointD GetPointOnEdge(routing::Edge & e, double posAlong)
void GetNearestPedestrianEdges(Index & index, m2::PointD const & pt, vector<pair<routing::Edge, m2::PointD>> & edges)
{
unique_ptr<routing::IVehicleModelFactory> vehicleModelFactory(new SimplifiedPedestrianModelFactory());
routing::FeaturesRoadGraph roadGraph(index, true /* onewayAsBidirectional */, move(vehicleModelFactory));
routing::FeaturesRoadGraph roadGraph(index, true /* onewayAsBidirectional */,
move(vehicleModelFactory));
roadGraph.FindClosestEdges(pt, 1 /*count*/, edges);
}

View file

@ -103,8 +103,9 @@ void FeaturesRoadGraph::RoadInfoCache::Clear()
FeaturesRoadGraph::FeaturesRoadGraph(Index const & index, bool onewayAsBidirectional,
unique_ptr<IVehicleModelFactory> && vehicleModelFactory)
: m_index(index), m_onewayAsBidirectional(onewayAsBidirectional),
m_vehicleModel(move(vehicleModelFactory))
: m_index(index)
, m_onewayAsBidirectional(onewayAsBidirectional)
, m_vehicleModel(move(vehicleModelFactory))
{
}
@ -113,9 +114,8 @@ uint32_t FeaturesRoadGraph::GetStreetReadScale() { return scales::GetUpperScale(
class CrossFeaturesLoader
{
public:
CrossFeaturesLoader(FeaturesRoadGraph const & graph,
IRoadGraph::ICrossEdgesLoader & edgesLoader)
: m_graph(graph), m_edgesLoader(edgesLoader)
CrossFeaturesLoader(FeaturesRoadGraph const & graph, IRoadGraph::ICrossEdgesLoader & edgesLoader)
: m_graph(graph), m_edgesLoader(edgesLoader)
{}
void operator()(FeatureType & ft)

View file

@ -167,7 +167,8 @@ IRoadGraph::RoadInfo::RoadInfo(bool bidirectional, double speedKMPH, initializer
{}
// IRoadGraph::CrossOutgoingLoader ---------------------------------------------
void IRoadGraph::CrossOutgoingLoader::LoadEdge(FeatureID const & featureId, RoadInfo const & roadInfo)
void IRoadGraph::CrossOutgoingLoader::LoadEdge(FeatureID const & featureId,
RoadInfo const & roadInfo)
{
size_t const numPoints = roadInfo.m_points.size();
@ -197,7 +198,8 @@ void IRoadGraph::CrossOutgoingLoader::LoadEdge(FeatureID const & featureId, Road
}
// IRoadGraph::CrossIngoingLoader ----------------------------------------------
void IRoadGraph::CrossIngoingLoader::LoadEdge(FeatureID const & featureId, RoadInfo const & roadInfo)
void IRoadGraph::CrossIngoingLoader::LoadEdge(FeatureID const & featureId,
RoadInfo const & roadInfo)
{
size_t const numPoints = roadInfo.m_points.size();

View file

@ -103,7 +103,9 @@ public:
{
public:
ICrossEdgesLoader(m2::PointD const & cross, bool onewayAsBidirectional, TEdgeVector & edges)
: m_cross(cross), m_onewayAsBidirectional(onewayAsBidirectional), m_edges(edges) {}
: m_cross(cross), m_onewayAsBidirectional(onewayAsBidirectional), m_edges(edges)
{
}
virtual ~ICrossEdgesLoader() = default;
void operator()(FeatureID const & featureId, RoadInfo const & roadInfo)
@ -124,7 +126,9 @@ public:
{
public:
CrossOutgoingLoader(m2::PointD const & cross, bool onewayAsBidirectional, TEdgeVector & edges)
: ICrossEdgesLoader(cross, onewayAsBidirectional, edges) {}
: ICrossEdgesLoader(cross, onewayAsBidirectional, edges)
{
}
// ICrossEdgesLoader overrides:
virtual void LoadEdge(FeatureID const & featureId, RoadInfo const & roadInfo) override;
@ -134,7 +138,9 @@ public:
{
public:
CrossIngoingLoader(m2::PointD const & cross, bool onewayAsBidirectional, TEdgeVector & edges)
: ICrossEdgesLoader(cross, onewayAsBidirectional, edges) {}
: ICrossEdgesLoader(cross, onewayAsBidirectional, edges)
{
}
// ICrossEdgesLoader overrides:
virtual void LoadEdge(FeatureID const & featureId, RoadInfo const & roadInfo) override;
};

View file

@ -131,17 +131,17 @@ void FindClosestEdges(IRoadGraph const & graph, m2::PointD const & point,
RoadGraphRouter::~RoadGraphRouter() {}
RoadGraphRouter::RoadGraphRouter(string const & name, Index const & index,
TCountryFileFn const & countryFileFn,
bool onewayAsBidirectional,
TCountryFileFn const & countryFileFn, bool onewayAsBidirectional,
unique_ptr<IVehicleModelFactory> && vehicleModelFactory,
unique_ptr<IRoutingAlgorithm> && algorithm,
unique_ptr<IDirectionsEngine> && directionsEngine)
: m_name(name)
, m_countryFileFn(countryFileFn)
, m_index(index)
, m_algorithm(move(algorithm))
, m_roadGraph(make_unique<FeaturesRoadGraph>(index, onewayAsBidirectional, move(vehicleModelFactory)))
, m_directionsEngine(move(directionsEngine))
: m_name(name)
, m_countryFileFn(countryFileFn)
, m_index(index)
, m_algorithm(move(algorithm))
, m_roadGraph(
make_unique<FeaturesRoadGraph>(index, onewayAsBidirectional, move(vehicleModelFactory)))
, m_directionsEngine(move(directionsEngine))
{
}
@ -259,10 +259,9 @@ unique_ptr<IRouter> CreatePedestrianAStarRouter(Index & index, TCountryFileFn co
unique_ptr<IVehicleModelFactory> vehicleModelFactory(new PedestrianModelFactory());
unique_ptr<IRoutingAlgorithm> algorithm(new AStarRoutingAlgorithm());
unique_ptr<IDirectionsEngine> directionsEngine(new PedestrianDirectionsEngine());
unique_ptr<IRouter> router(new RoadGraphRouter("astar-pedestrian", index, countryFileFn,
true /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm),
move(directionsEngine)));
unique_ptr<IRouter> router(new RoadGraphRouter(
"astar-pedestrian", index, countryFileFn, true /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm), move(directionsEngine)));
return router;
}
@ -271,10 +270,9 @@ unique_ptr<IRouter> CreatePedestrianAStarBidirectionalRouter(Index & index, TCou
unique_ptr<IVehicleModelFactory> vehicleModelFactory(new PedestrianModelFactory());
unique_ptr<IRoutingAlgorithm> algorithm(new AStarBidirectionalRoutingAlgorithm());
unique_ptr<IDirectionsEngine> directionsEngine(new PedestrianDirectionsEngine());
unique_ptr<IRouter> router(new RoadGraphRouter("astar-bidirectional-pedestrian", index,
countryFileFn, true /* onewayAsBidirectional */,
move(vehicleModelFactory),
move(algorithm), move(directionsEngine)));
unique_ptr<IRouter> router(new RoadGraphRouter(
"astar-bidirectional-pedestrian", index, countryFileFn, true /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm), move(directionsEngine)));
return router;
}
@ -283,9 +281,9 @@ unique_ptr<IRouter> CreateBicycleAStarBidirectionalRouter(Index & index, TCountr
unique_ptr<IVehicleModelFactory> vehicleModelFactory(new BicycleModelFactory());
unique_ptr<IRoutingAlgorithm> algorithm(new AStarBidirectionalRoutingAlgorithm());
unique_ptr<IDirectionsEngine> directionsEngine(new BicycleDirectionsEngine(index));
unique_ptr<IRouter> router(new RoadGraphRouter("astar-bidirectional-bicycle", index, countryFileFn,
false /* onewayAsBidirectional */, move(vehicleModelFactory),
move(algorithm), move(directionsEngine)));
unique_ptr<IRouter> router(new RoadGraphRouter(
"astar-bidirectional-bicycle", index, countryFileFn, false /* onewayAsBidirectional */,
move(vehicleModelFactory), move(algorithm), move(directionsEngine)));
return router;
}
} // namespace routing

View file

@ -23,8 +23,7 @@ namespace routing
class RoadGraphRouter : public IRouter
{
public:
RoadGraphRouter(string const & name, Index const & index,
TCountryFileFn const & countryFileFn,
RoadGraphRouter(string const & name, Index const & index, TCountryFileFn const & countryFileFn,
bool onewayAsBidirectional,
unique_ptr<IVehicleModelFactory> && vehicleModelFactory,
unique_ptr<IRoutingAlgorithm> && algorithm,