clang-tidy fixes

This commit is contained in:
Dan Paulat 2025-05-03 09:27:58 -05:00
parent 228ec191f6
commit 4719badc54
2 changed files with 17 additions and 14 deletions

View file

@ -27,11 +27,7 @@
# include <date/date.h>
#endif
namespace scwx
{
namespace qt
{
namespace manager
namespace scwx::qt::manager
{
using namespace std::chrono_literals;
@ -115,6 +111,11 @@ public:
threadPool_.join();
}
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
Impl(const Impl&&) = delete;
Impl& operator=(const Impl&&) = delete;
void
HandleMessage(const std::shared_ptr<awips::TextProductMessage>& message);
template<ranges::forward_range DateRange>
@ -298,9 +299,10 @@ void TextEventManager::Impl::HandleMessage(
}
// Determine year
std::chrono::year_month_day wmoDate = std::chrono::floor<std::chrono::days>(
message->wmo_header()->GetDateTime());
std::chrono::year wmoYear = wmoDate.year();
const std::chrono::year_month_day wmoDate =
std::chrono::floor<std::chrono::days>(
message->wmo_header()->GetDateTime());
const std::chrono::year wmoYear = wmoDate.year();
std::unique_lock lock(textEventMutex_);
@ -319,6 +321,7 @@ void TextEventManager::Impl::HandleMessage(
// The message was on January 1
wmoDate.month() == std::chrono::January && wmoDate.day() == 1d &&
// This is at least the 10th ETN of the year
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers): Readability
vtecString[0].pVtec_.event_tracking_number() > 10)
{
// Attempt to find a matching event from last year
@ -635,6 +638,4 @@ std::shared_ptr<TextEventManager> TextEventManager::Instance()
return textEventManager;
}
} // namespace manager
} // namespace qt
} // namespace scwx
} // namespace scwx::qt::manager

View file

@ -21,14 +21,16 @@ struct TextEventKey
{
using namespace std::chrono_literals;
static constexpr std::chrono::year kMinYear_ = 1970y;
std::chrono::year_month_day ymd =
std::chrono::floor<std::chrono::days>(pvtec.event_begin());
if (ymd.year() > 1970y)
if (ymd.year() > kMinYear_)
{
// Prefer the year from the event begin
year_ = ymd.year();
}
else if (yearHint > 1970y)
else if (yearHint > kMinYear_)
{
// Otherwise, use the year hint
year_ = yearHint;
@ -49,7 +51,7 @@ struct TextEventKey
awips::Phenomenon phenomenon_;
awips::Significance significance_;
std::int16_t etn_;
std::chrono::year year_;
std::chrono::year year_ {};
};
template<class Key>