本文整理汇总了C++中BEntry::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BEntry::GetSize方法的具体用法?C++ BEntry::GetSize怎么用?C++ BEntry::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BEntry
的用法示例。
在下文中一共展示了BEntry::GetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
// --------------------------------------------------
status_t
Fonts::LookupFontFiles(BPath path)
{
BDirectory dir(path.Path());
BEntry entry;
if (dir.InitCheck() != B_OK)
return B_ERROR;
dir.Rewind();
while (dir.GetNextEntry(&entry) >= 0) {
BPath name;
char fn[512];
font_type ft = unknown_type; // to keep the compiler silent.
off_t size;
status_t status;
entry.GetPath(&name);
if (entry.IsDirectory())
// recursivly lookup in sub-directories...
LookupFontFiles(name);
if (! entry.IsFile())
continue;
fn[0] = 0;
ft = unknown_type;
// is it a truetype file?
status = ttf_get_fontname(name.Path(), fn, sizeof(fn));
if (status == B_OK ) {
ft = true_type_type;
} else {
// okay, maybe it's a postscript type file?
status = psf_get_fontname(name.Path(), fn, sizeof(fn));
if (status == B_OK) {
ft = type1_type;
}
}
if (ft == unknown_type)
// not a font file...
continue;
if (entry.GetSize(&size) != B_OK)
size = 1024*1024*1024;
REPORT(kDebug, -1, "Installed font %s -> %s", fn, name.Path());
fFontFiles.AddItem(new FontFile(fn, name.Path(), size, ft, size < 100*1024));
} // while dir.GetNextEntry()...
return B_OK;
}
示例2: RefsReceived
void PecoApp::RefsReceived ( BMessage* msg ) {
entry_ref ref;
BPath aPath;
BEntry aEntry;
off_t size;
time_t timer;
fWindow->Lock();
BTextControl* pfadView = (BTextControl *)fWindow->FindView("pfadView");
fWindow->Unlock();
//Pfad finden
for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) if ( ref.device > 1 ) break;
if ( ref.device > 1 ) {
New();
fWindow->Lock();
((PecoApp *)be_app)->fStatusBar->SetText(STATUS_IMPORT);
fWindow->Unlock();
aEntry = BEntry(&ref);
BPath( &aEntry ).GetParent(&fPfad);
fWindow->Lock();
pfadView->SetText( fPfad.Path() );
fWindow->Unlock();
//zählen
type_code typeFound;
long total = 0;
msg->GetInfo("refs", &typeFound, &total);
fWindow->Lock();
fStatusBar->SetMaxValue( total );
fWindow->Unlock();
BPath newPath;
bool didntshow_msgmultidir = true;
for ( int i=0; msg->FindRef("refs", i, &ref) == B_OK; i++ ) {
fWindow->Lock();
fStatusBar->Update(1);
fWindow->Unlock();
// Laufwerke ausfiltern
if ( ref.device == 1 ) continue;
// Dateien mit falschem Pfad ausfiltern
aEntry = BEntry(&ref);
aPath = BPath(&aEntry);
BPath( &aEntry ).GetParent(&newPath);
if ( (strcmp( fPfad.Path(), newPath.Path() ) != 0 ) ) {
if ( didntshow_msgmultidir ) {
BAlert* myAlert = new BAlert(NULL, MESSAGE_MULTIDIR, STR_OK);
myAlert->Go();
didntshow_msgmultidir = false;
}
continue;
}
// Werte auslesen
if (aEntry.IsFile()) aEntry.GetSize(&size);
else
if (aEntry.IsSymLink()) size = -1;
else
if (aEntry.IsDirectory()) size = -2;
else continue;
aEntry.GetModificationTime(&timer);
fList->AddItem(new FileListItem(aPath.Leaf(), size, timer, &ref));
}
fWindow->Lock();
fListView->AddList(fList);
float Hoehe = be_plain_font->Size() + 2;
if (Hoehe < 18) {
BListItem* myListItem;
for (int i=0; (myListItem = fListView->ItemAt(i)); i++) myListItem->SetHeight(18);
// Zum Updaten:
fListView->AddItem(myListItem = new BStringItem(""));
fListView->RemoveItem(myListItem);
}
fStatusBar->Reset(STATUS_STATUS);
fStatusBar->SetMaxValue(fList->CountItems());
fWindow->Unlock();
MakeList();
}
fWindow->Activate();
UpdateWindowStatus();
}