2018-05-23 06:11:58 +00:00
|
|
|
#include "CheckableItems.h"
|
|
|
|
|
2018-05-23 09:08:50 +00:00
|
|
|
#include <QJsonArray>
|
|
|
|
|
2018-12-02 17:26:22 +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
|
|
|
}
|
|
|
|
|
2018-12-02 17:26:22 +00:00
|
|
|
unsigned int CheckableItems::getPoints() const
|
2018-05-23 06:11:58 +00:00
|
|
|
{
|
2018-12-02 17:26:22 +00:00
|
|
|
return std::accumulate(begin(), end(), 0, [](int base, const CheckableItem &item) {
|
|
|
|
return base + item.points();
|
|
|
|
});
|
2018-05-23 06:11:58 +00:00
|
|
|
}
|