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 14 template <class T> class BObjectList; 15 16 17 namespace BPackageKit { 18 19 20 struct BRepositoryConfigVisitor { 21 virtual ~BRepositoryConfigVisitor() 22 { 23 } 24 25 virtual status_t operator()(const BEntry& entry) = 0; 26 }; 27 28 29 class BRepositoryCache; 30 class BRepositoryConfig; 31 32 33 class BPackageRoster { 34 public: 35 BPackageRoster(); 36 ~BPackageRoster(); 37 38 status_t GetCommonRepositoryCachePath(BPath* path, 39 bool create = false) const; 40 status_t GetUserRepositoryCachePath(BPath* path, 41 bool create = false) const; 42 43 status_t GetCommonRepositoryConfigPath(BPath* path, 44 bool create = false) const; 45 status_t GetUserRepositoryConfigPath(BPath* path, 46 bool create = false) const; 47 48 status_t GetRepositoryNames(BObjectList<BString>& names); 49 50 status_t VisitCommonRepositoryConfigs( 51 BRepositoryConfigVisitor& visitor); 52 status_t VisitUserRepositoryConfigs( 53 BRepositoryConfigVisitor& visitor); 54 55 status_t GetRepositoryCache(const BString& name, 56 BRepositoryCache* repositoryCache); 57 status_t GetRepositoryConfig(const BString& name, 58 BRepositoryConfig* repositoryConfig); 59 private: 60 status_t _GetRepositoryPath(BPath* path, bool create, 61 directory_which whichDir) const; 62 status_t _VisitRepositoryConfigs(const BPath& path, 63 BRepositoryConfigVisitor& visitor); 64 65 }; 66 67 68 } // namespace BPackageKit 69 70 71 #endif // _PACKAGE__PACKAGE_ROSTER_H_ 72