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

@@ -10,7 +10,7 @@
namespace
{
using osmoh::operator ""_h;
using osmoh::operator""_h;
osmoh::Timespan const kTwentyFourHours = {0_h, 24_h};
@@ -50,7 +50,8 @@ void SetUpTimeTable(osmoh::TTimespans spans, editor::ui::TimeTable & tt)
for (auto & span : spans)
span.ExpandPlus();
std::sort(std::begin(spans), std::end(spans), [](Timespan const & a, Timespan const & b) {
std::sort(std::begin(spans), std::end(spans), [](Timespan const & a, Timespan const & b)
{
auto const start1 = a.GetStart().GetHourMinutes().GetDuration();
auto const start2 = b.GetStart().GetHourMinutes().GetDuration();
@@ -66,7 +67,10 @@ void SetUpTimeTable(osmoh::TTimespans spans, editor::ui::TimeTable & tt)
tt.AddExcludeTime({spans[i].GetEnd(), spans[i + 1].GetStart()});
}
int32_t WeekdayNumber(osmoh::Weekday const wd) { return static_cast<int32_t>(wd); }
int32_t WeekdayNumber(osmoh::Weekday const wd)
{
return static_cast<int32_t>(wd);
}
constexpr uint32_t kDaysInWeek = 7;
@@ -88,15 +92,12 @@ int32_t NextWeekdayNumber(osmoh::Weekday const wd)
std::vector<osmoh::Weekday> RemoveInversion(editor::ui::OpeningDays const & days)
{
std::vector<osmoh::Weekday> result(begin(days), end(days));
if ((NextWeekdayNumber(result.back()) != WeekdayNumber(result.front()) &&
result.back() != osmoh::Weekday::Sunday) || result.size() < 2)
if ((NextWeekdayNumber(result.back()) != WeekdayNumber(result.front()) && result.back() != osmoh::Weekday::Sunday) ||
result.size() < 2)
return result;
auto inversion = adjacent_find(begin(result), end(result),
[](osmoh::Weekday const a, osmoh::Weekday const b)
{
return NextWeekdayNumber(a) != WeekdayNumber(b);
});
auto inversion = adjacent_find(begin(result), end(result), [](osmoh::Weekday const a, osmoh::Weekday const b)
{ return NextWeekdayNumber(a) != WeekdayNumber(b); });
if (inversion != end(result))
rotate(begin(result), ++inversion, end(result));
@@ -167,17 +168,10 @@ osmoh::TTimespans MakeTimespans(editor::ui::TimeTable const & tt)
}
editor::ui::OpeningDays const kWholeWeek = {
osmoh::Weekday::Monday,
osmoh::Weekday::Tuesday,
osmoh::Weekday::Wednesday,
osmoh::Weekday::Thursday,
osmoh::Weekday::Friday,
osmoh::Weekday::Saturday,
osmoh::Weekday::Sunday
};
osmoh::Weekday::Monday, osmoh::Weekday::Tuesday, osmoh::Weekday::Wednesday, osmoh::Weekday::Thursday,
osmoh::Weekday::Friday, osmoh::Weekday::Saturday, osmoh::Weekday::Sunday};
editor::ui::OpeningDays GetCommonDays(editor::ui::OpeningDays const & a,
editor::ui::OpeningDays const & b)
editor::ui::OpeningDays GetCommonDays(editor::ui::OpeningDays const & a, editor::ui::OpeningDays const & b)
{
editor::ui::OpeningDays result;
std::set_intersection(begin(a), end(a), begin(b), end(b), inserter(result, begin(result)));
@@ -191,8 +185,7 @@ osmoh::HourMinutes::TMinutes::rep GetDuration(osmoh::Time const & time)
bool Includes(osmoh::Timespan const & a, osmoh::Timespan const & b)
{
return GetDuration(a.GetStart()) <= GetDuration(b.GetStart()) &&
GetDuration(b.GetEnd()) <= GetDuration(a.GetEnd());
return GetDuration(a.GetStart()) <= GetDuration(b.GetStart()) && GetDuration(b.GetEnd()) <= GetDuration(a.GetEnd());
}
bool ExcludeRulePart(osmoh::RuleSequence const & rulePart, editor::ui::TimeTableSet & tts)
@@ -202,8 +195,7 @@ bool ExcludeRulePart(osmoh::RuleSequence const & rulePart, editor::ui::TimeTable
{
auto tt = tts.Get(i);
auto const ttOpeningDays = tt.GetOpeningDays();
auto const commonDays = GetCommonDays(ttOpeningDays,
MakeOpeningDays(rulePart.GetWeekdays()));
auto const commonDays = GetCommonDays(ttOpeningDays, MakeOpeningDays(rulePart.GetWeekdays()));
auto const removeCommonDays = [&commonDays](editor::ui::TimeTableSet::Proxy & tt)
{
@@ -356,8 +348,7 @@ bool MakeTimeTableSet(osmoh::OpeningHours const & oh, ui::TimeTableSet & tts)
auto const & times = rulePart.GetTimes();
bool isTwentyFourHours =
times.empty() || (times.size() == 1 && times.front() == kTwentyFourHours);
bool isTwentyFourHours = times.empty() || (times.size() == 1 && times.front() == kTwentyFourHours);
if (isTwentyFourHours)
{
@@ -386,4 +377,4 @@ bool MakeTimeTableSet(osmoh::OpeningHours const & oh, ui::TimeTableSet & tts)
return true;
}
} // namespace editor
} // namespace editor