Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardSet Class Reference

A collection of cards grouped under a common identifier. More...

#include <card_set.h>

Inheritance diagram for CardSet:
[legend]
Collaboration diagram for CardSet:
[legend]

Public Types

enum  Priority {
  PriorityFallback = 0 , PriorityPrimary = 10 , PrioritySecondary = 20 , PriorityReprint = 30 ,
  PriorityOther = 40 , PriorityLowest = 100
}
 Defines relative ordering and importance of sets. More...

Public Member Functions

 CardSet (ICardSetPriorityController *priorityController, const QString &_shortName=QString(), const QString &_longName=QString(), const QString &_setType=QString(), const QDate &_releaseDate=QDate(), const Priority _priority=PriorityFallback)
 Constructs a CardSet.
QString getCorrectedShortName () const
 Returns a safe, sanitized version of the short name.
QString getShortName () const
QString getLongName () const
QString getSetType () const
QDate getReleaseDate () const
Priority getPriority () const
void setLongName (const QString &_longName)
 Sets the full name of the set.
void setSetType (const QString &_setType)
 Sets the category/type of the set.
void setReleaseDate (const QDate &_releaseDate)
 Sets the release date of the set.
void setPriority (const Priority _priority)
 Updates the priority of the set.
void loadSetOptions ()
 Loads state values (enabled, known, sort key) from configuration.
int getSortKey () const
void setSortKey (unsigned int _sortKey)
 Assigns a new sort key to this set.
bool getEnabled () const
void setEnabled (bool _enabled)
 Enables or disables the set.
bool getIsKnown () const
void setIsKnown (bool _isknown)
 Marks the set as known or unknown.
bool getIsKnownIgnored () const
 Determines whether the set has incomplete metadata and should be ignored.

Static Public Member Functions

static CardSetPtr newInstance (ICardSetPriorityController *priorityController, const QString &_shortName=QString(), const QString &_longName=QString(), const QString &_setType=QString(), const QDate &_releaseDate=QDate(), const Priority _priority=PriorityFallback)
 Creates and returns a new shared CardSet instance.

Static Public Attributes

static const char * TOKENS_SETNAME = "TK"
 Reserved identifier for token-like sets.

Private Attributes

ICardSetPriorityControllerpriorityController
 Interface to the card set priority controller.
QString shortName
 Short identifier for the set.
QString longName
 Full name for the set.
unsigned int sortKey
 Custom numeric sort key.
QDate releaseDate
 Release date, may be empty if unknown.
QString setType
 Type/category label for the set.
Priority priority
 Priority level for sorting and relevance.
bool enabled
 Whether the set is active/enabled.
bool isknown
 Whether the set is considered known.

Detailed Description

A collection of cards grouped under a common identifier.

A set serves both as metadata (identifier, title, category, release date, and priority) and as a container of all cards that belong to it. Each set can be enabled/disabled and marked as known/unknown depending on context.

The class inherits from QList<CardInfoPtr>, so it can be iterated over directly to access its contents.

Typical usage:

  • Query metadata such as identifier, category, or release date.
  • Enable or disable sets according to user preference.
  • Store and retrieve CardInfo objects associated with the set.

Member Enumeration Documentation

◆ Priority

Defines relative ordering and importance of sets.

Enumerator
PriorityFallback 

Used when no other priority is defined.

PriorityPrimary 

Primary, canonical set.

PrioritySecondary 

Secondary but relevant.

PriorityReprint 

Duplicate or reprint category.

PriorityOther 

Miscellaneous grouping.

PriorityLowest 

Lowest sorting priority.

Constructor & Destructor Documentation

◆ CardSet()

CardSet::CardSet ( ICardSetPriorityController * priorityController,
const QString & _shortName = QString(),
const QString & _longName = QString(),
const QString & _setType = QString(),
const QDate & _releaseDate = QDate(),
const Priority _priority = PriorityFallback )
explicit

Constructs a CardSet.

Parameters
priorityControllerInterface to a card set priority controller.
_shortNameIdentifier string.
_longNameFull descriptive name.
_setTypeType/category string.
_releaseDateRelease date (optional).
_prioritySorting/priority level.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ getCorrectedShortName()

QString CardSet::getCorrectedShortName ( ) const
nodiscard

Returns a safe, sanitized version of the short name.

