mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
remove helpers
This commit is contained in:
parent
2b690f8c87
commit
81a7b87fef
2 changed files with 11 additions and 32 deletions
|
|
@ -523,43 +523,24 @@ void DeckList::cleanList(bool preserveMetadata)
|
|||
refreshDeckHash();
|
||||
}
|
||||
|
||||
void DeckList::getCardListHelper(InnerDecklistNode *item, QSet<QString> &result)
|
||||
{
|
||||
for (int i = 0; i < item->size(); ++i) {
|
||||
auto *node = dynamic_cast<DecklistCardNode *>(item->at(i));
|
||||
|
||||
if (node) {
|
||||
result.insert(node->getName());
|
||||
} else {
|
||||
getCardListHelper(dynamic_cast<InnerDecklistNode *>(item->at(i)), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeckList::getCardRefListHelper(InnerDecklistNode *item, QList<CardRef> &result)
|
||||
{
|
||||
for (int i = 0; i < item->size(); ++i) {
|
||||
auto *node = dynamic_cast<DecklistCardNode *>(item->at(i));
|
||||
|
||||
if (node) {
|
||||
result.append(node->toCardRef());
|
||||
} else {
|
||||
getCardRefListHelper(dynamic_cast<InnerDecklistNode *>(item->at(i)), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStringList DeckList::getCardList() const
|
||||
{
|
||||
QSet<QString> result;
|
||||
getCardListHelper(root, result);
|
||||
return result.values();
|
||||
auto nodes = getCardNodes();
|
||||
|
||||
QStringList result;
|
||||
std::transform(nodes.cbegin(), nodes.cend(), std::back_inserter(result), [](auto node) { return node->getName(); });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<CardRef> DeckList::getCardRefList() const
|
||||
{
|
||||
auto nodes = getCardNodes();
|
||||
|
||||
QList<CardRef> result;
|
||||
getCardRefListHelper(root, result);
|
||||
std::transform(nodes.cbegin(), nodes.cend(), std::back_inserter(result),
|
||||
[](auto node) { return node->toCardRef(); });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,6 @@ private:
|
|||
mutable QString cachedDeckHash;
|
||||
|
||||
// Helpers for traversing the tree
|
||||
static void getCardListHelper(InnerDecklistNode *node, QSet<QString> &result);
|
||||
static void getCardRefListHelper(InnerDecklistNode *item, QList<CardRef> &result);
|
||||
InnerDecklistNode *getZoneObjFromName(const QString &zoneName);
|
||||
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue