Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -19,8 +19,7 @@ AsyncRouter::RouterDelegateProxy::RouterDelegateProxy(ReadyCallbackOwnership con
NeedMoreMapsCallback const & onNeedMoreMaps,
RemoveRouteCallback const & onRemoveRoute,
PointCheckCallback const & onPointCheck,
ProgressCallback const & onProgress,
uint32_t timeoutSec)
ProgressCallback const & onProgress, uint32_t timeoutSec)
: m_onReadyOwnership(onReady)
, m_onNeedMoreMaps(onNeedMoreMaps)
, m_onRemoveRoute(onRemoveRoute)
@@ -45,8 +44,7 @@ void AsyncRouter::RouterDelegateProxy::OnReady(std::shared_ptr<Route> route, Rou
m_onReadyOwnership(std::move(route), resultCode);
}
void AsyncRouter::RouterDelegateProxy::OnNeedMoreMaps(uint64_t routeId,
std::set<std::string> const & absentCounties)
void AsyncRouter::RouterDelegateProxy::OnNeedMoreMaps(uint64_t routeId, std::set<std::string> const & absentCounties)
{
if (!m_onNeedMoreMaps)
return;
@@ -76,8 +74,7 @@ void AsyncRouter::RouterDelegateProxy::Cancel()
m_delegate.Cancel();
}
bool AsyncRouter::FindClosestProjectionToRoad(m2::PointD const & point,
m2::PointD const & direction, double radius,
bool AsyncRouter::FindClosestProjectionToRoad(m2::PointD const & point, m2::PointD const & direction, double radius,
EdgeProj & proj)
{
return m_router->FindClosestProjectionToRoad(point, direction, radius, proj);
@@ -96,9 +93,7 @@ void AsyncRouter::RouterDelegateProxy::OnProgress(float progress)
return;
onProgress = m_onProgress;
GetPlatform().RunTask(Platform::Thread::Gui, [onProgress, progress]() {
onProgress(progress);
});
GetPlatform().RunTask(Platform::Thread::Gui, [onProgress, progress]() { onProgress(progress); });
}
}
@@ -149,8 +144,7 @@ AsyncRouter::~AsyncRouter()
m_thread.join();
}
void AsyncRouter::SetRouter(std::unique_ptr<IRouter> && router,
std::unique_ptr<AbsentRegionsFinder> && finder)
void AsyncRouter::SetRouter(std::unique_ptr<IRouter> && router, std::unique_ptr<AbsentRegionsFinder> && finder)
{
unique_lock ul(m_guard);
@@ -160,8 +154,7 @@ void AsyncRouter::SetRouter(std::unique_ptr<IRouter> && router,
m_absentRegionsFinder = std::move(finder);
}
void AsyncRouter::CalculateRoute(Checkpoints const & checkpoints, m2::PointD const & direction,
bool adjustToPrevRoute,
void AsyncRouter::CalculateRoute(Checkpoints const & checkpoints, m2::PointD const & direction, bool adjustToPrevRoute,
ReadyCallbackOwnership const & readyCallback,
NeedMoreMapsCallback const & needMoreMapsCallback,
RemoveRouteCallback const & removeRouteCallback,
@@ -175,9 +168,8 @@ void AsyncRouter::CalculateRoute(Checkpoints const & checkpoints, m2::PointD con
ResetDelegate();
m_delegateProxy =
std::make_shared<RouterDelegateProxy>(readyCallback, needMoreMapsCallback, removeRouteCallback,
m_pointCheckCallback, progressCallback, timeoutSec);
m_delegateProxy = std::make_shared<RouterDelegateProxy>(readyCallback, needMoreMapsCallback, removeRouteCallback,
m_pointCheckCallback, progressCallback, timeoutSec);
m_hasRequest = true;
m_threadCondVar.notify_one();
@@ -204,59 +196,32 @@ void AsyncRouter::LogCode(RouterResultCode code, double const elapsedSec)
{
switch (code)
{
case RouterResultCode::StartPointNotFound:
LOG(LWARNING, ("Can't find start or end node"));
break;
case RouterResultCode::EndPointNotFound:
LOG(LWARNING, ("Can't find end point node"));
break;
case RouterResultCode::PointsInDifferentMWM:
LOG(LWARNING, ("Points are in different MWMs"));
break;
case RouterResultCode::RouteNotFound:
LOG(LWARNING, ("Route not found"));
break;
case RouterResultCode::RouteFileNotExist:
LOG(LWARNING, ("There is no routing file"));
break;
case RouterResultCode::NeedMoreMaps:
LOG(LINFO,
("Routing can find a better way with additional maps, elapsed seconds:", elapsedSec));
break;
case RouterResultCode::Cancelled:
LOG(LINFO, ("Route calculation cancelled, elapsed seconds:", elapsedSec));
break;
case RouterResultCode::NoError:
LOG(LINFO, ("Route found, elapsed seconds:", elapsedSec));
break;
case RouterResultCode::NoCurrentPosition:
LOG(LINFO, ("No current position"));
break;
case RouterResultCode::InconsistentMWMandRoute:
LOG(LINFO, ("Inconsistent mwm and route"));
break;
case RouterResultCode::InternalError:
LOG(LINFO, ("Internal error"));
break;
case RouterResultCode::FileTooOld:
LOG(LINFO, ("File too old"));
break;
case RouterResultCode::IntermediatePointNotFound:
LOG(LWARNING, ("Can't find intermediate point node"));
break;
case RouterResultCode::TransitRouteNotFoundNoNetwork:
LOG(LWARNING, ("No transit route is found because there's no transit network in the mwm of "
"the route point"));
break;
case RouterResultCode::TransitRouteNotFoundTooLongPedestrian:
LOG(LWARNING, ("No transit route is found because pedestrian way is too long"));
break;
case RouterResultCode::RouteNotFoundRedressRouteError:
LOG(LWARNING, ("Route not found because of a redress route error"));
break;
case RouterResultCode::HasWarnings:
LOG(LINFO, ("Route has warnings, elapsed seconds:", elapsedSec));
break;
case RouterResultCode::StartPointNotFound: LOG(LWARNING, ("Can't find start or end node")); break;
case RouterResultCode::EndPointNotFound: LOG(LWARNING, ("Can't find end point node")); break;
case RouterResultCode::PointsInDifferentMWM: LOG(LWARNING, ("Points are in different MWMs")); break;
case RouterResultCode::RouteNotFound: LOG(LWARNING, ("Route not found")); break;
case RouterResultCode::RouteFileNotExist: LOG(LWARNING, ("There is no routing file")); break;
case RouterResultCode::NeedMoreMaps:
LOG(LINFO, ("Routing can find a better way with additional maps, elapsed seconds:", elapsedSec));
break;
case RouterResultCode::Cancelled: LOG(LINFO, ("Route calculation cancelled, elapsed seconds:", elapsedSec)); break;
case RouterResultCode::NoError: LOG(LINFO, ("Route found, elapsed seconds:", elapsedSec)); break;
case RouterResultCode::NoCurrentPosition: LOG(LINFO, ("No current position")); break;
case RouterResultCode::InconsistentMWMandRoute: LOG(LINFO, ("Inconsistent mwm and route")); break;
case RouterResultCode::InternalError: LOG(LINFO, ("Internal error")); break;
case RouterResultCode::FileTooOld: LOG(LINFO, ("File too old")); break;
case RouterResultCode::IntermediatePointNotFound: LOG(LWARNING, ("Can't find intermediate point node")); break;
case RouterResultCode::TransitRouteNotFoundNoNetwork:
LOG(LWARNING, ("No transit route is found because there's no transit network in the mwm of "
"the route point"));
break;
case RouterResultCode::TransitRouteNotFoundTooLongPedestrian:
LOG(LWARNING, ("No transit route is found because pedestrian way is too long"));
break;
case RouterResultCode::RouteNotFoundRedressRouteError:
LOG(LWARNING, ("Route not found because of a redress route error"));
break;
case RouterResultCode::HasWarnings: LOG(LINFO, ("Route has warnings, elapsed seconds:", elapsedSec)); break;
}
}
@@ -275,7 +240,7 @@ void AsyncRouter::ThreadFunc()
{
{
unique_lock ul(m_guard);
m_threadCondVar.wait(ul, [this](){ return m_threadExit || m_hasRequest || m_clearState; });
m_threadCondVar.wait(ul, [this]() { return m_threadExit || m_hasRequest || m_clearState; });
if (m_clearState && m_router)
{
@@ -344,10 +309,9 @@ void AsyncRouter::CalculateRoute()
absentRegionsFinder->GenerateAbsentRegions(checkpoints, delegateProxy->GetDelegate());
// Run basic request.
code = router->CalculateRoute(checkpoints, startDirection, adjustToPrevRoute,
delegateProxy->GetDelegate(), *route);
code = router->CalculateRoute(checkpoints, startDirection, adjustToPrevRoute, delegateProxy->GetDelegate(), *route);
router->SetGuides({});
elapsedSec = timer.ElapsedSeconds(); // routing time
elapsedSec = timer.ElapsedSeconds(); // routing time
LogCode(code, elapsedSec);
LOG(LINFO, ("ETA:", route->GetTotalTimeSec(), "sec."));
}
@@ -371,8 +335,7 @@ void AsyncRouter::CalculateRoute()
[delegateProxy, route, code]() { delegateProxy->OnReady(route, code); });
}
bool const needAbsentRegions = (code != RouterResultCode::Cancelled &&
route->GetRouterId() != "ruler-router");
bool const needAbsentRegions = (code != RouterResultCode::Cancelled && route->GetRouterId() != "ruler-router");
std::set<std::string> absent;
if (needAbsentRegions)
@@ -388,7 +351,7 @@ void AsyncRouter::CalculateRoute()
}
}
elapsedSec = timer.ElapsedSeconds(); // routing time + absents fetch time
elapsedSec = timer.ElapsedSeconds(); // routing time + absents fetch time
LogCode(code, elapsedSec);
// Call callback only if we have some new data.
@@ -396,14 +359,12 @@ void AsyncRouter::CalculateRoute()
{
if (code == RouterResultCode::NeedMoreMaps)
{
GetPlatform().RunTask(Platform::Thread::Gui, [delegateProxy, routeId, absent]() {
delegateProxy->OnNeedMoreMaps(routeId, absent);
});
GetPlatform().RunTask(Platform::Thread::Gui,
[delegateProxy, routeId, absent]() { delegateProxy->OnNeedMoreMaps(routeId, absent); });
}
else
{
GetPlatform().RunTask(Platform::Thread::Gui,
[delegateProxy, code]() { delegateProxy->OnRemoveRoute(code); });
GetPlatform().RunTask(Platform::Thread::Gui, [delegateProxy, code]() { delegateProxy->OnRemoveRoute(code); });
}
}
}