From 7d897c608141e9c6ec116e30a99e1438f1d567e1 Mon Sep 17 00:00:00 2001 From: prisixia Date: Fri, 5 May 2023 15:43:14 +0200 Subject: [PATCH] clang-tidy: modernize-use-nodiscard --- include/gui/stages_panel.h | 2 +- include/starbound/frames.h | 15 ++++++++++----- include/starbound/item.h | 28 ++++++++++++++-------------- include/starbound/metadata.h | 22 +++++++++++----------- include/starbound/patch.h | 7 ++++--- include/starpounds/species.h | 6 +++--- include/starpounds/weightstage.h | 20 +++++++++++--------- 7 files changed, 54 insertions(+), 46 deletions(-) diff --git a/include/gui/stages_panel.h b/include/gui/stages_panel.h index 4921658..20597fb 100644 --- a/include/gui/stages_panel.h +++ b/include/gui/stages_panel.h @@ -80,7 +80,7 @@ public: void DoRemoveWeightStageSub(); void DoClickCheckboxID(const bool); - std::vector GetWeightStages() const; + [[nodiscard]] std::vector GetWeightStages() const; void ClearWeightStages(); virtual size_t CheckForErrors(); diff --git a/include/starbound/frames.h b/include/starbound/frames.h index 57e381d..a5a721c 100644 --- a/include/starbound/frames.h +++ b/include/starbound/frames.h @@ -47,9 +47,11 @@ public: Grid(const std::vector>> &, const std::tuple = {129, 129}, const std::tuple = {9, 6}); - std::tuple GetSize() const; - std::tuple GetDimensions() const; - std::vector>> GetNames() const; + + [[nodiscard]] std::tuple GetSize() const; + [[nodiscard]] std::tuple GetDimensions() const; + [[nodiscard]] std::vector>> + GetNames() const; void SetSize(const std::tuple); void SetDimensions(const std::tuple); @@ -65,8 +67,11 @@ class Frames { public: Frames() = delete; Frames(const std::unordered_map &, const Grid &); - std::unordered_map GetAliases() const; - Grid GetGrid() const; + + [[nodiscard]] std::unordered_map + GetAliases() const; + + [[nodiscard]] Grid GetGrid() const; void SetAliases(const std::unordered_map &); void SetGrid(const Grid &); diff --git a/include/starbound/item.h b/include/starbound/item.h index b32aca7..8db6625 100644 --- a/include/starbound/item.h +++ b/include/starbound/item.h @@ -58,9 +58,9 @@ public: Frames(const std::filesystem::path &, const std::filesystem::path &, const std::filesystem::path &); - std::filesystem::path GetBody() const; - std::filesystem::path GetBackSleeve() const; - std::filesystem::path GetFrontSleeve() const; + [[nodiscard]] std::filesystem::path GetBody() const; + [[nodiscard]] std::filesystem::path GetBackSleeve() const; + [[nodiscard]] std::filesystem::path GetFrontSleeve() const; void SetBody(const std::filesystem::path &); void SetBackSleeve(const std::filesystem::path &); @@ -80,17 +80,17 @@ public: const std::string &, const std::string &, const Frames &, const Frames &); - std::string GetItemName() const; - uint32_t GetPrice() const; - std::filesystem::path GetInventoryIcon() const; - uint16_t GetMaxStack() const; - Rarity GetRarity() const; - Category GetCategory() const; - std::string GetDescription() const; - std::string GetShortDescription() const; - TooltipKind GetTooltipKind() const; - Frames GetMaleFrames() const; - Frames GetFemaleFrames() const; + [[nodiscard]] std::string GetItemName() const; + [[nodiscard]] uint32_t GetPrice() const; + [[nodiscard]] std::filesystem::path GetInventoryIcon() const; + [[nodiscard]] uint16_t GetMaxStack() const; + [[nodiscard]] Rarity GetRarity() const; + [[nodiscard]] Category GetCategory() const; + [[nodiscard]] std::string GetDescription() const; + [[nodiscard]] std::string GetShortDescription() const; + [[nodiscard]] TooltipKind GetTooltipKind() const; + [[nodiscard]] Frames GetMaleFrames() const; + [[nodiscard]] Frames GetFemaleFrames() const; void SetItemName(const std::string &); void SetPrice(const uint32_t); diff --git a/include/starbound/metadata.h b/include/starbound/metadata.h index 1faabe0..e848a9e 100644 --- a/include/starbound/metadata.h +++ b/include/starbound/metadata.h @@ -48,17 +48,17 @@ public: const std::string & = "http://git.vern.cc/prisixia/speciesgen", const std::vector & = {"starpounds"}); - std::string GetName() const; - std::string GetFriendlyName() const; - std::string GetDescription() const; - std::string GetAuthor() const; - std::string GetVersion() const; - std::string GetLink() const; - std::string GetSteamContentID() const; - std::string GetTags() const; - std::vector GetIncludes() const; - std::vector GetRequires() const; - uint32_t GetPriority() const; + [[nodiscard]] std::string GetName() const; + [[nodiscard]] std::string GetFriendlyName() const; + [[nodiscard]] std::string GetDescription() const; + [[nodiscard]] std::string GetAuthor() const; + [[nodiscard]] std::string GetVersion() const; + [[nodiscard]] std::string GetLink() const; + [[nodiscard]] std::string GetSteamContentID() const; + [[nodiscard]] std::string GetTags() const; + [[nodiscard]] std::vector GetIncludes() const; + [[nodiscard]] std::vector GetRequires() const; + [[nodiscard]] uint32_t GetPriority() const; void SetName(const std::string &); void SetFriendlyName(const std::string &); diff --git a/include/starbound/patch.h b/include/starbound/patch.h index 405c409..1cf2e9b 100644 --- a/include/starbound/patch.h +++ b/include/starbound/patch.h @@ -55,9 +55,10 @@ public: Patch(std::filesystem::path path, Value value, Operation op = Operation::Add) : m_op(op), m_path(std::move(path)), m_value(value) {} - Operation GetOperation() const { return m_op; } - std::filesystem::path GetPath() const { return m_path; } - Value GetValue() const { return m_value; } + + [[nodiscard]] Operation GetOperation() const { return m_op; } + [[nodiscard]] std::filesystem::path GetPath() const { return m_path; } + [[nodiscard]] Value GetValue() const { return m_value; } void SetOperation(const Operation op) { m_op = op; } void SetPath(const std::filesystem::path &path) { m_path = path; } diff --git a/include/starpounds/species.h b/include/starpounds/species.h index 7f423a4..c6aab4e 100644 --- a/include/starpounds/species.h +++ b/include/starpounds/species.h @@ -42,9 +42,9 @@ public: SpeciesConfig(const std::string &, const bool = false); SpeciesConfig(const std::string &, const std::string &, const bool = false); - bool GetFullbright() const; - std::string GetOverride() const; - std::string GetOverrideDirectives() const; + [[nodiscard]] bool GetFullbright() const; + [[nodiscard]] std::string GetOverride() const; + [[nodiscard]] std::string GetOverrideDirectives() const; void SetFullbright(const bool); void SetOverride(const std::string &); diff --git a/include/starpounds/weightstage.h b/include/starpounds/weightstage.h index d1785d3..217fd5e 100644 --- a/include/starpounds/weightstage.h +++ b/include/starpounds/weightstage.h @@ -47,10 +47,11 @@ public: const std::string &, const Types::Chests); WeightStageSub(const std::string &); WeightStageSub(const Types::Subs, const std::string &); - std::string GetName() const; - std::string GetFriendlyName() const; - std::string GetChestDescription() const; - Types::Chests GetChestType() const; + + [[nodiscard]] std::string GetName() const; + [[nodiscard]] std::string GetFriendlyName() const; + [[nodiscard]] std::string GetChestDescription() const; + [[nodiscard]] Types::Chests GetChestType() const; void SetName(const std::string &); void SetFriendlyName(const std::string &); @@ -73,11 +74,12 @@ public: const std::vector & = {}); WeightStage(const std::string &, const bool, const bool, const std::vector & = {}); - std::string GetLegDescription() const; - Types::Legs GetLegType() const; - bool HasFrames() const; - bool HasID() const; - std::vector GetSubs() const; + + [[nodiscard]] std::string GetLegDescription() const; + [[nodiscard]] Types::Legs GetLegType() const; + [[nodiscard]] bool HasFrames() const; + [[nodiscard]] bool HasID() const; + [[nodiscard]] std::vector GetSubs() const; void SetLegDescription(const std::string &); void SetLegType(const Types::Legs);