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

View file

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