本文整理汇总了C++中BDirectory::IsRootDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ BDirectory::IsRootDirectory方法的具体用法?C++ BDirectory::IsRootDirectory怎么用?C++ BDirectory::IsRootDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BDirectory
的用法示例。
在下文中一共展示了BDirectory::IsRootDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluateRef
status_t TElementsSorter::EvaluateRef(entry_ref &ref)
{
struct stat st;
BEntry entry;
// Can we create a BEntry?
if (entry.SetTo(&ref, false) != B_OK)
return B_ERROR;
// Can we get a BStatable?
if (entry.GetStat(&st) != B_OK)
return B_ERROR;
// Is it a SymLink?
if (S_ISLNK(st.st_mode))
return HandleLink(ref, st);
// How about a File?
else if (S_ISREG(st.st_mode))
return HandleFile(ref, st);
// A Directory?
else if (S_ISDIR(st.st_mode)) {
BDirectory dir;
if (dir.SetTo(&ref) != B_OK)
return B_ERROR;
if (dir.IsRootDirectory())
return HandleVolume(ref, st, dir);
else
return HandleDirectory(ref, st, dir);
}
// No luck
return B_ERROR;
}
示例2: EvaluateRef
status_t TQueueDialog::EvaluateRef(entry_ref &ref)
{
struct stat st;
BEntry entry;
// Can we create a BEntry?
if (entry.SetTo(&ref, false) != B_OK)
{
ERROR("TQueueDialog::HandleRefsMessage() - BEntry SetTo() failure -\n");
return B_ERROR;
}
// Can we get a BStatable?
if (entry.GetStat(&st) != B_OK)
{
ERROR("TQueueDialog::HandleRefsMessage() - BEntry GetStat() failure -\n");
return B_ERROR;
}
// Is it a SymLink?
if (S_ISLNK(st.st_mode))
return HandleLink(ref, st);
// How about a File?
else if (S_ISREG(st.st_mode))
return HandleFile(ref, st);
// A Directory?
else if (S_ISDIR(st.st_mode))
{
BDirectory dir;
if (dir.SetTo(&ref) != B_OK)
{
return B_ERROR;
}
if (dir.IsRootDirectory())
return HandleVolume(ref, st, dir);
else
return HandleDirectory(ref, st, dir);
}
// No luck
return B_ERROR;
}
示例3: str
status_t
PDirectory::GetProperty(const char *name, PValue *value, const int32 &index) const
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
BDirectory *backend = (BDirectory*)fBackend;
if (str.ICompare("IsRoot") == 0)
((BoolProperty*)prop)->SetValue(backend->IsRootDirectory());
else if (str.ICompare("EntryCount") == 0)
((IntProperty*)prop)->SetValue(backend->CountEntries());
else
{
return PNode::GetProperty(name, value, index);
}
return prop->GetValue(value);
}
示例4: opener
void
Model::ResetIconFrom()
{
BModelOpener opener(this);
if (InitCheck() != B_OK)
return;
// mirror the logic from FinishSettingUpType
if ((fBaseType == kDirectoryNode || fBaseType == kVolumeNode
|| fBaseType == kTrashNode || fBaseType == kDesktopNode)
&& !CheckNodeIconHint(fNode)) {
BDirectory* directory = dynamic_cast<BDirectory*>(fNode);
if (WellKnowEntryList::Match(NodeRef()) > (directory_which)-1) {
fIconFrom = kTrackerSupplied;
return;
} else if (directory != NULL && directory->IsRootDirectory()) {
fIconFrom = kVolume;
return;
}
}
fIconFrom = kUnknownSource;
}