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


C++ TDes8::AllocL方法代码示例

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


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

示例1: CompleteUnitWaitPushL

/**
 * -Reads in the whole Msg. Header & Body From the WSS stack 
 * (i.e the test Harness) and Creates a Local Copy.
 * -Copy the Msg. Header & Body to Watcher Buffers:
 *		if the Watcher Buffers are big enough to hold the message,
 *		then the whole Mgs is copied and we Complete with KErrNone.
 *		if the Watcher Buffers are smaller then the Msg is copied 
 *      in blocks of size equal to the size of the Watcher Buffers
 *      completing with EMoreData every time until the watcher gets
 *		the whole Msg. At that point there is no more data to be 
 *		copied then we complete with KErrNone.
 */
EXPORT_C void CDummyWSPCLConn::CompleteUnitWaitPushL(TDes8& aBody,TDes8& aHeaders)
	{
	TPushID id;
	id=99;
	// Only read data from the WSS stack the first call
	if (iPushHeadersDataOffset == 0 && iPushBodyDataOffset == 0) 
		{
		__ASSERT_DEBUG(iPushHeadersData == 0, User::Panic(_L("headers != 0"), 0));
		__ASSERT_DEBUG(iPushBodyData == 0, User::Panic(_L("body != 0"), 0));
		
		TUint bodySize = aBody.Size();
		TUint headersSize =aHeaders.Size();		
		
		if (bodySize==0 && headersSize==0) 
			User::Leave(RWSPCLConn::EDataNotAvailable);
		
		iPushHeadersData= aHeaders.AllocL();
		iPushBodyData= aBody.AllocL();
		*iID=id;//**** Generate an Id per Msg, Not Supported in R1
		
		iPushHeadersData->Des().SetLength(headersSize);
		iPushBodyData->Des().SetLength(bodySize);
		}

	TInt clientHeadersSize = iClientHeaders->MaxSize();
	TInt clientBodySize = iClientBody->MaxSize();
	
	TInt headersRetSize = Min(clientHeadersSize, (iPushHeadersData->Size() - iPushHeadersDataOffset));
	TInt bodyRetSize = Min(clientBodySize, (iPushBodyData->Size() - iPushBodyDataOffset));

	iClientHeaders->Append(iPushHeadersData->Mid(iPushHeadersDataOffset, headersRetSize));
	iClientBody->Append(iPushBodyData->Mid(iPushBodyDataOffset, bodyRetSize));

	iPushHeadersDataOffset += headersRetSize;
	iPushBodyDataOffset += bodyRetSize;
	
	__ASSERT_DEBUG(iPushBodyDataOffset <= iPushBodyData->Size(), User::Panic(_L("Body offset too big"), 0));
	__ASSERT_DEBUG(iPushHeadersDataOffset <= iPushHeadersData->Size(), User::Panic(_L("Headers offset too big"), 0));
	
	// Are we done yet?
	if (iPushHeadersDataOffset == iPushHeadersData->Size() &&
		iPushBodyDataOffset == iPushBodyData->Size() )
		{
		delete iPushHeadersData;
		delete iPushBodyData;
		iPushHeadersData = 0;
		iPushBodyData = 0;
		iPushHeadersDataOffset = 0;
		iPushBodyDataOffset = 0;
		User::RequestComplete(iStatus,KErrNone);
		}
	else
		User::RequestComplete(iStatus,RWAPConn::EMoreData);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:66,代码来源:dummyWapStack.cpp


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