本文整理汇总了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);
}