Skip to content

Commit

Permalink
libdoomsday|FS: Listing packages on an idgames archive
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 12, 2017
1 parent c1972f6 commit e9bdf37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -31,6 +31,8 @@ class IdgamesLink : public de::filesys::WebHostedLink

void parseRepositoryIndex(QByteArray data) override;

de::LoopResult forPackageIds(std::function<de::LoopResult (de::String const &packageId)> func) const override;

de::String findPackagePath(de::String const &packageId) const override;

protected:
Expand Down
15 changes: 14 additions & 1 deletion doomsday/apps/libdoomsday/src/filesys/idgameslink.cpp
Expand Up @@ -230,7 +230,20 @@ void IdgamesLink::parseRepositoryIndex(QByteArray data)
handleError("Failed to parse directory listing: " + errorMessage);
wasDisconnected();
}
});
});
}

LoopResult IdgamesLink::forPackageIds(std::function<LoopResult (String const &)> func) const
{
PathTreeIterator<Impl::PackageIndexEntry> iter(d->packageIndex.leafNodes());
while (iter.hasNext())
{
if (auto result = func(iter.next().path('.')))
{
return result;
}
}
return LoopContinue;
}

String IdgamesLink::findPackagePath(String const &packageId) const
Expand Down

0 comments on commit e9bdf37

Please sign in to comment.