BSolverRepository: add SetTo(const BRepositoryCache&)
This commit is contained in:
@@ -16,6 +16,7 @@ namespace BPackageKit {
|
|||||||
|
|
||||||
|
|
||||||
class BPackageInfo;
|
class BPackageInfo;
|
||||||
|
class BRepositoryCache;
|
||||||
class BRepositoryConfig;
|
class BRepositoryConfig;
|
||||||
class BSolverPackage;
|
class BSolverPackage;
|
||||||
|
|
||||||
@@ -42,6 +43,7 @@ public:
|
|||||||
status_t SetTo(BPackageInstallationLocation location);
|
status_t SetTo(BPackageInstallationLocation location);
|
||||||
status_t SetTo(BAllInstallationLocations);
|
status_t SetTo(BAllInstallationLocations);
|
||||||
status_t SetTo(const BRepositoryConfig& config);
|
status_t SetTo(const BRepositoryConfig& config);
|
||||||
|
status_t SetTo(const BRepositoryCache& cache);
|
||||||
void Unset();
|
void Unset();
|
||||||
|
|
||||||
status_t InitCheck();
|
status_t InitCheck();
|
||||||
|
|||||||
@@ -169,6 +169,31 @@ BSolverRepository::SetTo(const BRepositoryConfig& config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BSolverRepository::SetTo(const BRepositoryCache& cache)
|
||||||
|
{
|
||||||
|
Unset();
|
||||||
|
|
||||||
|
const BRepositoryInfo& info = cache.Info();
|
||||||
|
if (info.InitCheck() != B_OK)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
fName = info.Name();
|
||||||
|
fPriority = info.Priority();
|
||||||
|
|
||||||
|
BRepositoryCache::Iterator it = cache.GetIterator();
|
||||||
|
while (const BPackageInfo* packageInfo = it.Next()) {
|
||||||
|
status_t error = AddPackage(*packageInfo);
|
||||||
|
if (error != B_OK) {
|
||||||
|
Unset();
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BSolverRepository::Unset()
|
BSolverRepository::Unset()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user