本文整理汇总了C++中BStringList::Join方法的典型用法代码示例。如果您正苦于以下问题:C++ BStringList::Join方法的具体用法?C++ BStringList::Join怎么用?C++ BStringList::Join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BStringList
的用法示例。
在下文中一共展示了BStringList::Join方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BPathFinder
//.........这里部分代码省略.........
case 'c':
separator = optarg;
break;
case 'd':
dependency = optarg;
break;
case 'e':
existingOnly = true;
break;
case 'h':
print_usage_and_exit(false);
break;
case 'l':
for (size_t i = 0; i < kDirectoryConstantCount; i++) {
const DirectoryConstantEntry& entry
= kDirectoryConstants[i];
printf("%s\n - %s\n", entry.string, entry.description);
}
exit(0);
case 'p':
referencePath = optarg;
break;
default:
print_usage_and_exit(true);
break;
}
}
// The remaining arguments are the kind constant and optionally the subpath.
if (optind >= argc || optind + 2 < argc)
print_usage_and_exit(true);
const char* kindConstant = argv[optind++];
const char* subPath = NULL;
if (optind >= argc)
subPath = argv[optind++];
// resolve the directory constant
path_base_directory baseDirectory = B_FIND_PATH_IMAGE_PATH;
bool found = false;
for (size_t i = 0; i < kDirectoryConstantCount; i++) {
const DirectoryConstantEntry& entry = kDirectoryConstants[i];
if (strcmp(kindConstant, entry.string) == 0) {
found = true;
baseDirectory = entry.constant;
break;
}
}
if (!found) {
fprintf(stderr, "Error: Unsupported directory constant \"%s\".\n",
kindConstant);
exit(1);
}
if (referencePath != NULL) {
BPath path;
status_t error = BPathFinder(referencePath, dependency).FindPath(
architecture, baseDirectory, subPath,
existingOnly ? B_FIND_PATH_EXISTING_ONLY : 0, path);
if (error != B_OK) {
fprintf(stderr, "Error: Failed to find path: %s\n",
strerror(error));
exit(1);
}
printf("%s\n", path.Path());
} else {
BStringList paths;
status_t error = BPathFinder::FindPaths(architecture, baseDirectory,
subPath, existingOnly ? B_FIND_PATH_EXISTING_ONLY : 0, paths);
if (error != B_OK) {
fprintf(stderr, "Error: Failed to find paths: %s\n",
strerror(error));
exit(1);
}
if (separator != NULL) {
BString result = paths.Join(separator);
if (result.IsEmpty()) {
fprintf(stderr, "Error: Out of memory!\n");
exit(1);
}
printf("%s\n", result.String());
} else {
int32 count = paths.CountStrings();
for (int32 i = 0; i < count; i++)
printf("%s\n", paths.StringAt(i).String());
}
}
return 0;
}