Add [[nodiscard]] specifiers as recommended by CLion.

This commit is contained in:
Guillaume Jacquemin 2024-08-23 17:10:00 +02:00
parent 41f5777379
commit ceaa3ba6e4
Signed by: williamjcm
SSH key fingerprint: SHA256:AYLOg+iTV0ElElnlu4vqM4edFazVdRiuQB0Y5LoKc4A
9 changed files with 25 additions and 0 deletions

View file

@ -45,7 +45,9 @@ class Writer {
auto position() -> std::int64_t; auto position() -> std::int64_t;
[[nodiscard]]
auto array() const -> Containers::ArrayView<const char>; auto array() const -> Containers::ArrayView<const char>;
[[nodiscard]]
auto arrayPosition() const -> std::size_t; auto arrayPosition() const -> std::size_t;
bool flushToFile(); bool flushToFile();

View file

@ -28,30 +28,39 @@ class Configuration {
~Configuration(); ~Configuration();
[[nodiscard]]
bool valid() const; bool valid() const;
[[nodiscard]]
auto lastError() const -> Containers::StringView; auto lastError() const -> Containers::StringView;
void save(); void save();
[[nodiscard]]
auto swapInterval() const -> int; auto swapInterval() const -> int;
void setSwapInterval(int interval); void setSwapInterval(int interval);
[[nodiscard]]
auto fpsCap() const -> float; auto fpsCap() const -> float;
void setFpsCap(float cap); void setFpsCap(float cap);
[[nodiscard]]
bool cheatMode() const; bool cheatMode() const;
void setCheatMode(bool enabled); void setCheatMode(bool enabled);
[[nodiscard]]
bool advancedMode() const; bool advancedMode() const;
void setAdvancedMode(bool enabled); void setAdvancedMode(bool enabled);
[[nodiscard]]
bool checkUpdatesOnStartup() const; bool checkUpdatesOnStartup() const;
void setCheckUpdatesOnStartup(bool mode); void setCheckUpdatesOnStartup(bool mode);
[[nodiscard]]
bool skipDisclaimer() const; bool skipDisclaimer() const;
void setSkipDisclaimer(bool mode); void setSkipDisclaimer(bool mode);
[[nodiscard]]
bool isRunningInWine() const; bool isRunningInWine() const;
void setRunningInWine(bool wine); void setRunningInWine(bool wine);

View file

@ -70,6 +70,7 @@ class Mass {
auto state() -> State; auto state() -> State;
[[nodiscard]]
bool dirty() const; bool dirty() const;
void setDirty(bool dirty = true); void setDirty(bool dirty = true);

View file

@ -34,7 +34,9 @@ class File {
public: public:
explicit File(Containers::String filepath); explicit File(Containers::String filepath);
[[nodiscard]]
bool valid() const; bool valid() const;
[[nodiscard]]
auto lastError() const -> Containers::StringView; auto lastError() const -> Containers::StringView;
bool reloadData(); bool reloadData();

View file

@ -39,8 +39,10 @@ class BackupManager {
void refresh(); void refresh();
[[nodiscard]]
auto backups() const -> Containers::ArrayView<const Backup>; auto backups() const -> Containers::ArrayView<const Backup>;
[[nodiscard]]
auto vfs() const -> const Vfs::Directory<Backup>&; auto vfs() const -> const Vfs::Directory<Backup>&;
bool create(const GameObjects::Profile& profile); bool create(const GameObjects::Profile& profile);

View file

@ -29,6 +29,7 @@ class ProfileManager {
public: public:
explicit ProfileManager(); explicit ProfileManager();
[[nodiscard]]
auto ready() const -> bool; auto ready() const -> bool;
auto lastError() -> Containers::StringView; auto lastError() -> Containers::StringView;

View file

@ -33,7 +33,10 @@ class StagedMassManager {
auto lastError() -> Containers::StringView; auto lastError() -> Containers::StringView;
[[nodiscard]]
auto stagedMasses() const -> Containers::ArrayView<const StagedMass>; auto stagedMasses() const -> Containers::ArrayView<const StagedMass>;
[[nodiscard]]
auto at(Containers::StringView filename) const -> const StagedMass&; auto at(Containers::StringView filename) const -> const StagedMass&;
void refresh(); void refresh();

View file

@ -44,6 +44,7 @@ class Directory {
Directory(Directory<FileType>&& other) = default; Directory(Directory<FileType>&& other) = default;
Directory& operator=(Directory<FileType>&& other) = default; Directory& operator=(Directory<FileType>&& other) = default;
[[nodiscard]]
auto name() const -> Containers::StringView { auto name() const -> Containers::StringView {
return _name; return _name;
} }

View file

@ -35,12 +35,16 @@ class UpdateChecker {
auto check() -> Result; auto check() -> Result;
[[nodiscard]]
auto error() const -> Containers::StringView; auto error() const -> Containers::StringView;
[[nodiscard]]
bool updateAvailable() const; bool updateAvailable() const;
[[nodiscard]]
auto version() const -> const Version&; auto version() const -> const Version&;
[[nodiscard]]
auto downloadLink() const -> Containers::StringView; auto downloadLink() const -> Containers::StringView;
private: private: