Cockatrice/libcockatrice_card/libcockatrice/card/set/card_set_comparator.h
DawnFire42 330ea7b8c6
Standardize TODO/FIXME comments to Doxygen \todo format
Convert informal TODO and FIXME comments to Doxygen-recognized
      \todo format.

      - // TODO comments → //! \todo ...
      - // FIXME comments → //! \todo ...
      - /** @todo ... */ blocks → //! \todo ...
      - @brief TODO: placeholders → //! \todo (moved outside doc blocks)
2026-05-21 13:49:28 -04:00

66 lines
No EOL
1.8 KiB
C++

/**
* @file card_set_comparator.h
* @ingroup CardSets
*/
//! \todo Document this file.
#ifndef SET_PRIORITY_COMPARATOR_H
#define SET_PRIORITY_COMPARATOR_H
#include "../card_info.h"
class SetPriorityComparator
{
public:
/*
* Returns true if a has higher download priority than b
* Enabled sets have priority over disabled sets
* Both groups follow the user-defined order
*/
inline bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
{
if (a->getEnabled()) {
return !b->getEnabled() || a->getSortKey() < b->getSortKey();
} else {
return !b->getEnabled() && a->getSortKey() < b->getSortKey();
}
}
};
class SetReleaseDateComparator
{
public:
/*
* Returns true if a has higher download priority than b
* Enabled sets have priority over disabled sets
* Both groups follow the user-defined order
*/
inline bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
{
if (a->getEnabled()) {
return !b->getEnabled() || a->getReleaseDate() < b->getReleaseDate();
} else {
return !b->getEnabled() && a->getReleaseDate() < b->getReleaseDate();
}
}
};
class CardSetPriorityComparator
{
public:
/*
* Returns true if a has higher download priority than b
* Enabled sets have priority over disabled sets
* Both groups follow the user-defined order
*/
inline bool operator()(const PrintingInfo &a, const PrintingInfo &b) const
{
if (a.getSet()->getEnabled()) {
return !b.getSet()->getEnabled() || a.getSet()->getSortKey() < b.getSet()->getSortKey();
} else {
return !b.getSet()->getEnabled() && a.getSet()->getSortKey() < b.getSet()->getSortKey();
}
}
};
#endif // SET_PRIORITY_COMPARATOR_H