Index
| 35 | |
| 36 | // Index |
| 37 | static std::shared_ptr<Index> parseIndexInternal(const QJsonObject &obj) |
| 38 | { |
| 39 | const QVector<QJsonObject> objects = requireIsArrayOf<QJsonObject>(obj, "packages"); |
| 40 | QVector<VersionListPtr> lists; |
| 41 | lists.reserve(objects.size()); |
| 42 | std::transform(objects.begin(), objects.end(), std::back_inserter(lists), [](const QJsonObject &obj) |
| 43 | { |
| 44 | VersionListPtr list = std::make_shared<VersionList>(requireString(obj, "uid")); |
| 45 | list->setName(ensureString(obj, "name", QString())); |
| 46 | return list; |
| 47 | }); |
| 48 | return std::make_shared<Index>(lists); |
| 49 | } |
| 50 | |
| 51 | // Version |
| 52 | static VersionPtr parseCommonVersion(const QString &uid, const QJsonObject &obj) |