Mark more functions as [[nodiscard]] (#6320)

* Fix local variable double declaration.

Took 44 seconds

* Mark functions as [[nodiscard]]

Took 31 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-11-16 01:39:24 +01:00 committed by GitHub
parent 27708d5964
commit 73763b5ee6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 258 additions and 257 deletions

View file

@ -59,31 +59,31 @@ public:
}
/// @return The number of copies of this card in the deck.
virtual int getNumber() const = 0;
[[nodiscard]] virtual int getNumber() const = 0;
/// @param _number Set the number of copies of this card.
virtual void setNumber(int _number) = 0;
/// @return The display name of this card.
QString getName() const override = 0;
[[nodiscard]] QString getName() const override = 0;
/// @param _name Set the display name of this card.
virtual void setName(const QString &_name) = 0;
/// @return The provider identifier for this card (e.g., UUID).
virtual QString getCardProviderId() const override = 0;
[[nodiscard]] virtual QString getCardProviderId() const override = 0;
/// @param _cardProviderId Set the provider identifier for this card.
virtual void setCardProviderId(const QString &_cardProviderId) = 0;
/// @return The abbreviated set code (e.g., "NEO").
virtual QString getCardSetShortName() const override = 0;
[[nodiscard]] virtual QString getCardSetShortName() const override = 0;
/// @param _cardSetShortName Set the abbreviated set code.
virtual void setCardSetShortName(const QString &_cardSetShortName) = 0;
/// @return The collector number of the card within its set.
virtual QString getCardCollectorNumber() const override = 0;
[[nodiscard]] virtual QString getCardCollectorNumber() const override = 0;
/// @param _cardSetNumber Set the collector number.
virtual void setCardCollectorNumber(const QString &_cardSetNumber) = 0;
@ -96,7 +96,7 @@ public:
*
* @return 0
*/
int height() const override
[[nodiscard]] int height() const override
{
return 0;
}

View file

@ -123,10 +123,10 @@ public:
* identifying information about a node, regardless of type.
* @{
*/
virtual QString getName() const = 0;
virtual QString getCardProviderId() const = 0;
virtual QString getCardSetShortName() const = 0;
virtual QString getCardCollectorNumber() const = 0;
[[nodiscard]] virtual QString getName() const = 0;
[[nodiscard]] virtual QString getCardProviderId() const = 0;
[[nodiscard]] virtual QString getCardSetShortName() const = 0;
[[nodiscard]] virtual QString getCardCollectorNumber() const = 0;
/// @}
/**
@ -138,7 +138,7 @@ public:
[[nodiscard]] virtual bool isDeckHeader() const = 0;
/// @return The parent node, or nullptr if this is the root.
InnerDecklistNode *getParent() const
[[nodiscard]] InnerDecklistNode *getParent() const
{
return parent;
}
@ -147,7 +147,7 @@ public:
* @brief Compute the depth of this node in the tree.
* @return Distance from the root (root = 0, children = 1, etc.).
*/
int depth() const;
[[nodiscard]] int depth() const;
/**
* @brief Compute the "height" of this node.
@ -159,7 +159,7 @@ public:
* - A card node has height 1.
* - A group node containing cards has height 2.
*/
virtual int height() const = 0;
[[nodiscard]] virtual int height() const = 0;
/**
* @brief Compare this node against another for sorting.

View file

@ -72,13 +72,13 @@ public:
void write(QXmlStreamWriter *xml);
/// @return The plan name.
QString getName() const
[[nodiscard]] QString getName() const
{
return name;
}
/// @return Const reference to the move list.
const QList<MoveCard_ToZone> &getMoveList() const
[[nodiscard]] const QList<MoveCard_ToZone> &getMoveList() const
{
return moveList;
}

View file

@ -176,7 +176,7 @@ public:
* @brief Compute the height of this node.
* @return Maximum depth of descendants + 1.
*/
int height() const override;
[[nodiscard]] int height() const override;
/**
* @brief Count cards recursively under this node.
@ -184,7 +184,7 @@ public:
* If false, counts unique card nodes.
* @return Total count.
*/
int recursiveCount(bool countTotalCards = false) const;
[[nodiscard]] int recursiveCount(bool countTotalCards = false) const;
/**
* @brief Compare this node against another for sorting.