More clang-tidy fixes

This commit is contained in:
Dan Paulat 2025-02-18 23:34:48 -06:00
parent a6ba312f6b
commit d3d9823459
3 changed files with 33 additions and 30 deletions

View file

@ -5,9 +5,7 @@
#include <memory>
#include <string>
namespace scwx
{
namespace awips
namespace scwx::awips
{
class TextProductFileImpl;
@ -24,16 +22,17 @@ public:
TextProductFile(TextProductFile&&) noexcept;
TextProductFile& operator=(TextProductFile&&) noexcept;
size_t message_count() const;
std::vector<std::shared_ptr<TextProductMessage>> messages() const;
std::shared_ptr<TextProductMessage> message(size_t i) const;
[[nodiscard]] std::size_t message_count() const;
[[nodiscard]] std::vector<std::shared_ptr<TextProductMessage>>
messages() const;
[[nodiscard]] std::shared_ptr<TextProductMessage> message(size_t i) const;
bool LoadFile(const std::string& filename);
bool LoadData(std::string_view filename, std::istream& is);
private:
std::unique_ptr<TextProductFileImpl> p;
class Impl;
std::unique_ptr<Impl> p;
};
} // namespace awips
} // namespace scwx
} // namespace scwx::awips

View file

@ -34,15 +34,15 @@ public:
bool operator==(const WmoHeader& o) const;
std::string sequence_number() const;
std::string data_type() const;
std::string geographic_designator() const;
std::string bulletin_id() const;
std::string icao() const;
std::string date_time() const;
std::string bbb_indicator() const;
std::string product_category() const;
std::string product_designator() const;
[[nodiscard]] std::string sequence_number() const;
[[nodiscard]] std::string data_type() const;
[[nodiscard]] std::string geographic_designator() const;
[[nodiscard]] std::string bulletin_id() const;
[[nodiscard]] std::string icao() const;
[[nodiscard]] std::string date_time() const;
[[nodiscard]] std::string bbb_indicator() const;
[[nodiscard]] std::string product_category() const;
[[nodiscard]] std::string product_designator() const;
/**
* @brief Get the WMO date/time
@ -54,7 +54,7 @@ public:
* @param [in] endTimeHint The optional end time bounds to provide. This is
* ignored if a date hint has been provided to determine an absolute date.
*/
std::chrono::sys_time<std::chrono::minutes> GetDateTime(
[[nodiscard]] std::chrono::sys_time<std::chrono::minutes> GetDateTime(
std::optional<std::chrono::system_clock::time_point> endTimeHint =
std::nullopt);
@ -68,7 +68,7 @@ public:
/**
* @brief Provide a date hint for the WMO parser
*
* The WMO header contains a date/time in the format DDMMSS. The year and
* The WMO header contains a date/time in the format DDHHMM. The year and
* month must be derived using another source. The date hint provides the
* additional context required to determine the absolute product time.
*

View file

@ -5,24 +5,29 @@
#include <re2/re2.h>
namespace scwx
{
namespace awips
namespace scwx::awips
{
static const std::string logPrefix_ = "scwx::awips::text_product_file";
static const auto logger_ = util::Logger::Create(logPrefix_);
class TextProductFileImpl
class TextProductFile::Impl
{
public:
explicit TextProductFileImpl() : messages_ {} {};
~TextProductFileImpl() = default;
explicit Impl() : messages_ {} {};
~Impl() = default;
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
Impl(Impl&&) = delete;
Impl& operator=(Impl&&) = delete;
std::vector<std::shared_ptr<TextProductMessage>> messages_;
};
TextProductFile::TextProductFile() : p(std::make_unique<TextProductFileImpl>())
TextProductFile::TextProductFile() :
p(std::make_unique<TextProductFile::Impl>())
{
}
TextProductFile::~TextProductFile() = default;
@ -97,7 +102,7 @@ bool TextProductFile::LoadData(std::string_view filename, std::istream& is)
if (message != nullptr)
{
for (auto m : p->messages_)
for (const auto& m : p->messages_)
{
if (*m->wmo_header().get() == *message->wmo_header().get())
{
@ -125,5 +130,4 @@ bool TextProductFile::LoadData(std::string_view filename, std::istream& is)
return !p->messages_.empty();
}
} // namespace awips
} // namespace scwx
} // namespace scwx::awips