summaryrefslogtreecommitdiffstats
path: root/api/logic/meta/Index.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/meta/Index.cpp')
-rw-r--r--api/logic/meta/Index.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/api/logic/meta/Index.cpp b/api/logic/meta/Index.cpp
index 8a6b1355..e0e8bc5d 100644
--- a/api/logic/meta/Index.cpp
+++ b/api/logic/meta/Index.cpp
@@ -80,29 +80,36 @@ QVariant Index::headerData(int section, Qt::Orientation orientation, int role) c
std::unique_ptr<Task> Index::remoteUpdateTask()
{
- return std::unique_ptr<IndexRemoteLoadTask>(new IndexRemoteLoadTask(this, this));
+ return std::unique_ptr<RemoteLoadTask>(new RemoteLoadTask(this));
}
std::unique_ptr<Task> Index::localUpdateTask()
{
- return std::unique_ptr<IndexLocalLoadTask>(new IndexLocalLoadTask(this, this));
-}
-
-QJsonObject Index::serialized() const
-{
- return Format::serializeIndex(this);
+ return std::unique_ptr<LocalLoadTask>(new LocalLoadTask(this));
}
bool Index::hasUid(const QString &uid) const
{
return m_uids.contains(uid);
}
-VersionListPtr Index::getList(const QString &uid) const
+
+VersionListPtr Index::get(const QString &uid)
{
return m_uids.value(uid, nullptr);
}
-VersionListPtr Index::getListGuaranteed(const QString &uid) const
+
+VersionPtr Index::get(const QString &uid, const QString &version)
+{
+ auto list = get(uid);
+ if(list)
+ {
+ return list->getVersion(version);
+ }
+ return nullptr;
+}
+
+void Index::parse(const QJsonObject& obj)
{
- return m_uids.value(uid, std::make_shared<VersionList>(uid));
+ parseIndex(obj, this);
}
void Index::merge(const Ptr &other)