1 /* 2 * Copyright 2013, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold <ingo_weinhold@gmx.de> 7 */ 8 #ifndef _PACKAGE__MANAGER__PRIVATE__REPOSITORY_BUILDER_H_ 9 #define _PACKAGE__MANAGER__PRIVATE__REPOSITORY_BUILDER_H_ 10 11 12 #include <map> 13 14 #include <package/PackageInfo.h> 15 #include <package/solver/Solver.h> 16 #include <package/solver/SolverPackage.h> 17 #include <package/solver/SolverRepository.h> 18 19 20 namespace BPackageKit { 21 22 namespace BManager { 23 24 namespace BPrivate { 25 26 27 typedef std::map<BSolverPackage*, BString> BPackagePathMap; 28 29 30 class BRepositoryBuilder { 31 public: 32 BRepositoryBuilder( 33 BSolverRepository& repository); 34 BRepositoryBuilder( 35 BSolverRepository& repository, 36 const BString& name, 37 const BString& errorName = BString()); 38 BRepositoryBuilder( 39 BSolverRepository& repository, 40 const BRepositoryConfig& config); 41 BRepositoryBuilder( 42 BSolverRepository& repository, 43 const BRepositoryCache& cache, 44 const BString& errorName = BString()); 45 46 BRepositoryBuilder& SetPackagePathMap( 47 BPackagePathMap* packagePaths); 48 49 BRepositoryBuilder& AddPackage(const BPackageInfo& info, 50 const char* packageErrorName = NULL, 51 BSolverPackage** _package = NULL); 52 BRepositoryBuilder& AddPackage(const char* path, 53 BSolverPackage** _package = NULL); 54 BRepositoryBuilder& AddPackages( 55 BPackageInstallationLocation location, 56 const char* locationErrorName); 57 BRepositoryBuilder& AddPackagesDirectory(const char* path); 58 59 BRepositoryBuilder& AddToSolver(BSolver* solver, 60 bool isInstalled = false); 61 62 private: 63 BSolverRepository& fRepository; 64 BString fErrorName; 65 BPackagePathMap* fPackagePaths; 66 }; 67 68 69 } // namespace BPrivate 70 71 } // namespace BManager 72 73 } // namespace BPackageKit 74 75 76 #endif // _PACKAGE__MANAGER__PRIVATE__REPOSITORY_BUILDER_H_ 77