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

@ -63,16 +63,16 @@ public:
{
cards.sortBy(options);
}
QString getName() const
[[nodiscard]] QString getName() const
{
return name;
}
QString getTranslatedName(bool theirOwn, GrammaticalCase gc) const;
Player *getPlayer() const
[[nodiscard]] QString getTranslatedName(bool theirOwn, GrammaticalCase gc) const;
[[nodiscard]] Player *getPlayer() const
{
return player;
}
bool contentsKnown() const
[[nodiscard]] bool contentsKnown() const
{
return cards.getContentsKnown();
}
@ -84,15 +84,15 @@ public:
{
alwaysRevealTopCard = _alwaysRevealTopCard;
}
bool getAlwaysRevealTopCard() const
[[nodiscard]] bool getAlwaysRevealTopCard() const
{
return alwaysRevealTopCard;
}
bool getHasCardAttr() const
[[nodiscard]] bool getHasCardAttr() const
{
return hasCardAttr;
}
bool getIsShufflable() const
[[nodiscard]] bool getIsShufflable() const
{
return isShufflable;
}

View file

@ -84,7 +84,7 @@ private:
*/
bool active = false;
bool isInverted() const;
[[nodiscard]] bool isInverted() const;
private slots:
/**
@ -110,7 +110,7 @@ public:
/**
@return a QRectF of the TableZone bounding box.
*/
QRectF boundingRect() const override;
[[nodiscard]] QRectF boundingRect() const override;
/**
Render the TableZone
@ -140,12 +140,12 @@ public:
/**
@return CardItem from grid location
*/
CardItem *getCardFromGrid(const QPoint &gridPoint) const;
[[nodiscard]] CardItem *getCardFromGrid(const QPoint &gridPoint) const;
/**
@return CardItem from coordinate location
*/
CardItem *getCardFromCoords(const QPointF &point) const;
[[nodiscard]] CardItem *getCardFromCoords(const QPointF &point) const;
QPointF closestGridPoint(const QPointF &point) override;
@ -157,7 +157,7 @@ public:
*/
void resizeToContents();
int getMinimumWidth() const
[[nodiscard]] int getMinimumWidth() const
{
return currentMinimumWidth;
}
@ -166,7 +166,7 @@ public:
prepareGeometryChange();
width = _width;
}
qreal getWidth() const
[[nodiscard]] qreal getWidth() const
{
return width;
}
@ -188,13 +188,13 @@ private:
/*
Mapping functions for points to/from gridpoints.
*/
QPointF mapFromGrid(QPoint gridPoint) const;
QPoint mapToGrid(const QPointF &mapPoint) const;
[[nodiscard]] QPointF mapFromGrid(QPoint gridPoint) const;
[[nodiscard]] QPoint mapToGrid(const QPointF &mapPoint) const;
/*
Helper function to create a single key from a card stack location.
*/
int getCardStackMapKey(int x, int y) const
[[nodiscard]] int getCardStackMapKey(int x, int y) const
{
return x + (y * 1000);
}

View file

@ -58,12 +58,12 @@ private:
public:
ZoneViewZone(ZoneViewZoneLogic *_logic, QGraphicsItem *parent);
QRectF boundingRect() const override;
[[nodiscard]] QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
void reorganizeCards() override;
void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>());
void setGeometry(const QRectF &rect) override;
QRectF getOptimumRect() const
[[nodiscard]] QRectF getOptimumRect() const
{
return optimumRect;
}
@ -83,7 +83,7 @@ signals:
void wheelEventReceived(QGraphicsSceneWheelEvent *event);
protected:
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
[[nodiscard]] QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
void wheelEvent(QGraphicsSceneWheelEvent *event) override;
};