本文整理汇总了C++中BQuery::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ BQuery::Clear方法的具体用法?C++ BQuery::Clear怎么用?C++ BQuery::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BQuery
的用法示例。
在下文中一共展示了BQuery::Clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filePath
status_t
TeamWindow::_RetrieveMatchingSourceEntries(const BString& path,
BStringList* _entries)
{
BPath filePath(path);
status_t error = filePath.InitCheck();
if (error != B_OK)
return error;
_entries->MakeEmpty();
BQuery query;
BString predicate;
query.PushAttr("name");
query.PushString(filePath.Leaf());
query.PushOp(B_EQ);
error = query.GetPredicate(&predicate);
if (error != B_OK)
return error;
BVolumeRoster roster;
BVolume volume;
while (roster.GetNextVolume(&volume) == B_OK) {
if (!volume.KnowsQuery())
continue;
if (query.SetVolume(&volume) != B_OK)
continue;
error = query.SetPredicate(predicate.String());
if (error != B_OK)
continue;
if (query.Fetch() != B_OK)
continue;
entry_ref ref;
while (query.GetNextRef(&ref) == B_OK) {
filePath.SetTo(&ref);
_entries->Add(filePath.Path());
}
query.Clear();
}
return B_OK;
}
示例2:
void
Feeder::RemoveQuery(BVolume *volume)
{
BQuery *query ;
BVolume* iter_volume ;
for(int i = 0 ; (iter_volume = (BVolume*)fVolumeList.ItemAt(i)) != NULL
; i++) {
if (iter_volume->Device() == volume->Device()) {
fVolumeList.RemoveItem(iter_volume) ;
break ;
}
}
for (int i = 0 ; (query = (BQuery*)fQueryList.ItemAt(i)) != NULL ; i++) {
if (volume->Device() == query->TargetDevice()) {
query->Clear() ;
fQueryList.RemoveItem(query) ;
delete query ;
delete volume ;
break ;
}
}
}
示例3: duplicates_exist
bool duplicates_exist (const char * signature)
{
BVolumeRoster roster;
BVolume volume;
BQuery query;
BString query_string = "BEOS:APP_SIG=";
BEntry entry;
mode_t permissions;
uid_t owner;
gid_t group;
int32 query_hits = 0;
query_string += signature;
while (roster.GetNextVolume(& volume) == B_OK)
{
if (volume.KnowsQuery())
{
PRINT(("volume.KnowsQuery()\n"));
char volname [B_FILE_NAME_LENGTH];
volume.GetName(volname);
PRINT(("volume: %s\n", volname));
query.Clear();
if (query.SetVolume(& volume) == B_OK)
{
PRINT(("query.SetVolume(& volume) == B_OK\n"));
if (query.SetPredicate(query_string.String()) == B_OK)
{
PRINT(("query.SetPredicate(%s) == B_OK\n", query_string.String()));
if (query.Fetch() == B_OK)
{
PRINT(("query.Fetch() == B_OK\n"));
while (query.GetNextEntry(& entry) == B_OK)
{
PRINT(("query.GetNextEntry(& entry) == B_OK\n"));
entry.GetPermissions(& permissions);
entry.GetOwner(& owner);
entry.GetGroup(& group);
BPath path (& entry);
// if (access(path.Path(), X_OK))
if (((owner == getuid()) && (permissions & S_IXUSR))
|| ((group == getgid()) && (permissions & S_IXGRP))
|| (permissions & S_IXOTH))
{
PRINT(("path is executable: %s\n", path.Path()));
query_hits++;
}
else
{
PRINT(("path is NOT executable: %s\n", path.Path()));
}
}
}
}
}
}
fflush(stdout);
}
if (query_hits > 1)
return true;
else
return false;
}
示例4: 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"));
}
);
}