本文整理汇总了C++中BEntry::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ BEntry::GetName方法的具体用法?C++ BEntry::GetName怎么用?C++ BEntry::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BEntry
的用法示例。
在下文中一共展示了BEntry::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dir
status_t
UninstallView::_ReloadAppList()
{
_ClearAppList();
if (fToPackages.InitCheck() != B_OK)
_CachePathToPackages();
BDirectory dir(fToPackages.Path());
status_t ret = dir.InitCheck();
if (ret != B_OK)
return ret;
fprintf(stderr, "Ichi! %s\n", fToPackages.Path());
BEntry iter;
while (dir.GetNextEntry(&iter) == B_OK) {
char filename[B_FILE_NAME_LENGTH];
if (iter.GetName(filename) != B_OK)
continue;
node_ref ref;
if (iter.GetNodeRef(&ref) != B_OK)
continue;
printf("Found package '%s'\n", filename);
_AddFile(filename, ref);
}
if (ret != B_ENTRY_NOT_FOUND)
return ret;
return B_OK;
}
示例2: GetDirectoryName
void TJerFile::GetDirectoryName(BDirectory *dir)
{
BEntry entry;
char name[B_FILE_NAME_LENGTH];
dir->GetEntry(&entry);
entry.GetName(name);
}
示例3: address
/***********************************************************
* SetFrom
***********************************************************/
void
HAddressView::SetFrom(const char* in_address)
{
if( ::strlen(in_address) == 0)
return;
BString address(in_address);
// Compare existing accounts
char name[B_FILE_NAME_LENGTH];
BPath path;
::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
path.Append(APP_NAME);
path.Append("Accounts");
BDirectory dir(path.Path());
status_t err = B_OK;
BEntry entry;
bool changed = false;
while(err == B_OK)
{
if( (err = dir.GetNextEntry(&entry)) != B_OK )
break;
BFile file(&entry,B_READ_ONLY);
if(file.InitCheck() == B_OK && entry.IsFile())
{
BMessage msg;
msg.Unflatten(&file);
BString myAddress;
PRINT(("%s\n",in_address));
if(msg.FindString("address",&myAddress) != B_OK)
myAddress = "";
// Change account
if(address.FindFirst(myAddress) != B_ERROR)
{
entry.GetName(name);
ChangeAccount(name);
// Set From menu
BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
BMenu *menu = field->Menu();
BMenuItem *item = menu->FindItem(name);
if(item)
item->SetMarked(true);
changed=true;
break;
}
}
}
if(!changed && cast_as(Window()->FindView("HMailView"),BTextView))
{
BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
BMenuItem *item(NULL);
item = field->Menu()->FindMarked();
if(item)
{
ChangeAccount(item->Label());
item->SetMarked(true);
}
}
}
示例4: MessageReceived
virtual void MessageReceived(BMessage* message)
{
switch (message->what) {
case MSG_PULSE: {
BEntry entry;
if (fHomeFolder.GetNextEntry(&entry) < B_OK) {
fHomeFolderCurrentEntry = 0;
fHomeFolder.Rewind();
fStatusBar->Reset("Label: ", "-Trailing");
if (fHomeFolder.GetNextEntry(&entry) < B_OK)
break;
} else
fHomeFolderCurrentEntry++;
char name[B_FILE_NAME_LENGTH];
if (entry.GetName(name) < B_OK)
break;
float value = 100.0 * fHomeFolderCurrentEntry
/ (fHomeFolderEntryCount - 1);
fStatusBar->SetTo(value, "Text", name);
break;
}
default:
BWindow::MessageReceived(message);
}
}
示例5: directory
void
NetServer::_ConfigureDevices(int socket, const char* startPath,
BMessage* suggestedInterface)
{
BDirectory directory(startPath);
BEntry entry;
while (directory.GetNextEntry(&entry) == B_OK) {
char name[B_FILE_NAME_LENGTH];
struct stat stat;
BPath path;
if (entry.GetName(name) != B_OK
|| !strcmp(name, "stack")
|| entry.GetPath(&path) != B_OK
|| entry.GetStat(&stat) != B_OK)
continue;
if (S_ISBLK(stat.st_mode) || S_ISCHR(stat.st_mode)) {
if (suggestedInterface != NULL
&& suggestedInterface->RemoveName("device") == B_OK
&& suggestedInterface->AddString("device", path.Path()) == B_OK
&& _ConfigureInterface(socket, *suggestedInterface) == B_OK)
suggestedInterface = NULL;
else
_ConfigureDevice(socket, path.Path());
} else if (entry.IsDirectory())
_ConfigureDevices(socket, path.Path(), suggestedInterface);
}
}
示例6: sizeof
void
BStatusView::InitStatus(int32 totalItems, off_t totalSize,
const entry_ref* destDir, bool showCount)
{
Init();
fTotalSize = totalSize;
fShowCount = showCount;
BEntry entry;
char name[B_FILE_NAME_LENGTH];
if (destDir && (entry.SetTo(destDir) == B_OK)) {
entry.GetName(name);
fDestDir = name;
}
BString buffer;
if (totalItems > 0) {
char totalStr[32];
buffer.SetTo(B_TRANSLATE("of %items"));
snprintf(totalStr, sizeof(totalStr), "%" B_PRId32, totalItems);
buffer.ReplaceFirst("%items", totalStr);
}
switch (fType) {
case kCopyState:
fStatusBar->Reset(B_TRANSLATE("Copying: "), buffer.String());
break;
case kCreateLinkState:
fStatusBar->Reset(B_TRANSLATE("Creating links: "),
buffer.String());
break;
case kMoveState:
fStatusBar->Reset(B_TRANSLATE("Moving: "), buffer.String());
break;
case kTrashState:
fStatusBar->Reset(
B_TRANSLATE("Emptying Trash" B_UTF8_ELLIPSIS " "),
buffer.String());
break;
case kDeleteState:
fStatusBar->Reset(B_TRANSLATE("Deleting: "), buffer.String());
break;
case kRestoreFromTrashState:
fStatusBar->Reset(B_TRANSLATE("Restoring: "), buffer.String());
break;
default:
break;
}
fStatusBar->SetMaxValue(1);
// SetMaxValue has to be here because Reset changes it to 100
Invalidate();
}
示例7:
BString
ApplicationTypeWindow::_Title(const BEntry& entry)
{
char name[B_FILE_NAME_LENGTH];
if (entry.GetName(name) != B_OK)
strcpy(name, "\"-\"");
BString title = B_TRANSLATE("%1 application type");
title.ReplaceFirst("%1", name);
return title;
}
示例8: title
BString
ApplicationTypeWindow::_Title(const BEntry& entry)
{
char name[B_FILE_NAME_LENGTH];
if (entry.GetName(name) != B_OK)
strcpy(name, "\"-\"");
BString title(name);
title.Append(" application type");
return title;
}
示例9: FillVendors
void PrinterSelectionView::FillVendors()
{
BDirectory directory("/boot/beos/etc/ppd");
BEntry entry;
while (directory.GetNextEntry(&entry) == B_OK) {
char name[B_FILE_NAME_LENGTH];
entry.GetName(name);
BPath path;
entry.GetPath(&path);
fVendors->AddItem(new FileItem(name, path.Path()));
}
}
示例10: model
bool
BNavMenu::AddNextItem()
{
if (fFlags & kVolumesOnly) {
BuildVolumeMenu();
return false;
}
BEntry entry;
if (fContainer->GetNextEntry(&entry) != B_OK) {
// we're finished
return false;
}
if (TrackerSettings().HideDotFiles()) {
char name[B_FILE_NAME_LENGTH];
if (entry.GetName(name) == B_OK && name[0] == '.')
return true;
}
Model model(&entry, true);
if (model.InitCheck() != B_OK) {
// PRINT(("not showing hidden item %s, wouldn't open\n", model->Name()));
return true;
}
QueryEntryListCollection* queryContainer
= dynamic_cast<QueryEntryListCollection*>(fContainer);
if (queryContainer && !queryContainer->ShowResultsFromTrash()
&& FSInTrashDir(model.EntryRef())) {
// query entry is in trash and shall not be shown
return true;
}
ssize_t size = -1;
PoseInfo poseInfo;
if (model.Node())
size = model.Node()->ReadAttr(kAttrPoseInfo, B_RAW_TYPE, 0,
&poseInfo, sizeof(poseInfo));
model.CloseNode();
// item might be in invisible
if (size == sizeof(poseInfo)
&& !BPoseView::PoseVisible(&model, &poseInfo))
return true;
AddOneItem(&model);
return true;
}
示例11: operator
status_t operator()(const BEntry& entry)
{
char name[B_FILE_NAME_LENGTH];
status_t result = entry.GetName(name);
if (result != B_OK)
return result;
int32 count = names.CountStrings();
for (int i = 0; i < count; ++i) {
if (names.StringAt(i).Compare(name) == 0)
return B_OK;
}
names.Add(name);
return B_OK;
}
示例12: dir
// Scans a directory and adds the entries it founds as strings to the
// given list
static int32
scan_directory(const char *directory, BList *list)
{
BEntry entry;
BDirectory dir(SERIAL_DIR);
char buf[B_OS_NAME_LENGTH];
ASSERT(list != NULL);
while (dir.GetNextEntry(&entry) == B_OK) {
entry.GetName(buf);
list->AddItem(strdup(buf));
};
return list->CountItems();
}
示例13:
bool
InitialIterator::FollowSubdir(BEntry& entry) const
{
if (!fRecurseDirs)
return false;
if (fSkipDotDirs) {
char nameBuf[B_FILE_NAME_LENGTH];
if (entry.GetName(nameBuf) == B_OK) {
if (*nameBuf == '.')
return false;
}
}
return true;
}
示例14: FillPrinters
void PrinterSelectionView::FillPrinters(const char* vendor)
{
MakeEmpty(fPrinters);
BList printers;
BDirectory directory(vendor);
BEntry entry;
while (directory.GetNextEntry(&entry) == B_OK) {
char name[B_FILE_NAME_LENGTH];
entry.GetName(name);
BPath path;
entry.GetPath(&path);
PPDParser parser(path.Path());
PPD* ppd = parser.ParseHeader();
if (parser.HasWarning()) {
fprintf(stderr, "Warning(s): %s", parser.GetWarningMessage());
}
if (ppd != NULL) {
BString label;
const char* s;
s = ppd->GetValue("ModelName");
if (s != NULL) {
label << s;
}
s = ppd->GetValue("PCFileName");
if (s != NULL) {
label << " [" << s << "]";
}
s = ppd->GetValue("Manufacturer");
if (s != NULL) {
label << " (" << s << ")";
}
printers.AddItem(new FileItem(label.String(), path.Path()));
delete ppd;
} else {
fprintf(stderr, "Parsing error (%s)\n%s\n", path.Path(),
parser.GetErrorMessage());
}
}
fPrinters->AddList(&printers);
}
示例15: SavedGames
void BeCheckersWindow::SavedGames(BListView *list) {
char name[B_FILE_NAME_LENGTH];
BEntry entry;
BDirectory dir;
BPath p;
find_directory(B_USER_DIRECTORY, &p);
p.Append(APP_SGP);
dir.SetTo(p.Path());
dir.Rewind();
while (dir.GetNextEntry(&entry) == B_OK) {
entry.GetName(name);
strtok(name, "."); // Strip the filename extension
list->AddItem(new BStringItem(name));
}
}