This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
ESGRAF48/source/CheckableItem/CheckableItems.cpp

21 lines
398 B
C++
Raw Permalink Normal View History

#include "CheckableItems.h"
2018-05-23 09:08:50 +00:00
#include <QJsonArray>
2019-01-13 17:44:07 +00:00
#include <numeric>
2018-05-23 09:08:50 +00:00
CheckableItems::CheckableItems(std::initializer_list<std::string> itemNames)
{
2018-05-23 15:47:04 +00:00
for (const auto &itemName : itemNames)
{
emplace_back(itemName);
}
2018-05-23 09:08:50 +00:00
}
2019-01-13 17:44:07 +00:00
unsigned int CheckableItems::getPoints() const
{
2019-01-13 17:44:07 +00:00
return std::accumulate(begin(), end(), 0, [](int base, const CheckableItem &item) {
return base + item.points();
});
}