1 /* 2 * Copyright 2013, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__SOLVER_REPOSITORY_H_ 6 #define _PACKAGE__SOLVER_REPOSITORY_H_ 7 8 9 #include <ObjectList.h> 10 #include <package/PackageDefs.h> 11 #include <package/PackageInfoSet.h> 12 #include <String.h> 13 14 15 namespace BPackageKit { 16 17 18 class BPackageInfo; 19 class BRepositoryConfig; 20 class BSolverPackage; 21 22 23 class BSolverRepository { 24 public: 25 enum BAllInstallationLocations { 26 B_ALL_INSTALLATION_LOCATIONS 27 }; 28 29 typedef BPackageInfoSet::Iterator Iterator; 30 31 public: 32 BSolverRepository(); 33 BSolverRepository(const BString& name); 34 BSolverRepository( 35 BPackageInstallationLocation location); 36 BSolverRepository(BAllInstallationLocations); 37 BSolverRepository( 38 const BRepositoryConfig& config); 39 ~BSolverRepository(); 40 41 status_t SetTo(const BString& name); 42 status_t SetTo(BPackageInstallationLocation location); 43 status_t SetTo(BAllInstallationLocations); 44 status_t SetTo(const BRepositoryConfig& config); 45 void Unset(); 46 47 status_t InitCheck(); 48 49 bool IsInstalled() const; 50 void SetInstalled(bool isInstalled); 51 52 BString Name() const; 53 54 uint8 Priority() const; 55 void SetPriority(uint8 priority); 56 57 bool IsEmpty() const; 58 int32 CountPackages() const; 59 BSolverPackage* PackageAt(int32 index) const; 60 61 status_t AddPackage(const BPackageInfo& info, 62 BSolverPackage** _package = NULL); 63 status_t AddPackages( 64 BPackageInstallationLocation location); 65 66 uint64 ChangeCount() const; 67 68 private: 69 typedef BObjectList<BSolverPackage> PackageList; 70 71 private: 72 BString fName; 73 uint8 fPriority; 74 bool fIsInstalled; 75 PackageList fPackages; 76 uint64 fChangeCount; 77 }; 78 79 80 } // namespace BPackageKit 81 82 83 #endif // _PACKAGE__SOLVER_REPOSITORY_H_ 84