From fdeb69800a83cfeec8aa8e06c9d8066ce0760436 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sat, 15 Apr 2023 14:55:37 -0500 Subject: [PATCH] App/Toponaming: Minor StringHasher cleanup from review --- src/App/StringHasher.cpp | 17 ----------------- src/App/StringHasher.h | 34 +++++++++++----------------------- 2 files changed, 11 insertions(+), 40 deletions(-) diff --git a/src/App/StringHasher.cpp b/src/App/StringHasher.cpp index 722823238e..d116bf0ab9 100644 --- a/src/App/StringHasher.cpp +++ b/src/App/StringHasher.cpp @@ -180,23 +180,6 @@ StringHasher::~StringHasher() clear(); } -StringHasher::StringHasher([[maybe_unused]] StringHasher&& other) noexcept -{ - // Private: unimplemented -} - -StringHasher& StringHasher::operator=([[maybe_unused]] StringHasher& other) -{ - // Private: unimplemented - return *this; -} - -StringHasher& StringHasher::operator=([[maybe_unused]] StringHasher&& other) noexcept -{ - // Private: unimplemented - return *this; -} - void StringHasher::setSaveAll(bool enable) { if (_hashes->SaveAll == enable) { diff --git a/src/App/StringHasher.h b/src/App/StringHasher.h index 5811478993..7c8f4f5dcf 100644 --- a/src/App/StringHasher.h +++ b/src/App/StringHasher.h @@ -128,6 +128,11 @@ public: _flags(Flag::None) {} + StringID(const StringID& other) = delete; + StringID(StringID&& other) noexcept = delete; + StringID& operator=(const StringID& rhs) = delete; + StringID& operator=(StringID&& rhs) noexcept = delete; + ~StringID() override; /// Returns the ID of this StringID @@ -250,7 +255,7 @@ public: * @return Return the text content of this StringID. If the data is binary, * then output in base64 encoded string. */ - std::string dataToText(int index) const; + std::string dataToText(int index = 0) const; /** Get the content of this StringID as QByteArray * @param index: optional index. @@ -308,22 +313,6 @@ private: StringHasher* _hasher = nullptr; mutable Flags _flags; mutable QVector _sids; - -private: - StringID([[maybe_unused]] const StringID& other) - : _id(0), - _flags(StringID::Flag::None) {}; - StringID([[maybe_unused]] StringID&& other) noexcept - : _id(0), - _flags(StringID::Flag::None) {}; - StringID& operator=([[maybe_unused]] const StringID& rhs)// NOLINT - { - return *this; - }; - StringID& operator=([[maybe_unused]] StringID&& rhs) noexcept - { - return *this; - }; }; ////////////////////////////////////////////////////////////////////////// @@ -647,6 +636,11 @@ public: StringHasher(); ~StringHasher() override; + StringHasher(const StringHasher&) = delete; + StringHasher(StringHasher&&) noexcept = delete; + StringHasher& operator=(StringHasher& other) = delete; + StringHasher& operator=(StringHasher&& other) noexcept = delete; + unsigned int getMemSize() const override; void Save(Base::Writer& /*writer*/) const override; void Restore(Base::XMLReader& /*reader*/) override; @@ -783,12 +777,6 @@ protected: private: std::unique_ptr _hashes;///< Bidirectional map of StringID and its index (a long int). mutable std::string _filename; - -private: - StringHasher(const StringHasher&); - StringHasher(StringHasher&&) noexcept; - StringHasher& operator=(StringHasher& other); - StringHasher& operator=(StringHasher&& other) noexcept; }; }// namespace App