本文整理汇总了C++中BNode::InitCheck方法的典型用法代码示例。如果您正苦于以下问题:C++ BNode::InitCheck方法的具体用法?C++ BNode::InitCheck怎么用?C++ BNode::InitCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BNode
的用法示例。
在下文中一共展示了BNode::InitCheck方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*! 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;
}
示例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) {
// compare the node_refs
node_ref ref1, ref2;
if (GetNodeRef(&ref1) != B_OK)
return false;
if (node.GetNodeRef(&ref2) != B_OK)
return false;
return (ref1 == ref2);
}
return false;
}
示例3: HandleRequest
status_t HModuleRoster::HandleRequest( RequestPB *pb )
{
BEntry entry;
BNode node;
BNodeInfo info;
char mimeType[128], vmimeType[128];
status_t status = B_OK;
int32 parentCount = 0;
BPath absPath, resourcePath( "/" );
resourcePath.Append( pb->brURI->path );
pb->resourcePath = &resourcePath;
pb->mimeType = mimeType;
// fix for "hostname//" request crash
// wade majors <[email protected] - Mar-09-2001
if (resourcePath.Path() == NULL)
{
resourcePath.SetTo("null");
pb->resourcePath = &resourcePath;
}
//
VResource *vres = NULL;
// *****
// Look for "real" resource
// *****
do
{
// Small optimization... if not done, the path normalizer will
// be tickled when a resource does not exit
if( (resourcePath.Path())[1] == 0 )
{
status = B_ERROR;
break;
}
absPath.SetTo( pb->webDirectory->Path(), resourcePath.Path()+1 );
if( (entry.SetTo( absPath.Path(), true ) == B_OK)&&(node.SetTo( &entry ) == B_OK)
&&(info.SetTo( &node ) == B_OK) )
{
const char *resMIME;
// Cheap hack for directories without a MIME type
if(info.GetType( mimeType ) != B_OK)
strcpy( mimeType, "application/x-vnd.Be-directory" );
if( (resMIME = pb->vresources->MatchVRes( pb->brURI->path, true, &vres )) )
strcpy( vmimeType, resMIME );
else
strcpy( vmimeType, mimeType );
break;
}
parentCount++;
}while( (status = resourcePath.GetParent( &resourcePath )) == B_OK );
entry.Unset();
if( node.InitCheck() )
node.Unset();
// *****
// Look for Virtual Resource if no "real" resource was found.
// *****
if( (status != B_OK)||((parentCount != 0)&&(strcmp(mimeType, "application/x-vnd.Be-directory") == 0)) )
{
const char *resMIME;
if( (resMIME = pb->vresources->MatchVRes( pb->brURI->path, false, &vres )) )
{
strcpy( vmimeType, resMIME );
strcpy( mimeType, resMIME );
}
else
{
HTTPResponse response;
response.SetHTMLMessage( 404 ); // Not Found
pb->request->SendReply( &response );
return B_ERROR;
}
}
// *****
// Find handler module for resource
// *****
HModule *module, *prefModule = NULL;
int32 priority, highestPriority = 0;
for( int32 i=0; (module = (HModule *)moduleList.ItemAt(i)); i++ )
{
if( module->CanHandleResource( vmimeType, pb->request->GetMethod(), &priority )&&
(priority > highestPriority) )
{
highestPriority = priority;
prefModule = module;
}
}
// *****
// Setup PB
//.........这里部分代码省略.........