From 0060b506257b906d40ef53d1e23404dba76afcee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 17 Mar 2017 01:48:54 +0100 Subject: NOISSUE simplify. --- api/logic/meta/Index.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'api/logic/meta/Index.cpp') 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 Index::remoteUpdateTask() { - return std::unique_ptr(new IndexRemoteLoadTask(this, this)); + return std::unique_ptr(new RemoteLoadTask(this)); } std::unique_ptr Index::localUpdateTask() { - return std::unique_ptr(new IndexLocalLoadTask(this, this)); -} - -QJsonObject Index::serialized() const -{ - return Format::serializeIndex(this); + return std::unique_ptr(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(uid)); + parseIndex(obj, this); } void Index::merge(const Ptr &other) -- cgit v1.2.3