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


C++ CDir类代码示例

本文整理汇总了C++中CDir的典型用法代码示例。如果您正苦于以下问题:C++ CDir类的具体用法?C++ CDir怎么用?C++ CDir使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: new

void CPolicyStore::ConstructPolicyListL()
    {
    // Using two policy lists (one for all and one for the visible
    // ones) makes it easy to support the concept of hidden and
    // visible policies. There's a slight memory penalty but this
    // is not serious as the number of policies is typically small).
    // Hidden policies differ from visible ones in only one aspect - 
    // they are not included in the policy listing returned to
    // the caller.
    
    // A list of all policies (both visible and hidden)
    iPolicyListAll = new (ELeave) CArrayFixFlat<TVpnPolicyInfo>(2);
    // A list of visible policies only
    iPolicyListVisible = new (ELeave) CArrayFixFlat<TVpnPolicyInfo>(2);

    TFindFile fileFinder(iFs);
    CDir* fileList; 

    TPath privateDir;
    User::LeaveIfError(iFs.PrivatePath(privateDir));
    TInt ret = fileFinder.FindWildByDir(KPolFilePat, privateDir, fileList);
    if (ret == KErrNone)
        {
        CleanupStack::PushL(fileList);
        
        for (TInt i = 0; i < fileList->Count(); i++)
            {
            TParse fileNameParser;
            fileNameParser.Set((*fileList)[i].iName, &fileFinder.File(), NULL);

            TVpnPolicyId policyId;
            
            // Only add the policy to the list its ID length is
            // acceptable (this is the case with all policies
            // that have been properly imported to the store)
            if (fileNameParser.Name().Length() <= policyId.MaxLength())
                {
                policyId.Copy(fileNameParser.Name());

                HBufC* pinFile = iFileUtil.GetPinFileNameLC(policyId);

                if (iFileUtil.FileExists(*pinFile))
                    {
                    AddPolicyL(policyId);
                    }
                CleanupStack::PopAndDestroy(pinFile);
                }
            }
        
        CleanupStack::PopAndDestroy(); // fileList
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:52,代码来源:policystore.cpp

示例2: DeleteFile

TInt CFileEngine::DeleteFile(const TDesC& aPath)
{
	
	TInt returnErr=0;
	CDir* dir;
	TInt err=iFs.GetDir(aPath,KEntryAttNormal|KEntryAttDir|KEntryAttHidden,ESortByDate,dir);

	if(err==KErrNone)
	{
		TInt tempInt = dir->Count();
		
		for(TInt i = 0;i < tempInt;i++)
		{
			TEntry iEntry = (*dir)[i];

			if(iEntry.IsDir())
			{
				TInt iLength=iEntry.iName.Length();
				if(iLength>0)
				{			
					TFileName filePath;
					filePath.Append(aPath);
					filePath.Append(iEntry.iName);
					filePath.Append(_L("\\"));
					DeleteFile(filePath);
				}
			}
			else
			{
				TFileName filePath;
				filePath.Append(aPath);
				filePath.Append(iEntry.iName);
				returnErr=BaflUtils::DeleteFile(iFs,filePath);
			}
		}
	}
	else
	{
		returnErr=err;
	}

	if(dir)
	{
		delete dir;
		dir=NULL;
	}

	returnErr=iFs.RmDir(aPath);
	return returnErr;
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:50,代码来源:FileEngine.cpp

示例3: fileSpecSb

int DeviceManagementNode::getChildrenMaxCount() {
    int count = 0;

    RFs fileSession;
    RFile file;
    int cleanupStackSize = 0;

    StringBuffer fileSpecSb(currentDir);
    concatDirs(fileSpecSb, "*.*");

    // TODO use utility function for string conversion
    TBuf8<DIM_MANAGEMENT_PATH> buf8((const unsigned char*)fileSpecSb.c_str());
    HBufC* fileSpec = CnvUtfConverter::ConvertToUnicodeFromUtf8L(buf8);
    CleanupStack::PushL(fileSpec);
    ++cleanupStackSize;

    //
    // Connect to the file server
    //
    fileSession.Connect();
    CleanupClosePushL(fileSession);
    ++cleanupStackSize;

    StringBuffer buf;

    //
    // Get the directories list, sorted by name
    // (Leave if an error occurs)
    //
    CDir* dirList;
    TRAPD(err, fileSession.GetDir(*fileSpec, KEntryAttDir|KEntryAttMatchExclusive,
                                  ESortByName, dirList));
    if (err != KErrNone || dirList == NULL) {
        goto finally;
    }
    CleanupStack::PushL(dirList);
    ++cleanupStackSize;

    count = dirList->Count();

finally:
    //
    // Close the connection with the file server
    // and destroy dirList
    //
    fileSession.Close();
    CleanupStack::PopAndDestroy(cleanupStackSize);
    return count;
}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:49,代码来源:DeviceManagementNode.cpp

示例4: TRAPD

RArray<TFileName> ListImages::searchJPGL(TFileName tot, RFs fs,
        TFileName current)
{
    RArray<TFileName> result;
    TInt i;
    TBuf<50> totalPath;
    TBuf<30> fileName;
    CDir* dirList;

    totalPath = tot;
    CleanupStack::PushL(dirList);
    if ((current.Length()) > 0)
        totalPath.Append(current);
    //CleanupClosePushL(result);
    TRAPD(err,fs.GetDir(totalPath, KEntryAttMaskSupported,
                        ESortByDate, dirList));
    CleanupStack::Pop(1);
    if (!dirList)
        return result;

    for (i = 0; i < dirList->Count(); i++)
    {
        if ((*dirList)[i].IsDir())
        {
            TFileName tmp;
            tmp.Append((*dirList)[i].iName);
            tmp.Append(_L("\\"));
            RArray<TFileName> res = searchJPGL(totalPath, fs, tmp);
            for (int j = 0; j < res.Count(); j++)
                result.Append(res[j]);
            res.Reset();

        }
        else
        {
            fileName = (*dirList)[i].iName;
            if (fileName.Find(_L(".jpg")) != KErrNotFound)
            {
                TBuf<50> tmp;
                tmp = totalPath;
                tmp.Append(fileName);
                result.Append(tmp);
                tmp.Delete(0, tmp.Length() - 1);
            }
        }
    }
    delete dirList;
    return result;
}
开发者ID:mba3gar,项目名称:SeniorMessageEncryption,代码行数:49,代码来源:CListImage.cpp

示例5: lock

void CDirectoryCache::AddFile(const std::string& strFile)
{
  CSingleLock lock (m_cs);

  std::string strPath = URIUtils::GetDirectory(strFile);
  URIUtils::RemoveSlashAtEnd(strPath);

  ciCache i = m_cache.find(strPath);
  if (i != m_cache.end())
  {
    CDir *dir = i->second;
    CFileItemPtr item(new CFileItem(strFile, false));
    dir->m_Items->Add(item);
    dir->SetLastAccess(m_accessCounter);
  }
}
开发者ID:7orlum,项目名称:xbmc,代码行数:16,代码来源:DirectoryCache.cpp

示例6: lock

void CDirectoryCache::AddFile(const std::string& strFile)
{
  CSingleLock lock (m_cs);

  // Get rid of any URL options, else the compare may be wrong
  std::string strPath = URIUtils::GetDirectory(CURL(strFile).GetWithoutOptions());
  URIUtils::RemoveSlashAtEnd(strPath);

  ciCache i = m_cache.find(strPath);
  if (i != m_cache.end())
  {
    CDir *dir = i->second;
    CFileItemPtr item(new CFileItem(strFile, false));
    dir->m_Items->Add(item);
    dir->SetLastAccess(m_accessCounter);
  }
}
开发者ID:Arcko,项目名称:xbmc,代码行数:17,代码来源:DirectoryCache.cpp

示例7: lock

void CDirectoryCache::PrintStats() const
{
  CSingleLock lock (m_cs);
  CLog::Log(LOGDEBUG, "%s - total of %u cache hits, and %u cache misses", __FUNCTION__, m_cacheHits, m_cacheMisses);
  // run through and find the oldest and the number of items cached
  unsigned int oldest = UINT_MAX;
  unsigned int numItems = 0;
  unsigned int numDirs = 0;
  for (ciCache i = m_cache.begin(); i != m_cache.end(); i++)
  {
    CDir *dir = i->second;
    oldest = min(oldest, dir->GetLastAccess());
    numItems += dir->m_Items->Size();
    numDirs++;
  }
  CLog::Log(LOGDEBUG, "%s - %u folders cached, with %u items total.  Oldest is %u, current is %u", __FUNCTION__, numDirs, numItems, oldest, m_accessCounter);
}
开发者ID:A600,项目名称:xbmc,代码行数:17,代码来源:DirectoryCache.cpp

示例8: PrintDiskUsage

void PrintDiskUsage(RFs& aFs, const TDesC& aPath, TInt aOffset = 0)
	{
	_LIT(KSpace, " ");
	TheTest.Printf(_L("%*.*S%S\r\n"), aOffset, aOffset, &KSpace, &aPath);
	TFindFile findFile(aFs);
	CDir* fileNameCol = NULL;
	TBuf<8> fileNameMask;
	fileNameMask.Copy(_L("*.*"));
	TInt err = findFile.FindWildByDir(fileNameMask, aPath, fileNameCol);
	if(err == KErrNone)
		{
		do
			{
			const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case.
			(void)TheParse.Set(file, NULL, NULL);
			TPtrC driveName = TheParse.Drive();
			if(aPath.FindF(driveName) >= 0)
				{		
                TInt cnt = fileNameCol->Count();
                for(TInt i=0;i<cnt;++i)
                    {
                    const ::TEntry& entry = (*fileNameCol)[i];
                    if(!entry.IsDir())
                        {
                        TheTest.Printf(_L("%*.*S    %S, size=%d\r\n"), aOffset, aOffset, &KSpace, &entry.iName, entry.iSize);
                        }
                    else
                        {
                        TBuf<100> path;
                        path.Copy(aPath);
                        path.Append(entry.iName);
                        path.Append(_L("\\"));
                        PrintDiskUsage(aFs, path, aOffset + 4);
                        }
                    }
				} // if(aPath.FindF(driveName) >= 0)
			
			delete fileNameCol;
			fileNameCol = NULL;
			} while((err = findFile.FindWild(fileNameCol)) == KErrNone);//Get the next set of files
		}
	else
		{
		TheTest.Printf(_L("  FindWildByDir() failed with err=%d\r\n"), err);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:46,代码来源:t_sqlenvdestroy.cpp

示例9: __ASSERT_DEBUG

	TInt CStorageManager::TotalIncFiles(CSBSIDTransferType* aTransferType)
		/**
		Returns number of Files in the directory for SID TransferType

		@param aTransferType - CSBSIDTransferType* pointer
		*/
		{
		__ASSERT_DEBUG(aTransferType != NULL, User::Panic(KBURTestPanicText, ENullTargetPointer));
		CDir* dir = NULL;
		TFileName filename;
		GetSIDFileNameL(aTransferType, filename);
		TInt err = iTestStep->Fs().GetDir(filename, KEntryAttMaskSupported, ESortByName, dir);
		if (err != KErrNone)
			{
			return 0;
			}
		return dir->Count();
		}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:18,代码来源:t_storagemanager.cpp

示例10: OutputFileNameL

/**
@SYMTestCaseID		SYSLIB-FEATREG-CT-3471
@SYMTestCaseDesc		List Config Files Names Under Featreg Data cage
@SYMTestPriority		High
@SYMTestActions		This test returns in a list format the names of all the featreg config files in its data cage.
					In order to validate EC114 Changes for FeatReg
@SYMTestExpectedResults	Names of featreg config files is returned.
@SYMDEF				 DEF104374
*/
static void OutputFileNameL()
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-FEATREG-CT-3471 "));
	_LIT(KFeatRegDir,"z:\\private\\102744CA\\*");
	
	CDir* dirList;
	
	User::LeaveIfError(TheFs.GetDir(KFeatRegDir, KEntryAttMaskSupported,ESortByName,dirList));
	
	RDebug::Print(_L("These are the files under z:\\private\\102744CA\\ "));
	
	for (TInt i=0;i<dirList->Count();i++)
		{
		RDebug::Print(_L(" %S "), &(*dirList)[i].iName);
		}
	    
	delete dirList;	
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:27,代码来源:featregSetupTest.cpp

示例11: CleanupClosePushL

TBool XQAccessPointManagerPrivate::s60PlatformVersion(TUint& aMajor, TUint& aMinor) const
{
    if (iPlatformVersionMajor != 0) {
        aMajor = iPlatformVersionMajor;
        aMinor = iPlatformVersionMinor;
        return ETrue;
    }

    RFs fs;
    if (fs.Connect() != KErrNone) {
        return EFalse;
    }
    CleanupClosePushL(fs);
     
    // Obtain the version number
    TFindFile fileFinder = fs;
    CDir* pResult;
 
    _LIT(KS60ProductIDFile, "Series60v*.sis");
    _LIT(KROMInstallDir, "z:\\system\\install\\");
    
    if (fileFinder.FindWildByDir(KS60ProductIDFile, KROMInstallDir, pResult) != KErrNone) {
        CleanupStack::PopAndDestroy(&fs);
        return EFalse;
    }
    CleanupStack::PushL(pResult);
    
    // Sort the file names so that the newest platforms are first
    if (pResult->Sort(ESortByName | EDescending) != KErrNone) {
        CleanupStack::PopAndDestroy(pResult);
        CleanupStack::PopAndDestroy(&fs);
        return EFalse;
    }
 
    // Parse the version numbers from the file name (e.g. Series60v3_1.sis)
    aMajor = (*pResult)[0].iName[9] - '0';
    aMinor = (*pResult)[0].iName[11] - '0';
    CleanupStack::PopAndDestroy(pResult);
    CleanupStack::PopAndDestroy(&fs);
    
    iPlatformVersionMajor = aMajor;
    iPlatformVersionMinor = aMinor;
    return ETrue;
}
开发者ID:barkermn01,项目名称:phonegap-symbian.qt-creator,代码行数:44,代码来源:xqaccesspointmanager_s60_p.cpp

示例12: GetGroupLeaderDummyAI

void CMemberAI::MemberAutoSynPos(bool bExtraMove)
{
    CDummyAI* pDummyAI = GetGroupLeaderDummyAI();
    if (!pDummyAI)
        return;
    CCharacterDictator* pDummyCharacter = pDummyAI->GetCharacter();
    if (!pDummyCharacter)
        return;
    CFighterDictator* pDummyFighter = pDummyCharacter->GetFighter();
    if(!pDummyFighter)
        return;
    CFPos destPos = GetSelfCorrectPos();
    CFPos ownPos;
    GetCharacter()->GetPixelPos(ownPos);
    bool bWalkState = pDummyAI->m_bDefaultWalkState;
    float fSpeed = bWalkState ?pDummyFighter->m_WalkSpeed.Get(pDummyFighter) :
                   pDummyFighter->m_RunSpeed.Get(pDummyFighter);

    if (ownPos.Dist(destPos)<eGridSpanForObj/2)
    {
        if (bExtraMove)
            pDummyAI->CheckMemberSynState();
        else
            MoveToPixelInLinePath(destPos,fSpeed,bWalkState);
        return;
    }

    CVector2f vecf;
    vecf.x = destPos.x - ownPos.x;
    vecf.y = destPos.y - ownPos.y;
    CDir dir;
    dir.Set(vecf);
    dir.Get(vecf);

    if(bExtraMove)
    {
        float fLineDst = fSpeed*0.5f*eGridSpanForObj;
        destPos.x = destPos.x + fLineDst*vecf.x;
        destPos.y = destPos.y + fLineDst*vecf.y;
    }

    fSpeed += 0.3f;
    MoveToPixelInLinePath(destPos,fSpeed,bWalkState);
}
开发者ID:svn2github,项目名称:ybtx,代码行数:44,代码来源:CMemberAI.cpp

示例13: FullDirectoryScanL

// perform a full dir scan
void CNotifyWatcher::FullDirectoryScanL(RArray<TEntry>& aArray)
	{
	aArray.Reset();
	
	CDir* list;
	iFs.GetDir(gTestPath, KEntryAttMaskSupported, ESortByName, list);
	
	if (!list)
	    return;
	
	CleanupStack::PushL(list);
	
	for (TInt i = 0; i < list->Count(); i++)
		{
		TEntry en ((*list)[i]);
		aArray.AppendL(en);
		}
	
	CleanupStack::PopAndDestroy();
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:21,代码来源:t_notify_perf_impl.cpp

示例14: GetOsVersion

void CMyServer::GetOsVersion(OsVersion& aVersion)
    {
    TFindFile fileFinder = iFs;
    CDir* result;

    _LIT(KS60ProductIDFile, "Series60v*.sis");
    _LIT(KROMInstallDir, "z:\\system\\install\\");

    User::LeaveIfError(fileFinder.FindWildByDir(KS60ProductIDFile,
            KROMInstallDir, result));
    CleanupStack::PushL(result);

    // Sort the file names so that the newest platforms are first
    User::LeaveIfError(result->Sort(ESortByName | EDescending));

    // Parse the version numbers from the file name (e.g. Series60v3_1.sis)
    aVersion.iMajor = (*result)[0].iName[9] - '0';
    aVersion.iMinor = (*result)[0].iName[11] - '0';
    CleanupStack::PopAndDestroy(result);
    }
开发者ID:Seikareikou,项目名称:symbian,代码行数:20,代码来源:server.cpp

示例15: AKNS_TRACE_DEBUG

// ---------------------------------------------------------------------------
// Scan directory for files.
// ---------------------------------------------------------------------------
//
void CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL(
    const TDesC& aRootDir )
    {
    AKNS_TRACE_DEBUG("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL" );
    CDirScan *dirScan = CDirScan::NewLC( iFsSession );
    dirScan->SetScanDataL(
        aRootDir,
        KEntryAttNormal | KEntryAttHidden | KEntryAttSystem |
        KEntryAttDir,
        ESortNone );

    // Fetch all directories and files from root.
    CDir* entryList = NULL;
    TParse parse;
    for(;;)
        {
        TRAPD( err, dirScan->NextL( entryList ) );

        // Stop in error case, or if no more data.
        if (!entryList  || ( err != KErrNone) )
            {
            break;
            }

        for (TInt i=0; i < entryList->Count(); i++)
            {
            TEntry entry = (*entryList)[i];
            const TDesC& dir = dirScan->FullPath();
            parse.Set( entry.iName, &dir, NULL );
            if ( !entry.IsDir() )
                {
                iFileArray.Append( parse );
                }
            }
        delete entryList;
        }
    AKNS_TRACE_DEBUG1("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL noFiles=%d", iFileArray.Count() );

    // Destroy the list.
    CleanupStack::PopAndDestroy( dirScan );
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:45,代码来源:aknssrvactivebackupdataclient.cpp


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