本文整理汇总了C++中Package::Info方法的典型用法代码示例。如果您正苦于以下问题:C++ Package::Info方法的具体用法?C++ Package::Info怎么用?C++ Package::Info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::Info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: repositoryBuilder
void
PackageManager::InitInstalledRepository(InstalledRepository& repository)
{
const char* name = repository.InitialName();
BRepositoryBuilder repositoryBuilder(repository, name);
if (Volume* volume = fRoot->GetVolume(repository.Location())) {
for (PackageFileNameHashTable::Iterator it
= volume->PackagesByFileNameIterator(); it.HasNext();) {
Package* package = it.Next();
if (package->IsActive()) {
BSolverPackage* solverPackage;
repositoryBuilder.AddPackage(package->Info(), NULL,
&solverPackage);
fSolverPackages[package] = solverPackage;
}
}
}
}
示例2: bad_alloc
void
PackageManager::HandleUserChanges()
{
const PackageSet& packagesToActivate = fVolume->PackagesToBeActivated();
const PackageSet& packagesToDeactivate = fVolume->PackagesToBeDeactivated();
if (packagesToActivate.empty() && packagesToDeactivate.empty())
return;
if (packagesToActivate.empty()) {
// only packages removed -- use uninstall mode
Init(B_ADD_INSTALLED_REPOSITORIES);
BSolverPackageSpecifierList packagesToUninstall;
for (PackageSet::const_iterator it = packagesToDeactivate.begin();
it != packagesToDeactivate.end(); ++it) {
BSolverPackage* solverPackage = _SolverPackageFor(*it);
if (solverPackage == NULL)
continue;
if (!packagesToUninstall.AppendSpecifier(solverPackage))
throw std::bad_alloc();
fPackagesRemovedByUser.insert(solverPackage);
}
if (fPackagesRemovedByUser.empty())
return;
Uninstall(packagesToUninstall);
} else {
// packages added and (possibly) remove -- manually add/remove those
// from the repository and use verify mode
Init(B_ADD_INSTALLED_REPOSITORIES | B_ADD_REMOTE_REPOSITORIES
| B_REFRESH_REPOSITORIES);
// disable and remove uninstalled packages
InstalledRepository& repository = InstallationRepository();
for (PackageSet::const_iterator it = packagesToDeactivate.begin();
it != packagesToDeactivate.end(); ++it) {
BSolverPackage* solverPackage = _SolverPackageFor(*it);
if (solverPackage == NULL)
continue;
repository.DisablePackage(solverPackage);
if (!repository.PackagesToDeactivate().AddItem(solverPackage))
throw std::bad_alloc();
fPackagesRemovedByUser.insert(solverPackage);
}
// add new packages
BRepositoryBuilder repositoryBuilder(repository);
for (PackageSet::const_iterator it = packagesToActivate.begin();
it != packagesToActivate.end(); ++it) {
Package* package = *it;
BSolverPackage* solverPackage;
repositoryBuilder.AddPackage(package->Info(), NULL, &solverPackage);
fSolverPackages[package] = solverPackage;
if (!repository.PackagesToActivate().AddItem(solverPackage))
throw std::bad_alloc();
fPackagesAddedByUser.insert(solverPackage);
}
if (fPackagesRemovedByUser.empty() && fPackagesAddedByUser.empty())
return;
// TODO: When packages are moved out of the packages directory, we can't create
// a complete "old-state" directory.
VerifyInstallation();
}
}