mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 13:20:04 +00:00
More clang-tidy fixes
This commit is contained in:
parent
a6ba312f6b
commit
d3d9823459
3 changed files with 33 additions and 30 deletions
|
|
@ -5,9 +5,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::awips
|
||||||
{
|
|
||||||
namespace awips
|
|
||||||
{
|
{
|
||||||
|
|
||||||
class TextProductFileImpl;
|
class TextProductFileImpl;
|
||||||
|
|
@ -24,16 +22,17 @@ public:
|
||||||
TextProductFile(TextProductFile&&) noexcept;
|
TextProductFile(TextProductFile&&) noexcept;
|
||||||
TextProductFile& operator=(TextProductFile&&) noexcept;
|
TextProductFile& operator=(TextProductFile&&) noexcept;
|
||||||
|
|
||||||
size_t message_count() const;
|
[[nodiscard]] std::size_t message_count() const;
|
||||||
std::vector<std::shared_ptr<TextProductMessage>> messages() const;
|
[[nodiscard]] std::vector<std::shared_ptr<TextProductMessage>>
|
||||||
std::shared_ptr<TextProductMessage> message(size_t i) const;
|
messages() const;
|
||||||
|
[[nodiscard]] std::shared_ptr<TextProductMessage> message(size_t i) const;
|
||||||
|
|
||||||
bool LoadFile(const std::string& filename);
|
bool LoadFile(const std::string& filename);
|
||||||
bool LoadData(std::string_view filename, std::istream& is);
|
bool LoadData(std::string_view filename, std::istream& is);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<TextProductFileImpl> p;
|
class Impl;
|
||||||
|
std::unique_ptr<Impl> p;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace awips
|
} // namespace scwx::awips
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,15 @@ public:
|
||||||
|
|
||||||
bool operator==(const WmoHeader& o) const;
|
bool operator==(const WmoHeader& o) const;
|
||||||
|
|
||||||
std::string sequence_number() const;
|
[[nodiscard]] std::string sequence_number() const;
|
||||||
std::string data_type() const;
|
[[nodiscard]] std::string data_type() const;
|
||||||
std::string geographic_designator() const;
|
[[nodiscard]] std::string geographic_designator() const;
|
||||||
std::string bulletin_id() const;
|
[[nodiscard]] std::string bulletin_id() const;
|
||||||
std::string icao() const;
|
[[nodiscard]] std::string icao() const;
|
||||||
std::string date_time() const;
|
[[nodiscard]] std::string date_time() const;
|
||||||
std::string bbb_indicator() const;
|
[[nodiscard]] std::string bbb_indicator() const;
|
||||||
std::string product_category() const;
|
[[nodiscard]] std::string product_category() const;
|
||||||
std::string product_designator() const;
|
[[nodiscard]] std::string product_designator() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the WMO date/time
|
* @brief Get the WMO date/time
|
||||||
|
|
@ -54,7 +54,7 @@ public:
|
||||||
* @param [in] endTimeHint The optional end time bounds to provide. This is
|
* @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.
|
* 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::optional<std::chrono::system_clock::time_point> endTimeHint =
|
||||||
std::nullopt);
|
std::nullopt);
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Provide a date hint for the WMO parser
|
* @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
|
* month must be derived using another source. The date hint provides the
|
||||||
* additional context required to determine the absolute product time.
|
* additional context required to determine the absolute product time.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,29 @@
|
||||||
|
|
||||||
#include <re2/re2.h>
|
#include <re2/re2.h>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::awips
|
||||||
{
|
|
||||||
namespace awips
|
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "scwx::awips::text_product_file";
|
static const std::string logPrefix_ = "scwx::awips::text_product_file";
|
||||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
class TextProductFileImpl
|
class TextProductFile::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TextProductFileImpl() : messages_ {} {};
|
explicit Impl() : messages_ {} {};
|
||||||
~TextProductFileImpl() = default;
|
~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_;
|
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;
|
TextProductFile::~TextProductFile() = default;
|
||||||
|
|
@ -97,7 +102,7 @@ bool TextProductFile::LoadData(std::string_view filename, std::istream& is)
|
||||||
|
|
||||||
if (message != nullptr)
|
if (message != nullptr)
|
||||||
{
|
{
|
||||||
for (auto m : p->messages_)
|
for (const auto& m : p->messages_)
|
||||||
{
|
{
|
||||||
if (*m->wmo_header().get() == *message->wmo_header().get())
|
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();
|
return !p->messages_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace awips
|
} // namespace scwx::awips
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue