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

#include <card_list.h>

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

Public Types

enum  SortOption {
  NoSort , SortByMainType , SortByManaValue , SortByColorGrouping ,
  SortByName , SortByType , SortByManaCost , SortByColors ,
  SortByPt , SortBySet , SortByPrinting
}

Public Member Functions

 CardList (bool _contentsKnown)
CardItemfindCard (const int cardId) const
 Finds the CardItem with the given id in the list. If contentsKnown is false, then this just returns the first element of the list.
bool getContentsKnown () const
void sortBy (const QList< SortOption > &options)
 sorts the list by using string comparison on properties extracted from the CardItem The cards are compared using each property in order. If two cards have the same value for a property, then the next property in the list is used.

Static Public Member Functions

static std::function< QString(CardItem *)> getExtractorFor (SortOption option)
 returns the function that extracts the given property from the CardItem.

Protected Attributes

bool contentsKnown

Member Enumeration Documentation

◆ SortOption

Enumerator
NoSort 
SortByMainType 
SortByManaValue 
SortByColorGrouping 
SortByName 
SortByType 
SortByManaCost 
SortByColors 
SortByPt 
SortBySet 
SortByPrinting 

Constructor & Destructor Documentation

◆ CardList()

CardList::CardList ( bool _contentsKnown)
explicit

Member Function Documentation

◆ findCard()

CardItem * CardList::findCard ( const int cardId) const

Finds the CardItem with the given id in the list. If contentsKnown is false, then this just returns the first element of the list.

Parameters
cardIdThe id of the card to find.
Returns
A pointer to the CardItem, or a nullptr if not found.

◆ getContentsKnown()

bool CardList::getContentsKnown ( ) const
inline

◆ getExtractorFor()

std::function< QString(CardItem *)> CardList::getExtractorFor ( SortOption option)
static

returns the function that extracts the given property from the CardItem.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortBy()

void CardList::sortBy ( const QList< SortOption > & option)

sorts the list by using string comparison on properties extracted from the CardItem The cards are compared using each property in order. If two cards have the same value for a property, then the next property in the list is used.

Parameters
optionthe option to compare the cards by, in order of usage.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ contentsKnown

bool CardList::contentsKnown
protected

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