2018-05-23 06:11:58 +00:00
|
|
|
#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
|
2018-05-23 06:11:58 +00:00
|
|
|
{
|
2019-01-13 17:44:07 +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
|
|
|
}
|