xref: /haiku/headers/os/package/solver/SolverResult.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2013, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__SOLVER_RESULT_H_
6 #define _PACKAGE__SOLVER_RESULT_H_
7 
8 
9 #include <ObjectList.h>
10 
11 
12 namespace BPackageKit {
13 
14 
15 class BSolverPackage;
16 
17 
18 class BSolverResultElement {
19 public:
20 			enum BType {
21 				B_TYPE_INSTALL,
22 				B_TYPE_UNINSTALL
23 			};
24 
25 public:
26 								BSolverResultElement(BType type,
27 									BSolverPackage* package);
28 								BSolverResultElement(
29 									const BSolverResultElement& other);
30 								~BSolverResultElement();
31 
32 			BType				Type() const;
33 			BSolverPackage*		Package() const;
34 
35 			BSolverResultElement& operator=(const BSolverResultElement& other);
36 
37 private:
38 			BType				fType;
39 			BSolverPackage*		fPackage;
40 };
41 
42 
43 class BSolverResult {
44 public:
45 								BSolverResult();
46 								~BSolverResult();
47 
48 			bool				IsEmpty() const;
49 			int32				CountElements() const;
50 			const BSolverResultElement* ElementAt(int32 index) const;
51 
52 			void				MakeEmpty();
53 			bool				AppendElement(
54 									const BSolverResultElement& element);
55 
56 private:
57 			typedef BObjectList<BSolverResultElement> ElementList;
58 
59 private:
60 			ElementList			fElements;
61 };
62 
63 
64 }	// namespace BPackageKit
65 
66 
67 #endif // _PACKAGE__SOLVER_RESULT_H_
68