mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-05 20:39:59 -08:00
31 lines
765 B
C++
31 lines
765 B
C++
/**
|
|
* @file card_info_comparator.h
|
|
* @ingroup Cards
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef CARD_INFO_COMPARATOR_H
|
|
#define CARD_INFO_COMPARATOR_H
|
|
|
|
#include "card_info.h"
|
|
|
|
#include <QStringList>
|
|
#include <QVariant>
|
|
#include <Qt>
|
|
|
|
class CardInfoComparator
|
|
{
|
|
public:
|
|
explicit CardInfoComparator(const QStringList &properties, Qt::SortOrder order = Qt::AscendingOrder);
|
|
bool operator()(const CardInfoPtr &a, const CardInfoPtr &b) const;
|
|
|
|
private:
|
|
QStringList m_properties; // List of properties to sort by
|
|
Qt::SortOrder m_order;
|
|
|
|
[[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
|