mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:00:08 +00:00
WMO header clang-tidy fixes
This commit is contained in:
parent
8646c3da6d
commit
b60318c393
2 changed files with 12 additions and 13 deletions
|
|
@ -4,9 +4,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::awips
|
||||||
{
|
|
||||||
namespace awips
|
|
||||||
{
|
{
|
||||||
|
|
||||||
class WmoHeaderImpl;
|
class WmoHeaderImpl;
|
||||||
|
|
@ -85,5 +83,4 @@ private:
|
||||||
std::unique_ptr<WmoHeaderImpl> p;
|
std::unique_ptr<WmoHeaderImpl> p;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace awips
|
} // namespace scwx::awips
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,11 @@ namespace scwx::awips
|
||||||
static const std::string logPrefix_ = "scwx::awips::wmo_header";
|
static const std::string logPrefix_ = "scwx::awips::wmo_header";
|
||||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
static constexpr std::size_t kWmoHeaderMinLineLength_ = 18;
|
static constexpr std::size_t kWmoHeaderMinLineLength_ = 18;
|
||||||
|
static constexpr std::size_t kWmoIdentifierLength_ = 6;
|
||||||
|
static constexpr std::size_t kIcaoLength_ = 4;
|
||||||
|
static constexpr std::size_t kDateTimeLength_ = 6;
|
||||||
|
static constexpr std::size_t kAwipsIdentifierLineLength_ = 6;
|
||||||
|
|
||||||
class WmoHeaderImpl
|
class WmoHeaderImpl
|
||||||
{
|
{
|
||||||
|
|
@ -166,14 +170,12 @@ std::chrono::sys_time<std::chrono::minutes> WmoHeader::GetDateTime(
|
||||||
// If the begin date is after the end date, assume the start time
|
// If the begin date is after the end date, assume the start time
|
||||||
// was the previous month (give a 1 day grace period for expiring
|
// was the previous month (give a 1 day grace period for expiring
|
||||||
// events in the past)
|
// events in the past)
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
|
||||||
if (wmoDateTime > endTimeHint.value() + 24h)
|
if (wmoDateTime > endTimeHint.value() + 24h)
|
||||||
{
|
{
|
||||||
// If the current end month is January
|
// If the current end month is January
|
||||||
if (endDate.month() == January)
|
if (endDate.month() == January)
|
||||||
{
|
{
|
||||||
year_month x = year {2024} / December;
|
|
||||||
sys_days y;
|
|
||||||
|
|
||||||
// The begin month must be December of last year
|
// The begin month must be December of last year
|
||||||
wmoDateTime =
|
wmoDateTime =
|
||||||
sys_days {
|
sys_days {
|
||||||
|
|
@ -269,17 +271,17 @@ bool WmoHeader::Parse(std::istream& is)
|
||||||
logger_->warn("Invalid number of WMO tokens");
|
logger_->warn("Invalid number of WMO tokens");
|
||||||
headerValid = false;
|
headerValid = false;
|
||||||
}
|
}
|
||||||
else if (wmoTokenList[0].size() != 6)
|
else if (wmoTokenList[0].size() != kWmoIdentifierLength_)
|
||||||
{
|
{
|
||||||
logger_->warn("WMO identifier malformed");
|
logger_->warn("WMO identifier malformed");
|
||||||
headerValid = false;
|
headerValid = false;
|
||||||
}
|
}
|
||||||
else if (wmoTokenList[1].size() != 4)
|
else if (wmoTokenList[1].size() != kIcaoLength_)
|
||||||
{
|
{
|
||||||
logger_->warn("ICAO malformed");
|
logger_->warn("ICAO malformed");
|
||||||
headerValid = false;
|
headerValid = false;
|
||||||
}
|
}
|
||||||
else if (wmoTokenList[2].size() != 6)
|
else if (wmoTokenList[2].size() != kDateTimeLength_)
|
||||||
{
|
{
|
||||||
logger_->warn("Date/time malformed");
|
logger_->warn("Date/time malformed");
|
||||||
headerValid = false;
|
headerValid = false;
|
||||||
|
|
@ -316,7 +318,7 @@ bool WmoHeader::Parse(std::istream& is)
|
||||||
|
|
||||||
if (headerValid)
|
if (headerValid)
|
||||||
{
|
{
|
||||||
if (awipsLine.size() != 6)
|
if (awipsLine.size() != kAwipsIdentifierLineLength_)
|
||||||
{
|
{
|
||||||
logger_->warn("AWIPS Identifier Line bad size");
|
logger_->warn("AWIPS Identifier Line bad size");
|
||||||
headerValid = false;
|
headerValid = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue