From 75ecd2e5c31e2167eeb7a87158d34c0fdacb322d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Tue, 29 Mar 2022 10:24:45 +0200 Subject: [PATCH] Cosmetic clean-up --- src/mesh/IBoundaryDescriptor.hpp | 17 ++++++++++------- src/mesh/NamedBoundaryDescriptor.hpp | 11 ++++------- src/mesh/NumberedBoundaryDescriptor.hpp | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mesh/IBoundaryDescriptor.hpp b/src/mesh/IBoundaryDescriptor.hpp index 4e016c35b..6d9c003c7 100644 --- a/src/mesh/IBoundaryDescriptor.hpp +++ b/src/mesh/IBoundaryDescriptor.hpp @@ -19,18 +19,20 @@ class IBoundaryDescriptor public: friend std::ostream& - operator<<(std::ostream& os, const IBoundaryDescriptor& bd) + operator<<(std::ostream& os, const IBoundaryDescriptor& boundary_descriptor) { - return bd._write(os); + return boundary_descriptor._write(os); } - virtual bool operator==(const RefId& ref_id) const = 0; - friend bool - operator==(const RefId& ref_id, const IBoundaryDescriptor& bcd) + [[nodiscard]] virtual bool operator==(const RefId& ref_id) const = 0; + + [[nodiscard]] friend bool + operator==(const RefId& ref_id, const IBoundaryDescriptor& boundary_descriptor) { - return bcd == ref_id; + return boundary_descriptor == ref_id; } - virtual Type type() const = 0; + + [[nodiscard]] virtual Type type() const = 0; IBoundaryDescriptor(const IBoundaryDescriptor&) = delete; IBoundaryDescriptor(IBoundaryDescriptor&&) = delete; @@ -38,4 +40,5 @@ class IBoundaryDescriptor virtual ~IBoundaryDescriptor() = default; }; + #endif // I_BOUNDARY_DESCRIPTOR_HPP diff --git a/src/mesh/NamedBoundaryDescriptor.hpp b/src/mesh/NamedBoundaryDescriptor.hpp index 5d8959261..7ee732c59 100644 --- a/src/mesh/NamedBoundaryDescriptor.hpp +++ b/src/mesh/NamedBoundaryDescriptor.hpp @@ -6,7 +6,7 @@ #include <iostream> #include <string> -class NamedBoundaryDescriptor : public IBoundaryDescriptor +class NamedBoundaryDescriptor final : public IBoundaryDescriptor { private: std::string m_name; @@ -19,13 +19,13 @@ class NamedBoundaryDescriptor : public IBoundaryDescriptor } public: - bool + [[nodiscard]] bool operator==(const RefId& ref_id) const final { return m_name == ref_id.tagName(); } - Type + [[nodiscard]] Type type() const final { return Type::named; @@ -33,10 +33,7 @@ class NamedBoundaryDescriptor : public IBoundaryDescriptor NamedBoundaryDescriptor(const NamedBoundaryDescriptor&) = delete; NamedBoundaryDescriptor(NamedBoundaryDescriptor&&) = delete; - NamedBoundaryDescriptor(const std::string& name) : m_name(name) - { - ; - } + NamedBoundaryDescriptor(const std::string& name) : m_name(name) {} virtual ~NamedBoundaryDescriptor() = default; }; diff --git a/src/mesh/NumberedBoundaryDescriptor.hpp b/src/mesh/NumberedBoundaryDescriptor.hpp index 47aa7fa53..2abab9395 100644 --- a/src/mesh/NumberedBoundaryDescriptor.hpp +++ b/src/mesh/NumberedBoundaryDescriptor.hpp @@ -5,7 +5,7 @@ #include <iostream> -class NumberedBoundaryDescriptor : public IBoundaryDescriptor +class NumberedBoundaryDescriptor final : public IBoundaryDescriptor { private: unsigned int m_number; @@ -17,14 +17,14 @@ class NumberedBoundaryDescriptor : public IBoundaryDescriptor return os; } - bool + [[nodiscard]] bool operator==(const RefId& ref_id) const final { return m_number == ref_id.tagNumber(); } public: - Type + [[nodiscard]] Type type() const final { return Type::numbered; -- GitLab