From da6ab1eabce65919f3201df7c01a7c7dfce54443 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 31 May 2014 18:00:38 +0100 Subject: [PATCH] Add installedPackages() to Catalog. --- simgear/package/Catalog.cxx | 11 +++++++++++ simgear/package/Catalog.hxx | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/simgear/package/Catalog.cxx b/simgear/package/Catalog.cxx index bc3df27b..70f4cc13 100644 --- a/simgear/package/Catalog.cxx +++ b/simgear/package/Catalog.cxx @@ -198,6 +198,17 @@ Catalog::packagesNeedingUpdate() const return r; } +PackageList +Catalog::installedPackages() const +{ + PackageList r; + BOOST_FOREACH(PackageRef p, m_packages) { + if (p->isInstalled()) { + r.push_back(p); + } + } +} + void Catalog::refresh() { Downloader* dl = new Downloader(this, url()); diff --git a/simgear/package/Catalog.hxx b/simgear/package/Catalog.hxx index 236bed89..3f98fffb 100644 --- a/simgear/package/Catalog.hxx +++ b/simgear/package/Catalog.hxx @@ -72,7 +72,12 @@ public: * filter consists of required / minimum values, AND-ed together. */ PackageList packagesMatching(const SGPropertyNode* aFilter) const; - + + /** + * packages which are locally installed + */ + PackageList installedPackages() const; + /** * retrieve all the packages in the catalog which are installed * and have a pendig update -- 2.39.5