mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-17 16:02:14 -07:00
inline structs
This commit is contained in:
parent
5f1fca5da0
commit
d6f5cacca1
1 changed files with 4 additions and 16 deletions
|
|
@ -262,21 +262,6 @@ bool AbstractDecklistCardNode::compareName(AbstractDecklistNode *other) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class InnerDecklistNode::compareFunctor
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Qt::SortOrder order;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit compareFunctor(Qt::SortOrder _order) : order(_order)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
inline bool operator()(QPair<int, AbstractDecklistNode *> a, QPair<int, AbstractDecklistNode *> b) const
|
|
||||||
{
|
|
||||||
return (order == Qt::AscendingOrder) ? (b.second->compare(a.second)) : (a.second->compare(b.second));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool InnerDecklistNode::readElement(QXmlStreamReader *xml)
|
bool InnerDecklistNode::readElement(QXmlStreamReader *xml)
|
||||||
{
|
{
|
||||||
while (!xml->atEnd()) {
|
while (!xml->atEnd()) {
|
||||||
|
|
@ -347,7 +332,10 @@ QVector<QPair<int, int>> InnerDecklistNode::sort(Qt::SortOrder order)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort temporary list
|
// Sort temporary list
|
||||||
compareFunctor cmp(order);
|
auto cmp = [order](const auto &a, const auto &b) {
|
||||||
|
return (order == Qt::AscendingOrder) ? (b.second->compare(a.second)) : (a.second->compare(b.second));
|
||||||
|
};
|
||||||
|
|
||||||
std::sort(tempList.begin(), tempList.end(), cmp);
|
std::sort(tempList.begin(), tempList.end(), cmp);
|
||||||
|
|
||||||
// Map old indexes to new indexes and
|
// Map old indexes to new indexes and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue