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

@@ -39,9 +39,7 @@ bool IsEqual(m2::PointD const & p1, m2::PointD const & p2)
bool IsEqual(m2::RectD const & r1, m2::RectD const & r2)
{
return (IsEqual(r1.minX(), r2.minX()) &&
IsEqual(r1.minY(), r2.minY()) &&
IsEqual(r1.maxX(), r2.maxX()) &&
return (IsEqual(r1.minX(), r2.minX()) && IsEqual(r1.minY(), r2.minY()) && IsEqual(r1.maxX(), r2.maxX()) &&
IsEqual(r1.maxY(), r2.maxY()));
}
@@ -52,10 +50,7 @@ bool IsEqual(std::vector<m2::PointD> const & v1, std::vector<m2::PointD> const &
}
} // namespace
FeatureBuilder::FeatureBuilder()
: m_coastCell(-1)
{
}
FeatureBuilder::FeatureBuilder() : m_coastCell(-1) {}
bool FeatureBuilder::IsGeometryClosed() const
{
@@ -76,14 +71,10 @@ m2::PointD FeatureBuilder::GetKeyPoint() const
{
switch (GetGeomType())
{
case GeomType::Point:
return m_center;
case GeomType::Point: return m_center;
case GeomType::Line:
case GeomType::Area:
return GetGeometryCenter();
default:
CHECK(false, ());
return m2::PointD();
case GeomType::Area: return GetGeometryCenter();
default: CHECK(false, ()); return m2::PointD();
}
}
@@ -128,7 +119,7 @@ void FeatureBuilder::AssignArea(PointSeq && outline, Geometry const & holes)
for (PointSeq const & points : holes)
{
ASSERT ( !points.empty(), (*this) );
ASSERT(!points.empty(), (*this));
size_t j = 0;
size_t const count = points.size();
@@ -222,10 +213,8 @@ bool FeatureBuilder::PreSerialize()
auto const & types = GetTypes();
if (ftypes::IsMotorwayJunctionChecker::Instance()(types) ||
(m_params.name.IsEmpty() &&
(ftypes::IsPostPoiChecker::Instance()(types) ||
ftypes::IsRailwaySubwayEntranceChecker::Instance()(types) ||
ftypes::IsEntranceChecker::Instance()(types) ||
ftypes::IsAerowayGateChecker::Instance()(types) ||
(ftypes::IsPostPoiChecker::Instance()(types) || ftypes::IsRailwaySubwayEntranceChecker::Instance()(types) ||
ftypes::IsEntranceChecker::Instance()(types) || ftypes::IsAerowayGateChecker::Instance()(types) ||
ftypes::IsPlatformChecker::Instance()(types))))
{
m_params.name.AddString(StringUtf8Multilang::kDefaultCode, m_params.ref);
@@ -253,11 +242,8 @@ bool FeatureBuilder::PreSerialize()
if (!m_params.ref.empty())
{
auto const & types = GetTypes();
if (m_params.name.IsEmpty() &&
(ftypes::IsPlatformChecker::Instance()(types)))
{
if (m_params.name.IsEmpty() && (ftypes::IsPlatformChecker::Instance()(types)))
m_params.name.AddString(StringUtf8Multilang::kDefaultCode, m_params.ref);
}
m_params.ref.clear();
}
@@ -265,8 +251,7 @@ bool FeatureBuilder::PreSerialize()
m_params.rank = 0;
break;
default:
return false;
default: return false;
}
// Stats shows that 1706197 POIs out of 2258011 have name == brand.
@@ -298,7 +283,7 @@ bool FeatureBuilder::PreSerializeAndRemoveUselessNamesForIntermediate()
// Clear name for features with invisible texts.
// AlexZ: Commented this line to enable captions on subway exits, which
// are not drawn but should be visible in balloons and search results
//RemoveNameIfInvisible();
// RemoveNameIfInvisible();
RemoveUselessNames();
return true;
@@ -312,7 +297,7 @@ void FeatureBuilder::RemoveUselessNames()
// AFAIR, they were very messy in search because they contain places' names.
auto const typeRemover = [](uint32_t type)
{
static TypeSetChecker const checkBoundary({ "boundary", "administrative" });
static TypeSetChecker const checkBoundary({"boundary", "administrative"});
return checkBoundary.IsEqual(type);
};
@@ -367,10 +352,8 @@ bool FeatureBuilder::operator==(FeatureBuilder const & fb) const
return false;
for (auto i = m_polygons.cbegin(), j = fb.m_polygons.cbegin(); i != m_polygons.cend(); ++i, ++j)
{
if (!IsEqual(*i, *j))
return false;
}
return true;
}
@@ -380,8 +363,8 @@ bool FeatureBuilder::IsExactEq(FeatureBuilder const & fb) const
if (m_params.GetGeomType() == GeomType::Point && m_center != fb.m_center)
return false;
return (m_polygons == fb.m_polygons && m_limitRect == fb.m_limitRect &&
m_osmIds == fb.m_osmIds && m_params == fb.m_params && m_coastCell == fb.m_coastCell);
return (m_polygons == fb.m_polygons && m_limitRect == fb.m_limitRect && m_osmIds == fb.m_osmIds &&
m_params == fb.m_params && m_coastCell == fb.m_coastCell);
}
void FeatureBuilder::SerializeForIntermediate(Buffer & data) const
@@ -485,7 +468,7 @@ void FeatureBuilder::SerializeAccuratelyForIntermediate(Buffer & data) const
Buffer tmp(data);
FeatureBuilder fb;
fb.DeserializeAccuratelyFromIntermediate(tmp);
ASSERT ( fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb) );
ASSERT(fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb));
#endif
}
@@ -522,9 +505,15 @@ void FeatureBuilder::DeserializeAccuratelyFromIntermediate(Buffer & data)
CHECK(IsValid(), (*this));
}
void FeatureBuilder::AddOsmId(base::GeoObjectId id) { m_osmIds.push_back(id); }
void FeatureBuilder::AddOsmId(base::GeoObjectId id)
{
m_osmIds.push_back(id);
}
void FeatureBuilder::SetOsmId(base::GeoObjectId id) { m_osmIds.assign(1, id); }
void FeatureBuilder::SetOsmId(base::GeoObjectId id)
{
m_osmIds.assign(1, id);
}
base::GeoObjectId FeatureBuilder::GetFirstOsmId() const
{
@@ -597,10 +586,8 @@ bool FeatureBuilder::IsDrawableInRange(int lowScale, int highScale) const
{
auto const types = GetTypesHolder();
while (lowScale <= highScale)
{
if (IsDrawableForIndex(types, m_limitRect, lowScale++))
return true;
}
return false;
}
@@ -636,8 +623,7 @@ bool FeatureBuilder::PreSerializeAndRemoveUselessNamesForMwm(SupportingData cons
return true;
}
void FeatureBuilder::SerializeForMwm(SupportingData & data,
serial::GeometryCodingParams const & params) const
void FeatureBuilder::SerializeForMwm(SupportingData & data, serial::GeometryCodingParams const & params) const
{
data.m_buffer.clear();
@@ -654,7 +640,7 @@ void FeatureBuilder::SerializeForMwm(SupportingData & data,
uint8_t trgCount = base::asserted_cast<uint8_t>(data.m_innerTrg.size());
if (trgCount > 0)
{
ASSERT_GREATER ( trgCount, 2, () );
ASSERT_GREATER(trgCount, 2, ());
trgCount -= 2;
}
@@ -735,10 +721,8 @@ bool FeatureBuilder::IsValid() const
return false;
for (auto const & points : geom)
{
if (points.size() < 3)
return false;
}
}
return true;
@@ -756,9 +740,8 @@ std::string DebugPrint(FeatureBuilder const & fb)
default: out << "ERROR: unknown geometry type"; break;
}
out << " " << DebugPrint(mercator::ToLatLon(fb.GetLimitRect()))
<< " " << DebugPrint(fb.GetParams())
<< " " << fb.DebugPrintIDs();
out << " " << DebugPrint(mercator::ToLatLon(fb.GetLimitRect())) << " " << DebugPrint(fb.GetParams()) << " "
<< fb.DebugPrintIDs();
return out.str();
}