1 /* 2 * Copyright 2011, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__PACKAGE_ROSTER_H_ 6 #define _PACKAGE__PACKAGE_ROSTER_H_ 7 8 9 #include <Entry.h> 10 #include <FindDirectory.h> 11 #include <Path.h> 12 13 #include <package/PackageDefs.h> 14 15 16 class BStringList; 17 18 19 namespace BPackageKit { 20 21 22 struct BRepositoryConfigVisitor { 23 virtual ~BRepositoryConfigVisitor() 24 { 25 } 26 27 virtual status_t operator()(const BEntry& entry) = 0; 28 }; 29 30 31 class BPackageInfoSet; 32 class BRepositoryCache; 33 class BRepositoryConfig; 34 35 36 class BPackageRoster { 37 public: 38 BPackageRoster(); 39 ~BPackageRoster(); 40 41 status_t GetCommonRepositoryCachePath(BPath* path, 42 bool create = false) const; 43 status_t GetUserRepositoryCachePath(BPath* path, 44 bool create = false) const; 45 46 status_t GetCommonRepositoryConfigPath(BPath* path, 47 bool create = false) const; 48 status_t GetUserRepositoryConfigPath(BPath* path, 49 bool create = false) const; 50 51 status_t GetRepositoryNames(BStringList& names); 52 53 status_t VisitCommonRepositoryConfigs( 54 BRepositoryConfigVisitor& visitor); 55 status_t VisitUserRepositoryConfigs( 56 BRepositoryConfigVisitor& visitor); 57 58 status_t GetRepositoryCache(const BString& name, 59 BRepositoryCache* repositoryCache); 60 status_t GetRepositoryConfig(const BString& name, 61 BRepositoryConfig* repositoryConfig); 62 63 status_t GetActivePackages( 64 BPackageInstallationLocation location, 65 BPackageInfoSet& packageInfos); 66 67 private: 68 status_t _GetRepositoryPath(BPath* path, bool create, 69 directory_which whichDir) const; 70 status_t _VisitRepositoryConfigs(const BPath& path, 71 BRepositoryConfigVisitor& visitor); 72 }; 73 74 75 } // namespace BPackageKit 76 77 78 #endif // _PACKAGE__PACKAGE_ROSTER_H_ 79