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_REPOSITORY_H_
|
|
|
|
#define _PACKAGE__SOLVER_REPOSITORY_H_
|
|
|
|
|
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
#include <ObjectList.h>
|
2013-04-01 04:25:37 +04:00
|
|
|
#include <package/PackageDefs.h>
|
|
|
|
#include <package/PackageInfoSet.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
|
|
|
|
class BPackageInfo;
|
2013-07-04 21:04:03 +04:00
|
|
|
class BRepositoryCache;
|
2013-04-01 04:25:37 +04:00
|
|
|
class BRepositoryConfig;
|
2013-04-03 06:15:57 +04:00
|
|
|
class BSolverPackage;
|
2013-04-01 04:25:37 +04:00
|
|
|
|
|
|
|
|
|
|
|
class BSolverRepository {
|
|
|
|
public:
|
|
|
|
enum BAllInstallationLocations {
|
|
|
|
B_ALL_INSTALLATION_LOCATIONS
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef BPackageInfoSet::Iterator Iterator;
|
|
|
|
|
|
|
|
public:
|
|
|
|
BSolverRepository();
|
|
|
|
BSolverRepository(const BString& name);
|
|
|
|
BSolverRepository(
|
|
|
|
BPackageInstallationLocation location);
|
|
|
|
BSolverRepository(BAllInstallationLocations);
|
|
|
|
BSolverRepository(
|
|
|
|
const BRepositoryConfig& config);
|
2013-08-28 14:43:42 +04:00
|
|
|
virtual ~BSolverRepository();
|
2013-04-01 04:25:37 +04:00
|
|
|
|
|
|
|
status_t SetTo(const BString& name);
|
|
|
|
status_t SetTo(BPackageInstallationLocation location);
|
|
|
|
status_t SetTo(BAllInstallationLocations);
|
|
|
|
status_t SetTo(const BRepositoryConfig& config);
|
2013-07-04 21:04:03 +04:00
|
|
|
status_t SetTo(const BRepositoryCache& cache);
|
2013-04-01 04:25:37 +04:00
|
|
|
void Unset();
|
|
|
|
|
|
|
|
status_t InitCheck();
|
|
|
|
|
|
|
|
bool IsInstalled() const;
|
2013-04-03 06:15:57 +04:00
|
|
|
void SetInstalled(bool isInstalled);
|
2013-04-01 04:25:37 +04:00
|
|
|
|
|
|
|
BString Name() const;
|
2013-04-03 19:57:16 +04:00
|
|
|
|
2013-04-12 15:42:27 +04:00
|
|
|
int32 Priority() const;
|
|
|
|
void SetPriority(int32 priority);
|
|
|
|
// negative priority is fine
|
2013-04-01 04:25:37 +04:00
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
bool IsEmpty() const;
|
|
|
|
int32 CountPackages() const;
|
|
|
|
BSolverPackage* PackageAt(int32 index) const;
|
|
|
|
|
2013-04-03 21:06:47 +04:00
|
|
|
status_t AddPackage(const BPackageInfo& info,
|
|
|
|
BSolverPackage** _package = NULL);
|
2013-04-01 04:25:37 +04:00
|
|
|
status_t AddPackages(
|
|
|
|
BPackageInstallationLocation location);
|
2013-08-28 14:44:14 +04:00
|
|
|
bool RemovePackage(BSolverPackage* package);
|
|
|
|
bool DeletePackage(BSolverPackage* package);
|
2013-04-01 04:25:37 +04:00
|
|
|
|
2013-04-10 14:58:12 +04:00
|
|
|
uint64 ChangeCount() const;
|
|
|
|
|
2013-04-03 06:15:57 +04:00
|
|
|
private:
|
|
|
|
typedef BObjectList<BSolverPackage> PackageList;
|
2013-04-01 04:25:37 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
BString fName;
|
2013-04-12 15:42:27 +04:00
|
|
|
int32 fPriority;
|
2013-04-01 04:25:37 +04:00
|
|
|
bool fIsInstalled;
|
2013-04-03 06:15:57 +04:00
|
|
|
PackageList fPackages;
|
2013-04-10 14:58:12 +04:00
|
|
|
uint64 fChangeCount;
|
2013-04-01 04:25:37 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__SOLVER_REPOSITORY_H_
|