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


C++ TPath::Format方法代码示例

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


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

示例1: ApplyCacheOverridesL

void CHttpCacheManager::ApplyCacheOverridesL(CRepository& aRepository, const TUint32& aSecIdInt, TBool& aCacheEnabled, TInt& aCacheSize, TBool& aOpCacheEnabled, TBool& aVssCacheEnabled, TDes& aPath, const TDesC& aDefaultDrive)
    {
    TDriveUnit drive(aDefaultDrive);
    
    // set defaults
    if(aSecIdInt == KUIDBROWSERNG)       // for the browser, force use of Operator and VSS caches
        {
        aOpCacheEnabled = ETrue;
        aVssCacheEnabled = ETrue;
        }
    
    // read override string from centrep
    HBufC16 *overrideBuf = HBufC16::NewLC(64);
    TPtr overrideStr(overrideBuf->Des());
    TInt strLen;
    TInt err = aRepository.Get(KCacheManagerHttpCacheProcessOverride, overrideStr, strLen);
    if(strLen > overrideBuf->Length())
        {
        overrideBuf = overrideBuf->ReAllocL(strLen);
        // make sure cleanup stack contains correct pointer since ReAllocL always allocates a new des for larger space.
        CleanupStack::Pop();
        CleanupStack::PushL(overrideBuf);
        // reassign the TPtr
        overrideStr.Set(overrideBuf->Des());
        // pull in the whole string
        aRepository.Get(KCacheManagerHttpCacheProcessOverride, overrideStr, strLen);
        }
    // if we failed to load an override string, use the default.
    if( overrideStr.Length() == 0 )
        {
        CleanupStack::PopAndDestroy( overrideBuf );
        overrideBuf = KDefaultOverrideString().AllocLC();
        overrideStr.Set( overrideBuf->Des() );
        }
    // Built in Lex likes white space to separate strings, but easier to enter with ; separators.  Replace all ; with spaces.
    TInt pos=0;
    do{
        if(overrideStr[pos] == ';')
            {
            overrideStr[pos] = ' ';
            }
        pos++;
    }while(pos < overrideStr.Length());
    
    TLex overrideLex(overrideStr);
    do{
        TUint32 tempId;
        User::LeaveIfError(overrideLex.BoundedVal(tempId,EHex,KMaxTUint32));
        if(overrideLex.TokenLength() != 8)  // if we're not pointing at an SID in the string, we are incorrect and the override is broken.
            User::Leave(KErrCorrupt);
        overrideLex.SkipSpace();
        TInt32 tempCacheEnabled;
        User::LeaveIfError(overrideLex.BoundedVal(tempCacheEnabled,KMaxTInt32));
        overrideLex.SkipSpace();
        TInt32 tempCacheSize;
        User::LeaveIfError(overrideLex.BoundedVal(tempCacheSize,KMaxTInt32));
        overrideLex.SkipSpace();
        TDriveUnit tempDrive(overrideLex.NextToken());
        overrideLex.SkipSpaceAndMark();
        // found a hex SID matching ours, use the parameters.
        if(tempId == aSecIdInt)
            {
            aCacheEnabled = tempCacheEnabled;
            aCacheSize = tempCacheSize * 1024; // conf is in KB
            drive = tempDrive;
            break;
            }
    }while(!overrideLex.Eos());

    // Modify drive letter on aPath to match
    TParsePtr parsePath(aPath);
    TPtrC pathStr(parsePath.Path());
    TPath tempPath;
    tempPath.Format(_L("%c:%S"), TInt(drive)+'A', &pathStr);
    aPath.Copy(tempPath);
    HttpCacheUtil::EnsureTrailingSlash( aPath );
    
    CleanupStack::PopAndDestroy(overrideBuf);
    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:79,代码来源:HttpCacheManager.cpp

示例2: ConstructL

// ---------------------------------------------------------------------------
// 2nd phase constructor
// ---------------------------------------------------------------------------
//
void CCatalogsHttpDownloadManager::ConstructL( TBool aCleanup )
{
    DLTRACEIN((""));
    User::LeaveIfError( iFs.Connect() );

    // shared so that RFiles can be given to Download manager
    User::LeaveIfError( iFs.ShareProtected() );

    QString DmgrUid(QString::number(KNCDEngineAppID));
    iDmgr =  new DownloadManager(DmgrUid);
    iDmgr->initialize();
    iQTmgr = new CCatalogsHttpQTDownloadManager(this,iDmgr);

    TUid sessionId( TUid::Uid( iSessionId ) );
    if ( aCleanup )
    {
        DLTRACE(("Cleaning download manager before connecting"));
        TUidName client( CleanUidName( sessionId ) );
        TPath path;
        path.Format( KCatalogsDownloadMgrPath, &client );

        CFileMan* fileman = CFileMan::NewL( iFs );
        CleanupStack::PushL( fileman );
        DLINFO(( _L("Clearing directory: %S"), &path ));
        // Ignoring errors
        fileman->Delete( path );
        CleanupStack::PopAndDestroy( fileman );
    }

    // Connect with the download manager
    // If the 3rd parameter == ETrue, this session inherits downloads
    // from other sessions that have the same UID.
    TInt err = KErrNone;
    TInt retries = KCatalogsDlMgrConnectRetryAttempts;

    do
    {
        if ( err != KErrNone )
        {
            DLERROR(("DL manager connection failed with err: %d, retry attempts left",
                     err, retries ));
            // This halts the whole thread which is not nice but shouldn't
            // be a problem since this should occur only when the download
            // manager is being shutdown when we try to connect to it
            User::After( KCatalogsDlMgrConnectRetryInterval );
        }
    }
    while ( err != KErrNone && retries-- );

    if( err != KErrNone )
    {
        DLINFO(("Leaving.. DL manager connection failed with: %d", err ));
        User::Leave( err );
    }

    DLTRACE(("ConnectL ok"));

    iDefaultConfig = CCatalogsHttpConfig::NewL();

    iNetworkManager = &CCatalogsHttpSessionManager::NetworkManagerL();
    iNetworkManager->AddObserverL( *this );

    // Restore downloads from previous sessions
//    RestoreDownloadsL();

    DLTRACEOUT((""));

}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:72,代码来源:catalogshttpdownloadmanagerimpl.cpp


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