diff --git a/wxdata/include/scwx/awips/text_product_file.hpp b/wxdata/include/scwx/awips/text_product_file.hpp index 80eda9c8..ce164f20 100644 --- a/wxdata/include/scwx/awips/text_product_file.hpp +++ b/wxdata/include/scwx/awips/text_product_file.hpp @@ -5,9 +5,7 @@ #include #include -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> messages() const; - std::shared_ptr message(size_t i) const; + [[nodiscard]] std::size_t message_count() const; + [[nodiscard]] std::vector> + messages() const; + [[nodiscard]] std::shared_ptr message(size_t i) const; bool LoadFile(const std::string& filename); bool LoadData(std::string_view filename, std::istream& is); private: - std::unique_ptr p; + class Impl; + std::unique_ptr p; }; -} // namespace awips -} // namespace scwx +} // namespace scwx::awips diff --git a/wxdata/include/scwx/awips/wmo_header.hpp b/wxdata/include/scwx/awips/wmo_header.hpp index 6ca63709..f3e24faf 100644 --- a/wxdata/include/scwx/awips/wmo_header.hpp +++ b/wxdata/include/scwx/awips/wmo_header.hpp @@ -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 GetDateTime( + [[nodiscard]] std::chrono::sys_time GetDateTime( std::optional 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. * diff --git a/wxdata/source/scwx/awips/text_product_file.cpp b/wxdata/source/scwx/awips/text_product_file.cpp index cd23516c..9b7dcdb0 100644 --- a/wxdata/source/scwx/awips/text_product_file.cpp +++ b/wxdata/source/scwx/awips/text_product_file.cpp @@ -5,24 +5,29 @@ #include -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> messages_; }; -TextProductFile::TextProductFile() : p(std::make_unique()) +TextProductFile::TextProductFile() : + p(std::make_unique()) { } 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