当前位置: 首页>>代码示例>>C++>>正文


C++ BNode::Unset方法代码示例

本文整理汇总了C++中BNode::Unset方法的典型用法代码示例。如果您正苦于以下问题:C++ BNode::Unset方法的具体用法?C++ BNode::Unset怎么用?C++ BNode::Unset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BNode的用法示例。


在下文中一共展示了BNode::Unset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: strerror

int
main(int argc, char **argv)
{
	if (argc != 2) {
		fprintf(stderr, "usage: lock_node <file>\n");
		return 1;
	}

	BNode node;
	status_t status = node.SetTo(argv[1]);
	if (status != B_OK) {
		fprintf(stderr, "lock_node: could not open \"%s\": %s\n", argv[1], strerror(status));
		return 1;
	}

	status = node.Lock();
	if (status != B_OK) {
		fprintf(stderr, "lock_node: could not lock \"%s\": %s\n", argv[1], strerror(status));
		return 1;
	}

	puts("press <enter> to continue...");
	char a[5];
	fgets(a, 5, stdin);

	node.Unlock();
	node.Unset();
	return 0;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:29,代码来源:lock_node_test.cpp

示例2: 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
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:RobinHood,代码行数:101,代码来源:HModuleRoster.cpp


注:本文中的BNode::Unset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。