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 BInstallationLocationInfo; 32 class BPackageInfoSet; 33 class BRepositoryCache; 34 class BRepositoryConfig; 35 36 37 class BPackageRoster { 38 public: 39 BPackageRoster(); 40 ~BPackageRoster(); 41 42 status_t GetCommonRepositoryCachePath(BPath* path, 43 bool create = false) const; 44 status_t GetUserRepositoryCachePath(BPath* path, 45 bool create = false) const; 46 47 status_t GetCommonRepositoryConfigPath(BPath* path, 48 bool create = false) const; 49 status_t GetUserRepositoryConfigPath(BPath* path, 50 bool create = false) const; 51 52 status_t GetRepositoryNames(BStringList& names); 53 54 status_t VisitCommonRepositoryConfigs( 55 BRepositoryConfigVisitor& visitor); 56 status_t VisitUserRepositoryConfigs( 57 BRepositoryConfigVisitor& visitor); 58 59 status_t GetRepositoryCache(const BString& name, 60 BRepositoryCache* repositoryCache); 61 status_t GetRepositoryConfig(const BString& name, 62 BRepositoryConfig* repositoryConfig); 63 64 status_t GetInstallationLocationInfo( 65 BPackageInstallationLocation location, 66 BInstallationLocationInfo& _info); 67 status_t GetActivePackages( 68 BPackageInstallationLocation location, 69 BPackageInfoSet& packageInfos); 70 71 private: 72 status_t _GetRepositoryPath(BPath* path, bool create, 73 directory_which whichDir) const; 74 status_t _VisitRepositoryConfigs(const BPath& path, 75 BRepositoryConfigVisitor& visitor); 76 }; 77 78 79 } // namespace BPackageKit 80 81 82 #endif // _PACKAGE__PACKAGE_ROSTER_H_ 83