本文整理汇总了C++中BQuery::GetNextDirents方法的典型用法代码示例。如果您正苦于以下问题:C++ BQuery::GetNextDirents方法的具体用法?C++ BQuery::GetNextDirents怎么用?C++ BQuery::GetNextDirents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BQuery
的用法示例。
在下文中一共展示了BQuery::GetNextDirents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HMailItem
/***********************************************************
* Fetching
***********************************************************/
void
HQueryItem::Fetching()
{
bool some_success = false;
BVolume volume;
BVolumeRoster roster;
while (fQueries.CountItems())
{
delete static_cast<BQuery *>(fQueries.RemoveItem((int32)0));
}
uint32 count_items = 0;
while (roster.GetNextVolume(&volume) == B_OK)
{
BQuery *query = new BQuery;
fQueries.AddItem((void*)query);
query->Clear();
query->SetTarget(*fMessenger);
query->SetVolume(&volume);
query->SetPredicate(fPredicate.String());
char type[B_MIME_TYPE_LENGTH+1];
BNode node;
HMailItem *item(NULL);
if(query->Fetch() == B_OK)
{
some_success = true;
entry_ref ref;
char buf[4096];
dirent *dent;
int32 count;
int32 offset;
while (((count = query->GetNextDirents((dirent *)buf, 4096)) > 0) && (!fCancel))
{
offset = 0;
/* Now we step through the dirents. */
while (count-- > 0)
{
dent = (dirent *)buf + offset;
offset += dent->d_reclen;
/* Skip . and .. directory */
if(::strcmp(dent->d_name,".") == 0 || ::strcmp(dent->d_name,"..")== 0)
continue;
ref.device = dent->d_pdev;
ref.directory = dent->d_pino;
ref.set_name(dent->d_name);
if(node.SetTo(&ref) != B_OK)
continue;
node.ReadAttr("BEOS:TYPE",'MIMS',0,type,B_MIME_TYPE_LENGTH);
if(::strcmp(type,B_MAIL_TYPE) == 0)
{
fMailList.AddItem(item = new HMailItem(ref));
if(item && !item->IsRead() )
count_items++;
}
}
}
}DEBUG_ONLY(
else{
PRINT(("Query fetching was failed\n"));
}
);
}