1 /* 2 * Copyright 2013, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__SOLVER_PROBLEM_H_ 6 #define _PACKAGE__SOLVER_PROBLEM_H_ 7 8 9 #include <ObjectList.h> 10 #include <package/PackageResolvableExpression.h> 11 12 13 namespace BPackageKit { 14 15 16 class BSolverPackage; 17 class BSolverProblemSolution; 18 19 20 class BSolverProblem { 21 public: 22 enum BType { 23 B_UNSPECIFIED, 24 B_NOT_IN_DISTUPGRADE_REPOSITORY, 25 B_INFERIOR_ARCHITECTURE, 26 B_INSTALLED_PACKAGE_PROBLEM, 27 B_CONFLICTING_REQUESTS, 28 B_REQUESTED_RESOLVABLE_NOT_PROVIDED, 29 B_REQUESTED_RESOLVABLE_PROVIDED_BY_SYSTEM, 30 B_DEPENDENCY_PROBLEM, 31 B_PACKAGE_NOT_INSTALLABLE, 32 B_DEPENDENCY_NOT_PROVIDED, 33 B_PACKAGE_NAME_CLASH, 34 B_PACKAGE_CONFLICT, 35 B_PACKAGE_OBSOLETES_RESOLVABLE, 36 B_INSTALLED_PACKAGE_OBSOLETES_RESOLVABLE, 37 B_PACKAGE_IMPLICITLY_OBSOLETES_RESOLVABLE, 38 B_DEPENDENCY_NOT_INSTALLABLE, 39 B_SELF_CONFLICT 40 }; 41 42 public: 43 BSolverProblem(BType type, 44 BSolverPackage* sourcePackage, 45 BSolverPackage* targetPackage = NULL); 46 BSolverProblem(BType type, 47 BSolverPackage* sourcePackage, 48 BSolverPackage* targetPackage, 49 const BPackageResolvableExpression& 50 dependency); 51 ~BSolverProblem(); 52 53 BType Type() const; 54 BSolverPackage* SourcePackage() const; 55 BSolverPackage* TargetPackage() const; 56 const BPackageResolvableExpression& Dependency() const; 57 58 int32 CountSolutions() const; 59 const BSolverProblemSolution* SolutionAt(int32 index) const; 60 61 bool AppendSolution( 62 BSolverProblemSolution* solution); 63 64 BString ToString() const; 65 66 private: 67 typedef BObjectList<BSolverProblemSolution> SolutionList; 68 69 private: 70 BType fType; 71 BSolverPackage* fSourcePackage; 72 BSolverPackage* fTargetPackage; 73 BPackageResolvableExpression fDependency; 74 SolutionList fSolutions; 75 }; 76 77 78 } // namespace BPackageKit 79 80 81 #endif // _PACKAGE__SOLVER_PROBLEM_H_ 82