From fd8363a62cc2c1318a0b58b442c3fbc451554fa2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 1 May 2021 20:23:19 +0100 Subject: Fixup clang, cppcheck and iwyu warnings --- lib/persistence.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'lib/persistence.h') diff --git a/lib/persistence.h b/lib/persistence.h index 5d5fb0f..519cb0e 100644 --- a/lib/persistence.h +++ b/lib/persistence.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,7 @@ namespace Persistence { virtual void beginObject(Stack &); virtual void endObject(Stack &); virtual void beforeValue(Stack &); - virtual SelectionPtr select(const std::string &); + [[nodiscard]] virtual SelectionPtr select(const std::string &); }; template struct SelectionT; @@ -49,14 +50,14 @@ namespace Persistence { { } - static SelectionPtr + [[nodiscard]] static SelectionPtr make(T & value) { return make_s>(value); } template - static SelectionPtr + [[nodiscard]] static SelectionPtr make_s(T & value) { return std::make_unique(value); @@ -77,10 +78,10 @@ namespace Persistence { }; struct PersistenceStore { - template inline bool persistType() const; + template [[nodiscard]] inline bool persistType() const; template - inline bool + [[nodiscard]] inline bool persistValue(const std::string_view key, T & value) { if (key == name) { @@ -148,7 +149,7 @@ namespace Persistence { virtual bool persist(PersistenceStore & store) = 0; template - constexpr static auto + [[nodiscard]] constexpr static auto typeName() { constexpr std::string_view name {__PRETTY_FUNCTION__}; @@ -159,8 +160,8 @@ namespace Persistence { template static void addFactory() __attribute__((constructor)); static void addFactory(const std::string_view, std::function()>, std::function()>); - static std::unique_ptr callFactory(const std::string_view); - static std::shared_ptr callSharedFactory(const std::string_view); + [[nodiscard]] static std::unique_ptr callFactory(const std::string_view); + [[nodiscard]] static std::shared_ptr callSharedFactory(const std::string_view); }; template @@ -223,7 +224,7 @@ namespace Persistence { using SelectionV::SelectionV; - SelectionPtr + [[nodiscard]] SelectionPtr select(const std::string & mbr) override { using namespace std::literals; -- cgit v1.2.3