本文整理汇总了C++中PackageInfoRef::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ PackageInfoRef::Name方法的具体用法?C++ PackageInfoRef::Name怎么用?C++ PackageInfoRef::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageInfoRef
的用法示例。
在下文中一共展示了PackageInfoRef::Name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bestIconFile
status_t
ServerIconExportUpdateProcess::PopulateForPkg(const PackageInfoRef& package)
{
BPath bestIconPath;
if ( fLocalIconStore->TryFindIconPath(
package->Name(), bestIconPath) == B_OK) {
BFile bestIconFile(bestIconPath.Path(), O_RDONLY);
BitmapRef bitmapRef(new(std::nothrow)SharedBitmap(bestIconFile), true);
package->SetIcon(bitmapRef);
if (Logger::IsDebugEnabled()) {
printf("[%s] have set the package icon for [%s] from [%s]\n",
Name(), package->Name().String(), bestIconPath.Path());
}
fCountIconsSet++;
return B_OK;
}
if (Logger::IsDebugEnabled()) {
printf("[%s] did not set the package icon for [%s]; no data\n",
Name(), package->Name().String());
}
return B_FILE_NOT_FOUND;
}
示例2: AcceptsPackage
virtual bool AcceptsPackage(const PackageInfoRef& package) const
{
if (package.Get() == NULL)
return false;
printf("TEST %s\n", package->Name().String());
for (int32 i = 0; i < fPackageLists.CountItems(); i++) {
if (fPackageLists.ItemAtFast(i)->Contains(package)) {
printf(" contained in %" B_PRId32 "\n", i);
return false;
}
}
return true;
}
示例3: PackageInfoRef
PackageInfoRef
PackageAction::FindPackageByName(const BString& name)
{
Model* model = GetModel();
const DepotList& depots = model->Depots();
// TODO: optimize!
for (int32 i = 0; i < depots.CountItems(); i++) {
const DepotInfo& depot = depots.ItemAtFast(i);
const PackageList& packages = depot.Packages();
for (int32 j = 0; j < packages.CountItems(); j++) {
PackageInfoRef info = packages.ItemAtFast(j);
if (info->Name() == name)
return info;
}
}
return PackageInfoRef();
}
示例4: manager
void
MainWindow::_RefreshPackageList(bool force)
{
if (fSinglePackageMode)
return;
BPackageRoster roster;
BStringList repositoryNames;
status_t result = roster.GetRepositoryNames(repositoryNames);
if (result != B_OK)
return;
DepotInfoMap depots;
for (int32 i = 0; i < repositoryNames.CountStrings(); i++) {
const BString& repoName = repositoryNames.StringAt(i);
DepotInfo depotInfo = DepotInfo(repoName);
BRepositoryConfig repoConfig;
status_t getRepositoryConfigStatus = roster.GetRepositoryConfig(
repoName, &repoConfig);
if (getRepositoryConfigStatus == B_OK) {
depotInfo.SetBaseURL(repoConfig.BaseURL());
// it would be nice if this could be more logically located such as
// when the repository is added to the model, but that is probably
// a bigger change.
fModel.PopulateWebAppRepositoryCode(depotInfo);
} else {
printf("unable to obtain the repository config for local "
"repository '%s'; %s\n",
repoName.String(), strerror(getRepositoryConfigStatus));
}
depots[repoName] = depotInfo;
}
PackageManager manager(B_PACKAGE_INSTALLATION_LOCATION_HOME);
try {
manager.Init(PackageManager::B_ADD_INSTALLED_REPOSITORIES
| PackageManager::B_ADD_REMOTE_REPOSITORIES);
} catch (BException ex) {
BString message(B_TRANSLATE("An error occurred while "
"initializing the package manager: %message%"));
message.ReplaceFirst("%message%", ex.Message());
_NotifyUser("Error", message.String());
return;
}
BObjectList<BSolverPackage> packages;
result = manager.Solver()->FindPackages("",
BSolver::B_FIND_CASE_INSENSITIVE | BSolver::B_FIND_IN_NAME
| BSolver::B_FIND_IN_SUMMARY | BSolver::B_FIND_IN_DESCRIPTION
| BSolver::B_FIND_IN_PROVIDES,
packages);
if (result != B_OK) {
BString message(B_TRANSLATE("An error occurred while "
"obtaining the package list: %message%"));
message.ReplaceFirst("%message%", strerror(result));
_NotifyUser("Error", message.String());
return;
}
if (packages.IsEmpty())
return;
PackageInfoMap foundPackages;
// if a given package is installed locally, we will potentially
// get back multiple entries, one for each local installation
// location, and one for each remote repository the package
// is available in. The above map is used to ensure that in such
// cases we consolidate the information, rather than displaying
// duplicates
PackageInfoMap remotePackages;
// any package that we find in a remote repository goes in this map.
// this is later used to discern which packages came from a local
// installation only, as those must be handled a bit differently
// upon uninstallation, since we'd no longer be able to pull them
// down remotely.
BStringList systemFlaggedPackages;
// any packages flagged as a system package are added to this list.
// such packages cannot be uninstalled, nor can any of their deps.
PackageInfoMap systemInstalledPackages;
// any packages installed in system are added to this list.
// This is later used for dependency resolution of the actual
// system packages in order to compute the list of protected
// dependencies indicated above.
for (int32 i = 0; i < packages.CountItems(); i++) {
BSolverPackage* package = packages.ItemAt(i);
const BPackageInfo& repoPackageInfo = package->Info();
const BString repositoryName = package->Repository()->Name();
PackageInfoRef modelInfo;
PackageInfoMap::iterator it = foundPackages.find(
repoPackageInfo.Name());
if (it != foundPackages.end())
modelInfo.SetTo(it->second);
else {
//.........这里部分代码省略.........