2013-04-01 04:25:37 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2013, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE__SOLVER_H_
|
|
|
|
#define _PACKAGE__SOLVER_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
|
|
|
|
class BSolverPackageSpecifierList;
|
2013-04-03 06:15:57 +04:00
|
|
|
class BSolverProblem;
|
2013-04-01 04:25:37 +04:00
|
|
|
class BSolverRepository;
|
2013-04-03 06:15:57 +04:00
|
|
|
class BSolverResult;
|
2013-04-01 04:25:37 +04:00
|
|
|
|
|
|
|
|
|
|
|
class BSolver {
|
|
|
|
public:
|
2013-04-03 06:15:57 +04:00
|
|
|
virtual ~BSolver();
|
|
|
|
|
|
|
|
static status_t Create(BSolver*& _solver);
|
2013-04-01 04:25:37 +04:00
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
virtual status_t Init() = 0;
|
2013-04-01 04:25:37 +04:00
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
virtual status_t AddRepository(
|
|
|
|
BSolverRepository* repository) = 0;
|
2013-04-01 04:25:37 +04:00
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
virtual status_t Install(
|
2013-04-01 04:25:37 +04:00
|
|
|
const BSolverPackageSpecifierList&
|
2013-04-03 06:15:57 +04:00
|
|
|
packages) = 0;
|
|
|
|
|
|
|
|
bool HasProblems() const
|
|
|
|
{ return CountProblems() > 0; }
|
|
|
|
virtual int32 CountProblems() const = 0;
|
|
|
|
virtual BSolverProblem* ProblemAt(int32 index) const = 0;
|
2013-04-01 04:25:37 +04:00
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
virtual status_t GetResult(BSolverResult& _result) = 0;
|
2013-04-01 04:25:37 +04:00
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
protected:
|
|
|
|
BSolver();
|
2013-04-01 04:25:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
// function exported by the libsolv based add-on
|
|
|
|
extern "C" BSolver* create_solver();
|
|
|
|
|
|
|
|
|
2013-04-01 04:25:37 +04:00
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__SOLVER_H_
|