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


C++ TPckgBuf::Size方法代码示例

本文整理汇总了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
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:42,代码来源:DownloadMgrSrvSession.cpp


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