[Fix-Warnings] Mark const getters as [[nodiscard]] (#6365)

Took 45 minutes

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-11-28 21:38:54 +01:00 committed by GitHub
parent a1a3b02d3a
commit 9ece4bfd9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 548 additions and 543 deletions

View file

@ -159,7 +159,7 @@ public:
*
* @return Shared pointer to the cloned CardInfo.
*/
CardInfoPtr clone() const
[[nodiscard]] CardInfoPtr clone() const
{
auto newCardInfo = CardInfoPtr(new CardInfo(*this));
newCardInfo->setSmartPointer(newCardInfo); // Set the smart pointer for the new instance
@ -179,11 +179,11 @@ public:
}
/** @name Basic Properties Accessors */ //@{
inline const QString &getName() const
[[nodiscard]] inline const QString &getName() const
{
return name;
}
const QString &getSimpleName() const
[[nodiscard]] const QString &getSimpleName() const
{
return simpleName;
}
@ -191,7 +191,7 @@ public:
{
return altNames;
};
const QString &getText() const
[[nodiscard]] const QString &getText() const
{
return text;
}
@ -200,15 +200,15 @@ public:
text = _text;
emit cardInfoChanged(smartThis);
}
bool getIsToken() const
[[nodiscard]] bool getIsToken() const
{
return isToken;
}
QStringList getProperties() const
[[nodiscard]] QStringList getProperties() const
{
return properties.keys();
}
QString getProperty(const QString &propertyName) const
[[nodiscard]] QString getProperty(const QString &propertyName) const
{
return properties.value(propertyName).toString();
}
@ -217,34 +217,34 @@ public:
properties.insert(_name, _value);
emit cardInfoChanged(smartThis);
}
bool hasProperty(const QString &propertyName) const
[[nodiscard]] bool hasProperty(const QString &propertyName) const
{
return properties.contains(propertyName);
}
const SetToPrintingsMap &getSets() const
[[nodiscard]] const SetToPrintingsMap &getSets() const
{
return setsToPrintings;
}
const QString &getSetsNames() const
[[nodiscard]] const QString &getSetsNames() const
{
return setsNames;
}
//@}
/** @name Related Cards Accessors */ //@{
const QList<CardRelation *> &getRelatedCards() const
[[nodiscard]] const QList<CardRelation *> &getRelatedCards() const
{
return relatedCards;
}
const QList<CardRelation *> &getReverseRelatedCards() const
[[nodiscard]] const QList<CardRelation *> &getReverseRelatedCards() const
{
return reverseRelatedCards;
}
const QList<CardRelation *> &getReverseRelatedCards2Me() const
[[nodiscard]] const QList<CardRelation *> &getReverseRelatedCards2Me() const
{
return reverseRelatedCardsToMe;
}
QList<CardRelation *> getAllRelatedCards() const
[[nodiscard]] QList<CardRelation *> getAllRelatedCards() const
{
QList<CardRelation *> result;
result.append(getRelatedCards());
@ -259,24 +259,24 @@ public:
//@}
/** @name UI Positioning */ //@{
const UiAttributes &getUiAttributes() const
[[nodiscard]] const UiAttributes &getUiAttributes() const
{
return uiAttributes;
}
//@}
const QChar getColorChar() const;
[[nodiscard]] const QChar getColorChar() const;
/** @name Legacy/Convenience Property Accessors */ //@{
const QString getCardType() const;
[[nodiscard]] const QString getCardType() const;
void setCardType(const QString &value);
const QString getCmc() const;
const QString getColors() const;
[[nodiscard]] const QString getCmc() const;
[[nodiscard]] const QString getColors() const;
void setColors(const QString &value);
const QString getLoyalty() const;
const QString getMainCardType() const;
const QString getManaCost() const;
const QString getPowTough() const;
[[nodiscard]] const QString getLoyalty() const;
[[nodiscard]] const QString getMainCardType() const;
[[nodiscard]] const QString getManaCost() const;
[[nodiscard]] const QString getPowTough() const;
void setPowTough(const QString &value);
//@}
@ -287,7 +287,7 @@ public:
*
* @return Corrected card name as a QString.
*/
QString getCorrectedName() const;
[[nodiscard]] QString getCorrectedName() const;
/**
* @brief Adds a printing to a specific set.

View file

@ -23,8 +23,8 @@ private:
QStringList m_properties; // List of properties to sort by
Qt::SortOrder m_order;
QVariant getProperty(const CardInfoPtr &card, const QString &property) const;
bool compareVariants(const QVariant &a, const QVariant &b) const;
[[nodiscard]] QVariant getProperty(const CardInfoPtr &card, const QString &property) const;
[[nodiscard]] bool compareVariants(const QVariant &a, const QVariant &b) const;
};
#endif // CARD_INFO_COMPARATOR_H

View file

@ -110,7 +110,7 @@ private:
* @brief Collects custom card database paths recursively.
* @return Sorted list of file paths to custom databases.
*/
QStringList collectCustomDatabasePaths() const;
[[nodiscard]] QStringList collectCustomDatabasePaths() const;
private:
CardDatabase *database; /**< Non-owning pointer to the target CardDatabase. */

View file

@ -65,7 +65,7 @@ public:
*
* @return Pointer to the associated CardSet.
*/
CardSetPtr getSet() const
[[nodiscard]] CardSetPtr getSet() const
{
return set;
}
@ -75,7 +75,7 @@ public:
*
* @return List of keys stored in the properties map.
*/
QStringList getProperties() const
[[nodiscard]] QStringList getProperties() const
{
return properties.keys();
}
@ -86,7 +86,7 @@ public:
* @param propertyName The key name of the property to query.
* @return The property value as a string, or an empty string if not set.
*/
QString getProperty(const QString &propertyName) const
[[nodiscard]] QString getProperty(const QString &propertyName) const
{
return properties.value(propertyName).toString();
}
@ -109,14 +109,14 @@ public:
*
* @return A string representing the providerID.
*/
QString getUuid() const;
[[nodiscard]] QString getUuid() const;
/**
* @brief Returns the flavorName for this printing.
*
* @return The flavorName, or empty if it isn't present.
*/
QString getFlavorName() const;
[[nodiscard]] QString getFlavorName() const;
};
#endif // COCKATRICE_PRINTING_INFO_H

