xref: /haiku/headers/os/package/solver/SolverProblemSolution.h (revision 9f81ca838ce7b92b5689e57d3f86765db4705a7b)
1 /*
2  * Copyright 2013, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__SOLVER_PROBLEM_SOLUTION_H_
6 #define _PACKAGE__SOLVER_PROBLEM_SOLUTION_H_
7 
8 
9 #include <ObjectList.h>
10 #include <String.h>
11 
12 
13 namespace BPackageKit {
14 
15 
16 class BSolverPackage;
17 
18 
19 class BSolverProblemSolutionElement {
20 public:
21 			enum BType {
22 				B_UNSPECIFIED,
23 				B_DONT_KEEP,
24 				B_DONT_INSTALL,
25 				B_DONT_INSTALL_MOST_RECENT,
26 				B_DONT_FORBID_INSTALLATION,
27 				B_DONT_DEINSTALL,
28 				B_DONT_DEINSTALL_ALL,
29 				B_DONT_LOCK,
30 				B_KEEP_INFERIOR_ARCHITECTURE,
31 				B_KEEP_EXCLUDED,
32 				B_KEEP_OLD,
33 				B_INSTALL_INFERIOR_ARCHITECTURE,
34 				B_INSTALL_EXCLUDED,
35 				B_INSTALL_OLD,
36 				B_ALLOW_DOWNGRADE,
37 				B_ALLOW_NAME_CHANGE,
38 				B_ALLOW_ARCHITECTURE_CHANGE,
39 				B_ALLOW_VENDOR_CHANGE,
40 				B_ALLOW_REPLACEMENT,
41 				B_ALLOW_DEINSTALLATION
42 			};
43 
44 public:
45 								BSolverProblemSolutionElement(BType type,
46 									BSolverPackage* sourcePackage,
47 									BSolverPackage* targetPackage,
48 									const BString& selection);
49 								~BSolverProblemSolutionElement();
50 
51 			BType				Type() const;
52 			BSolverPackage*		SourcePackage() const;
53 			BSolverPackage*		TargetPackage() const;
54 			const BString&		Selection() const;
55 
56 			BString				ToString() const;
57 
58 private:
59 			BType				fType;
60 			BSolverPackage*		fSourcePackage;
61 			BSolverPackage*		fTargetPackage;
62 			BString				fSelection;
63 };
64 
65 
66 class BSolverProblemSolution {
67 public:
68 			typedef BSolverProblemSolutionElement Element;
69 
70 public:
71 								BSolverProblemSolution();
72 								~BSolverProblemSolution();
73 
74 			int32				CountElements() const;
75 			const Element*		ElementAt(int32 index) const;
76 
77 			bool				AppendElement(const Element& element);
78 
79 private:
80 			typedef BObjectList<Element> ElementList;
81 
82 private:
83 			ElementList			fElements;
84 };
85 
86 
87 }	// namespace BPackageKit
88 
89 
90 #endif // _PACKAGE__SOLVER_PROBLEM_SOLUTION_H_
91