xref: /haiku/headers/os/package/solver/SolverRepository.h (revision 479ca8169c85621dda097bebe337bcc373eba68f)
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 <package/PackageDefs.h>
10 #include <package/PackageInfoSet.h>
11 #include <String.h>
12 
13 
14 namespace BPackageKit {
15 
16 
17 class BPackageInfo;
18 class BRepositoryConfig;
19 
20 
21 class BSolverRepository {
22 public:
23 			enum BAllInstallationLocations {
24 				B_ALL_INSTALLATION_LOCATIONS
25 			};
26 
27 			typedef BPackageInfoSet::Iterator Iterator;
28 
29 public:
30 								BSolverRepository();
31 								BSolverRepository(const BString& name);
32 								BSolverRepository(
33 									BPackageInstallationLocation location);
34 								BSolverRepository(BAllInstallationLocations);
35 								BSolverRepository(
36 									const BRepositoryConfig& config);
37 								~BSolverRepository();
38 
39 			status_t			SetTo(const BString& name);
40 			status_t			SetTo(BPackageInstallationLocation location);
41 			status_t			SetTo(BAllInstallationLocations);
42 			status_t			SetTo(const BRepositoryConfig& config);
43 			void				Unset();
44 
45 			status_t			InitCheck();
46 
47 			bool				IsInstalled() const;
48 
49 			BString				Name() const;
50 			uint8				Priority() const;
51 
52 			status_t			AddPackage(const BPackageInfo& info);
53 			status_t			AddPackages(
54 									BPackageInstallationLocation location);
55 
56 			Iterator			GetIterator() const;
57 
58 private:
59 			BString				fName;
60 			uint8				fPriority;
61 			bool				fIsInstalled;
62 			BPackageInfoSet		fPackages;
63 };
64 
65 
66 }	// namespace BPackageKit
67 
68 
69 #endif // _PACKAGE__SOLVER_REPOSITORY_H_
70