View file

@ -105,34 +105,34 @@ public:
*
* @return Sanitized short name.
*/
QString getCorrectedShortName() const;
[[nodiscard]] QString getCorrectedShortName() const;
/// @return Short identifier of the set.
QString getShortName() const
[[nodiscard]] QString getShortName() const
{
return shortName;
}
/// @return Descriptive name of the set.
QString getLongName() const
[[nodiscard]] QString getLongName() const
{
return longName;
}
/// @return Type/category string of the set.
QString getSetType() const
[[nodiscard]] QString getSetType() const
{
return setType;
}
/// @return Release date of the set.
QDate getReleaseDate() const
[[nodiscard]] QDate getReleaseDate() const
{
return releaseDate;
}
/// @return Priority level of the set.
Priority getPriority() const
[[nodiscard]] Priority getPriority() const
{
return priority;
}
@ -182,7 +182,7 @@ public:
void loadSetOptions();
/// @return The sort key assigned to this set.
int getSortKey() const
[[nodiscard]] int getSortKey() const
{
return sortKey;
}
@ -194,7 +194,7 @@ public:
void setSortKey(unsigned int _sortKey);
/// @return True if the set is enabled.
bool getEnabled() const
[[nodiscard]] bool getEnabled() const
{
return enabled;
}
@ -206,7 +206,7 @@ public:
void setEnabled(bool _enabled);
/// @return True if the set is considered known.
bool getIsKnown() const
[[nodiscard]] bool getIsKnown() const
{
return isknown;
}
@ -222,7 +222,7 @@ public:
*
* @return True if the long name, type, and release date are all empty.
*/
bool getIsKnownIgnored() const
[[nodiscard]] bool getIsKnownIgnored() const
{
return longName.length() + setType.length() + releaseDate.toString().length() == 0;
}