BSolverRepository::AddPackage(): Add optional return parameter

... returning the added BSolverPackage object.
This commit is contained in:
Ingo Weinhold 2013-04-03 19:06:47 +02:00
parent 749884283a
commit a8b832bf46
2 changed files with 7 additions and 2 deletions

View File

@ -58,7 +58,8 @@ public:
int32 CountPackages() const;
BSolverPackage* PackageAt(int32 index) const;
status_t AddPackage(const BPackageInfo& info);
status_t AddPackage(const BPackageInfo& info,
BSolverPackage** _package = NULL);
status_t AddPackages(
BPackageInstallationLocation location);

View File

@ -238,7 +238,8 @@ BSolverRepository::PackageAt(int32 index) const
status_t
BSolverRepository::AddPackage(const BPackageInfo& info)
BSolverRepository::AddPackage(const BPackageInfo& info,
BSolverPackage** _package = NULL)
{
BSolverPackage* package = new(std::nothrow) BSolverPackage(this, info);
if (package == NULL || !fPackages.AddItem(package)) {
@ -246,6 +247,9 @@ BSolverRepository::AddPackage(const BPackageInfo& info)
return B_NO_MEMORY;
}
if (_package != NULL)
*_package = package;
return B_OK;
}