本文整理汇总了C++中BNode::GetStat方法的典型用法代码示例。如果您正苦于以下问题:C++ BNode::GetStat方法的具体用法?C++ BNode::GetStat怎么用?C++ BNode::GetStat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BNode
的用法示例。
在下文中一共展示了BNode::GetStat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fDocIO
CDoc::CDoc(const char* mimetype, BLooper *target, const entry_ref *doc)
: fDocIO(NULL)
, fSavePanel(NULL)
, fMimeType(mimetype ? mimetype : "")
, fDirty(false)
, fReadOnly(false)
, fEncoding(B_UNICODE_UTF8)
, fLineEndType(kle_LF)
{
fDocIO = new CLocalDocIO(this, doc, target);
FailNil(fDocIO);
if (doc)
{
BEntry e;
FailOSErr(e.SetTo(doc, true));
FailOSErr(e.GetParent(&gCWD));
BNode node;
FailOSErr(node.SetTo(doc));
struct stat st;
FailOSErr(node.GetStat(&st));
fReadOnly = !((gUid == st.st_uid && (S_IWUSR & st.st_mode))
|| (gGid == st.st_gid && (S_IWGRP & st.st_mode))
|| (S_IWOTH & st.st_mode));
char s[NAME_MAX];
if (BNodeInfo(&node).GetType(s) == B_OK)
fMimeType = s;
}
sfDocList.push_back(this);
}
示例2:
/*! Tests whether this and the supplied BNode object are equal.
Two BNode objects are said to be equal if they're set to the same node,
or if they're both \c B_NO_INIT.
\param node the BNode to be compared with
\return \c true, if the BNode objects are equal, \c false otherwise
*/
bool
BNode::operator==(const BNode &node) const
{
if (fCStatus == B_NO_INIT && node.InitCheck() == B_NO_INIT)
return true;
if (fCStatus == B_OK && node.InitCheck() == B_OK) {
// Check if they're identical
BPrivate::Storage::Stat s1, s2;
if (GetStat(&s1) != B_OK)
return false;
if (node.GetStat(&s2) != B_OK)
return false;
return (s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino);
}
return false;
}