00001 #ifndef __INSTALLEDDATABASE_H__
00002 #define __INSTALLEDDATABASE_H__
00003
00004 #include <db4.1/db_cxx.h>
00005 #include "pmstring.h"
00006 #include "installedpackage.h"
00007 #include <vector>
00008
00009
00010 class InstalledDatabase
00011 {
00012 public:
00013 InstalledDatabase();
00014 InstalledDatabase(PMString location);
00015 ~InstalledDatabase();
00016
00017 void Close();
00018 void Init();
00019 void Init(PMString location);
00020 void Add(InstalledPackage newPackage, bool flush = false);
00021 void Remove(PackageVersion passedVersion, bool flush = false);
00022 void Clear();
00023 bool IsVersionInstalled(PackageVersion passedVersion);
00024 bool IsPackageInWorld(Package passedPackage);
00025 std::vector<PackageVersion> GetVersionsInstalled(Package passedPackage);
00026 bool IsPackageInstalled(Package passedPackage);
00027 PackageVersion GetLatestVersionInstalled(Package passedPackage);
00028 std::vector<PMString> GetVirtualsProvided();
00029 std::vector<InstalledPackage> GetWorldPackages();
00030 std::vector<InstalledPackage> GetAllInstalledPackages();
00031 bool IsSlotInstalled(Package passedPackage, PMString slot);
00032
00033 protected:
00034 Db _thePrimaryDatabase;
00035 };
00036 #endif