Provides lookup and convenience functions for querying cards and their printings.
More...
|
| | CardDatabaseQuerier (QObject *parent, const CardDatabase *db, const ICardPreferenceProvider *prefs) |
| | Constructs a CardDatabaseQuerier.
|
| CardInfoPtr | getCardInfo (const QString &cardName) const |
| | Retrieves a card by its exact name.
|
| QList< CardInfoPtr > | getCardInfos (const QStringList &cardNames) const |
| | Retrieves multiple cards by their exact names.
|
| CardInfoPtr | getCardBySimpleName (const QString &cardName) const |
| | Retrieves a card using simplified name matching.
|
| CardInfoPtr | lookupCardByName (const QString &name) const |
| | Looks up a card using exact name first, then simplified matching as fallback.
|
| ExactCard | getCard (const CardRef &cardRef) const |
| | Converts a CardRef into an ExactCard.
|
| QList< ExactCard > | getCards (const QList< CardRef > &cardRefs) const |
| | Resolves multiple CardRefs into ExactCards.
|
| ExactCard | guessCard (const CardRef &cardRef) const |
| | Attempts a more flexible card lookup using both simple name matching and CardRef rules.
|
| ExactCard | getRandomCard () const |
| | Returns a random card from the database using the preferred printing.
|
| ExactCard | getCardFromSameSet (const QString &cardName, const PrintingInfo &otherPrinting) const |
| | Returns a printing of a card from the same set as another given printing when possible.
|
| ExactCard | getPreferredCard (const QString &cardName) const |
| | Returns the preferred printing of a card based on user preferences and set priority.
|
| ExactCard | getPreferredCard (const CardInfoPtr &cardInfo) const |
| | Returns the preferred printing of a card based on user preferences and set priority.
|
| bool | isPreferredPrinting (const CardRef &cardRef) const |
| | Checks whether the CardRef refers to the preferred printing.
|
| PrintingInfo | getPreferredPrinting (const QString &cardName) const |
| | Returns the preferred printing for the given card name.
|
| PrintingInfo | getPreferredPrinting (const CardInfoPtr &cardInfo) const |
| | Returns the preferred printing for the given card.
|
| QString | getPreferredPrintingProviderId (const QString &cardName) const |
| | Returns the providerId of the preferred printing.
|
| PrintingInfo | getSpecificPrinting (const CardRef &cardRef) const |
| | Retrieves a specific printing referenced by CardRef.
|
| PrintingInfo | getSpecificPrinting (const QString &cardName, const QString &setCode, const QString &collectorNumber) const |
| | Searches for a specific printing by set code and collector number.
|
| PrintingInfo | findPrintingWithId (const CardInfoPtr &card, const QString &providerId) const |
| | Searches for a printing that matches a given providerId.
|
| QStringList | getAllMainCardTypes () const |
| | Returns a list of all main card types present in the database.
|
| QMap< QString, int > | getAllMainCardTypesWithCount () const |
| | Returns a mapping of main card types to their occurrence counts.
|
| QMap< QString, int > | getAllSubCardTypesWithCount () const |
| | Returns a mapping of card subtypes to their occurrence counts.
|
| FormatRulesPtr | getFormat (const QString &formatName) const |
| QMap< QString, int > | getAllFormatsWithCount () const |
Provides lookup and convenience functions for querying cards and their printings.
The CardDatabaseQuerier class offers various lookup helpers for retrieving card information (e.g., CardInfoPtr, ExactCard, and PrintingInfo) from a CardDatabase. It also applies user printing preferences via ICardPreferenceProvider when determining preferred printings.
Converts a CardRef into an ExactCard.
If the providerId is empty, the preferred printing is used. If providerId exists but cannot be found, an ExactCard with an empty PrintingInfo is returned.
- Parameters
-
| cardRef | Card reference with name and optional providerId. |
- Returns
- The resolved ExactCard, or empty if no card was found.
Looks up the card corresponding to the CardRef. If the providerId is empty, will default to the preferred printing. If providerId is given but not found, the PrintingInfo will be empty.
- Parameters
-
| cardRef | The card to look up. |
- Returns
- A specific printing of a card, or empty if not found.
Attempts a more flexible card lookup using both simple name matching and CardRef rules.
If providerId is missing, uses preferred printing. If lookup fails, attempts simplified name.
- Parameters
-
| cardRef | Card reference to resolve. |
- Returns
- The best-guess ExactCard, or empty if unresolved.
Looks up the card by CardRef, simplifying the name if required. If the providerId is empty, will default to the preferred printing. If providerId is given but not found, the PrintingInfo will be empty.
- Parameters
-
| cardRef | The card to look up. |
- Returns
- A specific printing of a card, or empty if not found.