mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 10:33:54 -07:00
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:
parent
27708d5964
commit
73763b5ee6
65 changed files with 258 additions and 257 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue