本文整理汇总了C++中TPckgBuf::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ TPckgBuf::Size方法的具体用法?C++ TPckgBuf::Size怎么用?C++ TPckgBuf::Size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPckgBuf
的用法示例。
在下文中一共展示了TPckgBuf::Size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DownloadMgrAttachL
// ---------------------------------------------------------
// CDownloadMgrSession::DownloadMgrAttachL
// ---------------------------------------------------------
//
void CDownloadMgrSession::DownloadMgrAttachL()
{
CLOG_ENTERFN( "CDownloadMgrSession::DownloadMgrAttachL" )
// The client would like to attach the dowmloads were created previously.
// Here, we create a buffer with the unique handles of download subsessions
// and copy it to the client's address space.
CLOG_WRITE_FORMAT( "CDownloadMgrSession::DownloadMgrAttachL iClientAppInstance %d", iClientAppInstance );
CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL();
CleanupStack::PushL( currentDownloads );
TPckgBuf<TInt> arrayPckg;
HBufC8* buf = HBufC8::NewLC( currentDownloads->Count() * arrayPckg.Size() );
// Cerate subsessions one by one and write the unique handles to the client.
// Later the handles is used by the client subsession to attach to the server.
for( TInt i = 0; i < currentDownloads->Count(); i++ )
{
CHttpDownload* httpDownload = (*currentDownloads)[i];
// make a new download object
CDownloadSubSession* download = CDownloadSubSession::NewL( this, httpDownload );
CleanupStack::PushL( download );
// add object to object container to gererate unique id
iObjectContainer->AddL( download );
// add object to object index; this returns a unique handle so we can get it again
CLOG_WRITE_FORMAT( "CDownloadMgrSession::DownloadMgrAttachL, download %d", download );
arrayPckg() = iObjectIx->AddL( download );
CLOG_WRITE_FORMAT( "CDownloadMgrSession::DownloadMgrAttachL, iObjectIx->ActiveCount() %d", iObjectIx->ActiveCount() );
// Store handle to the subsession. It is used when the URL is checked.
download->SetHandle( arrayPckg() );
CleanupStack::Pop( download ); //download
buf->Des().Append( arrayPckg );
}
TPtr8 ptr = buf->Des();
Write( 0, CurrentMessage(), ptr );
CleanupStack::PopAndDestroy( buf ); // buf
currentDownloads->Reset();
CleanupStack::PopAndDestroy( currentDownloads ); // currentDownloads
}