Intended for file paths or identifiers where only certain characters are allowed.

Returns
Sanitized short name.

◆ getEnabled()

bool CardSet::getEnabled ( ) const
inlinenodiscard
Returns
True if the set is enabled.

◆ getIsKnown()

bool CardSet::getIsKnown ( ) const
inlinenodiscard
Returns
True if the set is considered known.

◆ getIsKnownIgnored()

bool CardSet::getIsKnownIgnored ( ) const
inlinenodiscard

Determines whether the set has incomplete metadata and should be ignored.

Returns
True if the long name, type, and release date are all empty.

◆ getLongName()

QString CardSet::getLongName ( ) const
inlinenodiscard
Returns
Descriptive name of the set.

◆ getPriority()

Priority CardSet::getPriority ( ) const
inlinenodiscard
Returns
Priority level of the set.

◆ getReleaseDate()

QDate CardSet::getReleaseDate ( ) const
inlinenodiscard
Returns
Release date of the set.

◆ getSetType()

QString CardSet::getSetType ( ) const
inlinenodiscard
Returns
Type/category string of the set.

◆ getShortName()

QString CardSet::getShortName ( ) const
inlinenodiscard
Returns
Short identifier of the set.

◆ getSortKey()

int CardSet::getSortKey ( ) const
inlinenodiscard
Returns
The sort key assigned to this set.

◆ loadSetOptions()

void CardSet::loadSetOptions ( )

Loads state values (enabled, known, sort key) from configuration.

Reads external configuration and applies it to this set.

Here is the caller graph for this function:

◆ newInstance()

CardSetPtr CardSet::newInstance ( ICardSetPriorityController * priorityController,
const QString & _shortName = QString(),
const QString & _longName = QString(),
const QString & _setType = QString(),
const QDate & _releaseDate = QDate(),
const Priority _priority = PriorityFallback )
static

Creates and returns a new shared CardSet instance.

Parameters
priorityControllerInterface to a card set priority controller.
_shortNameIdentifier string.
_longNameFull descriptive name.
_setTypeType/category string.
_releaseDateRelease date (optional).
_prioritySorting/priority level.
Returns
A shared pointer to the new CardSet.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnabled()

void CardSet::setEnabled ( bool _enabled)

Enables or disables the set.

Parameters
_enabledTrue to enable, false to disable.

◆ setIsKnown()

void CardSet::setIsKnown ( bool _isknown)

Marks the set as known or unknown.

Parameters
_isknownTrue if known, false if unknown.

◆ setLongName()

void CardSet::setLongName ( const QString & _longName)
inline

Sets the full name of the set.

Parameters
_longNameNew full name.

◆ setPriority()

void CardSet::setPriority ( const Priority _priority)
inline

Updates the priority of the set.

Parameters
_priorityNew priority value.

◆ setReleaseDate()

void CardSet::setReleaseDate ( const QDate & _releaseDate)
inline

Sets the release date of the set.

Parameters
_releaseDateNew release date.

◆ setSetType()

void CardSet::setSetType ( const QString & _setType)
inline

Sets the category/type of the set.

Parameters
_setTypeNew category string.

◆ setSortKey()

void CardSet::setSortKey ( unsigned int _sortKey)

Assigns a new sort key to this set.

Parameters
_sortKeyThe numeric key to use for sorting.

Member Data Documentation

◆ enabled

bool CardSet::enabled
private

Whether the set is active/enabled.

◆ isknown

bool CardSet::isknown
private

Whether the set is considered known.

◆ longName

QString CardSet::longName
private

Full name for the set.

◆ priority

Priority CardSet::priority
private

Priority level for sorting and relevance.

◆ priorityController

ICardSetPriorityController* CardSet::priorityController
private

Interface to the card set priority controller.

◆ releaseDate

QDate CardSet::releaseDate
private

Release date, may be empty if unknown.

◆ setType

QString CardSet::setType
private

Type/category label for the set.

◆ shortName

QString CardSet::shortName
private

Short identifier for the set.

◆ sortKey

unsigned int CardSet::sortKey
private

Custom numeric sort key.

◆ TOKENS_SETNAME

const char * CardSet::TOKENS_SETNAME = "TK"
static

Reserved identifier for token-like sets.


The documentation for this class was generated from the following files: