本文整理汇总了C++中BStringList类的典型用法代码示例。如果您正苦于以下问题:C++ BStringList类的具体用法?C++ BStringList怎么用?C++ BStringList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BStringList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
WriterImplBase::_AddStringAttributeList(BHPKGAttributeID id,
const BStringList& value, DoublyLinkedList<PackageAttribute>& list)
{
for (int32 i = 0; i < value.CountStrings(); i++)
AddStringAttribute(id, value.StringAt(i), list);
}
示例2: directory
void
MidiSettingsView::_RetrieveSoftSynthList()
{
BStringList paths;
status_t status = BPathFinder::FindPaths(B_FIND_PATH_DATA_DIRECTORY,
"synth", paths);
if (status != B_OK)
return;
fListView->MakeEmpty();
for (int32 i = 0; i < paths.CountStrings(); i++) {
BDirectory directory(paths.StringAt(i).String());
BEntry entry;
if (directory.InitCheck() != B_OK)
continue;
while (directory.GetNextEntry(&entry) == B_OK) {
BNode node(&entry);
BNodeInfo nodeInfo(&node);
char mimeType[B_MIME_TYPE_LENGTH];
// TODO: For some reason this doesn't work
if (nodeInfo.GetType(mimeType) == B_OK
/*&& !strcmp(mimeType, "audio/x-soundfont")*/) {
BPath fullPath = paths.StringAt(i).String();
fullPath.Append(entry.Name());
fListView->AddItem(new BStringItem(fullPath.Path()));
}
}
}
}
示例3: settings
status_t
RepositoriesSettings::GetRepositories(int32& repoCount, BStringList& nameList,
BStringList& urlList)
{
BMessage settings(_ReadFromFile());
type_code type;
int32 count;
settings.GetInfo(key_name, &type, &count);
status_t result = B_OK;
int32 index, total = 0;
BString foundName, foundUrl;
// get each repository and add to lists
for (index = 0; index < count; index++) {
status_t result1 = settings.FindString(key_name, index, &foundName);
status_t result2 = settings.FindString(key_url, index, &foundUrl);
if (result1 == B_OK && result2 == B_OK) {
nameList.Add(foundName);
urlList.Add(foundUrl);
total++;
} else
result = B_ERROR;
}
repoCount = total;
return result;
}
示例4: find_paths_etc
/*static*/ status_t
BPathFinder::FindPaths(const char* architecture,
path_base_directory baseDirectory, const char* subPath, uint32 flags,
BStringList& _paths)
{
_paths.MakeEmpty();
// get the paths
char** pathArray;
size_t pathCount;
status_t error = find_paths_etc(architecture, baseDirectory, subPath, flags,
&pathArray, &pathCount);
if (error != B_OK)
return error;
MemoryDeleter pathArrayDeleter(pathArray);
// add them to BStringList
for (size_t i = 0; i < pathCount; i++) {
BString path(pathArray[i]);
if (path.IsEmpty() || !_paths.Add(path)) {
_paths.MakeEmpty();
return B_NO_MEMORY;
}
}
return B_OK;
}
示例5: _RetrieveKernelOptions
void
LaunchDaemon::ReadyToRun()
{
_RetrieveKernelOptions();
_SetupEnvironment();
fReadOnlyBootVolume = Utility::IsReadOnlyVolume("/boot");
if (fReadOnlyBootVolume)
Utility::BlockMedia("/boot", true);
if (fUserMode) {
BLaunchRoster roster;
BLaunchRoster::Private(roster).RegisterSessionDaemon(this);
} else
_InitSystem();
BStringList paths;
BPathFinder::FindPaths(B_FIND_PATH_DATA_DIRECTORY, kLaunchDirectory,
fUserMode ? B_FIND_PATHS_USER_ONLY : B_FIND_PATHS_SYSTEM_ONLY, paths);
_ReadPaths(paths);
BPathFinder::FindPaths(B_FIND_PATH_SETTINGS_DIRECTORY, kLaunchDirectory,
fUserMode ? B_FIND_PATHS_USER_ONLY : B_FIND_PATHS_SYSTEM_ONLY, paths);
_ReadPaths(paths);
_InitJobs(NULL);
_LaunchJobs(NULL);
// Launch run targets (ignores events)
for (int32 index = 0; index < fRunTargets.CountStrings(); index++) {
Target* target = FindTarget(fRunTargets.StringAt(index));
if (target != NULL)
_LaunchJobs(target);
}
}
示例6: printf
void
PackageManager::_PrintResult(InstalledRepository& installationRepository)
{
if (!installationRepository.HasChanges())
return;
printf(" in %s:\n", installationRepository.Name().String());
PackageList& packagesToActivate
= installationRepository.PackagesToActivate();
PackageList& packagesToDeactivate
= installationRepository.PackagesToDeactivate();
BStringList upgradedPackages;
for (int32 i = 0;
BSolverPackage* installPackage = packagesToActivate.ItemAt(i);
i++) {
for (int32 j = 0;
BSolverPackage* uninstallPackage = packagesToDeactivate.ItemAt(j);
j++) {
if (installPackage->Info().Name() == uninstallPackage->Info().Name()) {
upgradedPackages.Add(installPackage->Info().Name());
break;
}
}
}
for (int32 i = 0; BSolverPackage* package = packagesToActivate.ItemAt(i);
i++) {
BString repository;
if (dynamic_cast<MiscLocalRepository*>(package->Repository()) != NULL)
repository = "local file";
else
repository.SetToFormat("repository %s", package->Repository()->Name().String());
if (upgradedPackages.HasString(package->Info().Name())) {
printf(" upgrade package %s to %s from %s\n",
package->Info().Name().String(),
package->Info().Version().ToString().String(),
repository.String());
} else {
printf(" install package %s-%s from %s\n",
package->Info().Name().String(),
package->Info().Version().ToString().String(),
repository.String());
}
}
for (int32 i = 0; BSolverPackage* package = packagesToDeactivate.ItemAt(i);
i++) {
if (upgradedPackages.HasString(package->Info().Name()))
continue;
printf(" uninstall package %s\n", package->VersionedName().String());
}
// TODO: Print file/download sizes. Unfortunately our package infos don't
// contain the file size. Which is probably correct. The file size (and possibly
// other information) should, however, be provided by the repository cache in
// some way. Extend BPackageInfo? Create a BPackageFileInfo?
}
示例7:
void
Job::_AddStringList(std::vector<const char*>& array, const BStringList& list)
{
int32 count = list.CountStrings();
for (int32 index = 0; index < count; index++) {
array.push_back(list.StringAt(index).String());
}
}
示例8: NotHere
static void
NotHere(BStringList& that, BStringList& otherList, BStringList* results)
{
for (int32 i = 0; i < otherList.CountStrings(); i++) {
if (!that.HasString(otherList.StringAt(i)))
results->Add(otherList.StringAt(i));
}
}
示例9: _RetrieveKernelOptions
void
LaunchDaemon::ReadyToRun()
{
_RetrieveKernelOptions();
_SetupEnvironment();
fReadOnlyBootVolume = Utility::IsReadOnlyVolume("/boot");
if (fReadOnlyBootVolume)
Utility::BlockMedia("/boot", true);
if (fUserMode) {
BLaunchRoster roster;
BLaunchRoster::Private(roster).RegisterSessionDaemon(this);
} else
_InitSystem();
BStringList paths;
if (fUserMode) {
// System-wide user specific jobs
BPathFinder::FindPaths(B_FIND_PATH_DATA_DIRECTORY, kUserLaunchDirectory,
B_FIND_PATHS_SYSTEM_ONLY, paths);
_ReadPaths(paths);
}
BPathFinder::FindPaths(B_FIND_PATH_DATA_DIRECTORY, kLaunchDirectory,
fUserMode ? B_FIND_PATHS_USER_ONLY : B_FIND_PATHS_SYSTEM_ONLY, paths);
_ReadPaths(paths);
if (fUserMode) {
BPathFinder::FindPaths(B_FIND_PATH_SETTINGS_DIRECTORY,
kUserLaunchDirectory, B_FIND_PATHS_SYSTEM_ONLY, paths);
_ReadPaths(paths);
}
BPathFinder::FindPaths(B_FIND_PATH_SETTINGS_DIRECTORY, kLaunchDirectory,
fUserMode ? B_FIND_PATHS_USER_ONLY : B_FIND_PATHS_SYSTEM_ONLY, paths);
_ReadPaths(paths);
BMessenger target(this);
BMessenger::Private messengerPrivate(target);
port_id port = messengerPrivate.Port();
int32 token = messengerPrivate.Token();
__start_watching_system(-1, B_WATCH_SYSTEM_TEAM_DELETION, port, token);
_InitJobs(NULL);
_LaunchJobs(NULL);
// Launch run targets (ignores events)
for (int32 index = 0; index < fRunTargets.CountStrings(); index++) {
Target* target = FindTarget(fRunTargets.StringAt(index));
if (target != NULL)
_LaunchJobs(target);
}
if (fUserMode)
be_roster->StartWatching(this, B_REQUEST_LAUNCHED);
}
示例10: add_replaces_list
static void add_replaces_list(Repo *repo, Offset &dependencies,
const BStringList &packageNames)
{
int32 count = packageNames.CountStrings();
for (int32 i = 0; i < count; i++)
{
const BString &packageName = packageNames.StringAt(i);
add_dependency(repo, dependencies, packageName, BPackageVersion(), 0);
}
}
示例11: entry
void
LaunchDaemon::_ReadPaths(const BStringList& paths)
{
for (int32 i = 0; i < paths.CountStrings(); i++) {
BEntry entry(paths.StringAt(i));
if (entry.InitCheck() != B_OK || !entry.Exists())
continue;
_ReadDirectory(NULL, entry);
}
}
示例12: DIE
void
BPackageManager::Init(uint32 flags)
{
if (fSolver != NULL)
return;
// create the solver
status_t error = BSolver::Create(fSolver);
if (error != B_OK)
DIE(error, "failed to create solver");
if (fSystemRepository == NULL || fHomeRepository == NULL
|| fLocalRepository == NULL) {
throw std::bad_alloc();
}
fSolver->SetDebugLevel(fDebugLevel);
BRepositoryBuilder(*fLocalRepository).AddToSolver(fSolver, false);
// add installation location repositories
if ((flags & B_ADD_INSTALLED_REPOSITORIES) != 0) {
// We add only the repository of our actual installation location as the
// "installed" repository. The repositories for the more general
// installation locations are added as regular repositories, but with
// better priorities than the actual (remote) repositories. This
// prevents the solver from showing conflicts when a package in a more
// specific installation location overrides a package in a more general
// one. Instead any requirement that is already installed in a more
// general installation location will turn up as to be installed as
// well. But we can easily filter those out.
_AddInstalledRepository(fSystemRepository);
if (!fSystemRepository->IsInstalled())
_AddInstalledRepository(fHomeRepository);
}
// add other repositories
if ((flags & B_ADD_REMOTE_REPOSITORIES) != 0) {
BPackageRoster roster;
BStringList repositoryNames;
error = roster.GetRepositoryNames(repositoryNames);
if (error != B_OK) {
fUserInteractionHandler->Warn(error,
"failed to get repository names");
}
int32 repositoryNameCount = repositoryNames.CountStrings();
for (int32 i = 0; i < repositoryNameCount; i++) {
_AddRemoteRepository(roster, repositoryNames.StringAt(i),
(flags & B_REFRESH_REPOSITORIES) != 0);
}
}
}
示例13:
status_t
VirtualDirectoryEntryList::_InitMergedDirectory(
const BStringList& directoryPaths)
{
status_t error = fMergedDirectory.Init();
if (error != B_OK)
return error;
int32 count = directoryPaths.CountStrings();
for (int32 i = 0; i < count; i++)
fMergedDirectory.AddDirectory(directoryPaths.StringAt(i));
return B_OK;
}
示例14: list_targets
static void
list_targets(bool verbose)
{
BLaunchRoster roster;
BStringList targets;
status_t status = roster.GetTargets(targets);
if (status != B_OK) {
fprintf(stderr, "%s: Could not get target listing: %s\n", kProgramName,
strerror(status));
exit(EXIT_FAILURE);
}
for (int32 i = 0; i < targets.CountStrings(); i++)
puts(targets.StringAt(i).String());
}
示例15: context
void
MainWindow::_RefreshRepositories(bool force)
{
if (fSinglePackageMode)
return;
BPackageRoster roster;
BStringList repositoryNames;
status_t result = roster.GetRepositoryNames(repositoryNames);
if (result != B_OK)
return;
DecisionProvider decisionProvider;
JobStateListener listener;
BContext context(decisionProvider, listener);
BRepositoryCache cache;
for (int32 i = 0; i < repositoryNames.CountStrings(); ++i) {
const BString& repoName = repositoryNames.StringAt(i);
BRepositoryConfig repoConfig;
result = roster.GetRepositoryConfig(repoName, &repoConfig);
if (result != B_OK) {
// TODO: notify user
continue;
}
if (roster.GetRepositoryCache(repoName, &cache) != B_OK || force) {
try {
BRefreshRepositoryRequest refreshRequest(context, repoConfig);
result = refreshRequest.Process();
} catch (BFatalErrorException ex) {
BString message(B_TRANSLATE("An error occurred while "
"refreshing the repository: %error% (%details%)"));
message.ReplaceFirst("%error%", ex.Message());
message.ReplaceFirst("%details%", ex.Details());
_NotifyUser("Error", message.String());
} catch (BException ex) {
BString message(B_TRANSLATE("An error occurred while "
"refreshing the repository: %error%"));
message.ReplaceFirst("%error%", ex.Message());
_NotifyUser("Error", message.String());
}
}
}
}