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;
[[nodiscard]]
auto array() const -> Containers::ArrayView<const char>;
[[nodiscard]]
auto arrayPosition() const -> std::size_t;
bool flushToFile();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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