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


C++ CDir::Count方法代码示例

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


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

示例1: LoadClientsL

// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::LoadClientsL
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::LoadClientsL()
    {
    LOGGER_ENTERFN( "LoadClientsL" );

    CDir* dirs = 0;
    // hidden + system + dir + only these
    TUint mask = KEntryAttMatchMask | KEntryAttMatchExclusive; 

    User::LeaveIfError( iRfs.GetDir( KDmDefaultDir, 
                                     mask, 
                                     EAscending | EDirsFirst, 
                                     dirs) );
    if( dirs && dirs->Count() )
        {
        CleanupStack::PushL( dirs );

        for( TInt ii = 0; ii < dirs->Count(); ++ii )
            {
            TEntry entry = (*dirs)[ii];

            CLOG_WRITE_1( "Found: %S", &entry.iName );

            TUint32 clientUid = CheckClientDirName( entry.iName );
            if( clientUid )
                {
                CreateNewClientAppL( clientUid );
                }
            }

        CleanupStack::Pop( dirs );
        }

    delete dirs;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:40,代码来源:HttpDownloadManagerServerEngine.cpp

示例2: TestInitialStructureL

LOCAL_C void TestInitialStructureL(CMsvServer& aServer)
	{
	TInt services=1;
	TInt localFolders=5;

	CMsvServerEntry* sEntry = CMsvServerEntry::NewL(aServer, KMsvRootIndexEntryId);
	CleanupStack::PushL(sEntry);
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);
	TMsvSelectionOrdering sort(KMsvNoGrouping, EMsvSortByNone, ETrue);
	sEntry->SetSort(sort);

	// root
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvRootIndexEntryId));
	test(sEntry->Entry().iDetails==KNullDesC);
	test(sEntry->Entry().iDescription==KNullDesC);
	REPORT_IF_ERROR(sEntry->GetChildren(*selection));
	test(selection->Count()==services);
	
	// local service
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvLocalServiceIndexEntryId));
	test(sEntry->Entry().iDetails==_L("Local"));
	REPORT_IF_ERROR(sEntry->GetChildren(*selection));
	test(selection->Count()==localFolders);

	// standard folders
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvGlobalInBoxIndexEntryId));
	test(sEntry->Entry().iDetails==_L("Inbox"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvGlobalOutBoxIndexEntryId));
	test(sEntry->Entry().iDetails==_L("Outbox"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvDraftEntryId));
	test(sEntry->Entry().iDetails==_L("Drafts"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvSentEntryId));
	test(sEntry->Entry().iDetails==_L("Sent"));
	REPORT_IF_ERROR(sEntry->SetEntry(KMsvDeletedEntryFolderEntryId));
	test(sEntry->Entry().iDetails==_L("Deleted"));

	// check that only the index file and the local services dir are present
	CDir* dir;
	const TUidType type(KMsvEntryFile, KMsvEntryFile, KNullUid);
	REPORT_IF_ERROR(theUtils->FileSession().GetDir(KTestFolder,type , ESortNone, dir));
	TInt count=dir->Count();
	test(count==0) ;
	delete dir;

	// check that the local services dir is empty
	TFileName filename;
	filename.Append(KTestLocalService);
	filename.Append(_L("\\"));
	REPORT_IF_ERROR(theUtils->FileSession().GetDir(filename,type , ESortNone, dir));
	count=dir->Count();
	test(count==0) ;
	delete dir;

	CleanupStack::PopAndDestroy(2); // sEntry,selection
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:56,代码来源:T_REBLD.CPP

示例3: DoRunL

void CCmdFind::DoRunL()
	{
	RFs& fs = FsL();
	iPath.SetIsDirectoryL();
	if (!iName)
		{
		LeaveIfErr(KErrArgument, _L("You must specify a name to match against"));
		}

	iSearchDirs.AppendL(iPath.AllocLC());
	CleanupStack::Pop();

	while (iSearchDirs.Count())
		{
		const TDesC& path = *iSearchDirs[0];

		TInt err;
		CDir* matchingFiles = NULL;
		iTempName.Copy(path);
		iTempName.AppendComponentL(*iName, TFileName2::EFile);
		// Look for files in this directory first
		err = fs.GetDir(iTempName, KEntryAttNormal|KEntryAttDir, ESortByName, matchingFiles);
		if (!err)
			{
			for (TInt i = 0; i < matchingFiles->Count(); i++)
				{
				const TEntry& entry = (*matchingFiles)[i];
				FoundFile(path, entry.iName, entry.IsDir());
				}
			}
		delete matchingFiles;

		// Then add all this dir's subdirectories to the list of ones to be scanned
		CDir* dirsToRecurse = NULL;
		err = fs.GetDir(path, KEntryAttDir|KEntryAttMatchExclusive, ESortNone, dirsToRecurse);
		if (!err)
			{
			CleanupStack::PushL(dirsToRecurse);
			for (TInt i = 0; i < dirsToRecurse->Count(); i++)
				{
				const TEntry& entry = (*dirsToRecurse)[i];
				iTempName.Copy(path);
				iTempName.AppendComponentL(entry);
				iSearchDirs.AppendL(iTempName.AllocLC());
				CleanupStack::Pop();
				}
			CleanupStack::PopAndDestroy(dirsToRecurse);
			}
		delete iSearchDirs[0];
		iSearchDirs.Remove(0);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:52,代码来源:find.cpp

示例4: DoRunL

void CCmdCifTest::DoRunL()
	{
	if (iCmd)
		{
		CCommandInfoFile* cif = CCommandInfoFile::NewL(FsL(), Env(), *iCmd);
		TestCifL(cif); // Takes ownership
		}
	else
		{
		_LIT(KCifDir, "y:\\resource\\cif\\fshell\\");
		TFindFile find(FsL());
		CDir* dir = NULL;
		TInt found = find.FindWildByDir(_L("*.cif"), KCifDir, dir);
		while (found == KErrNone)
			{
			for (TInt i = 0; i < dir->Count(); i++)
				{
				iFileName.Copy(TParsePtrC(find.File()).DriveAndPath()); // The docs for TFindFile state you shouldn't need the extra TParsePtrC::DriveAndPath(). Sigh.
				iFileName.Append((*dir)[i].iName);
				iCifFiles.AppendL(iFileName.AllocLC());
				CleanupStack::Pop();
				}
			delete dir;
			dir = NULL;
			found = find.FindWild(dir);
			}
		NextCif();
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:29,代码来源:ciftest.cpp

示例5: DoNumObjectsL

// ---------------------------------------------------------------------------
// Common file counting helper
// ---------------------------------------------------------------------------
//
TInt CXIMPTestFileTool::DoNumObjectsL( const TDesC& aTemplate )
    {
    CDir* dir = GetDirListL( aTemplate );
    TInt count = dir->Count();
    delete dir;
    return count;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:11,代码来源:prfwtestfiletool.cpp

示例6: RecursiveRmDir

static void RecursiveRmDir(const TDesC& aDes)
//
// Delete directory contents recursively
//
{
    CDir* pD;
    TFileName n=aDes;
    n.Append(_L("*"));
    TInt r=TheFs.GetDir(n,KEntryAttMaskSupported,EDirsLast,pD);
    if (r==KErrNotFound || r==KErrPathNotFound)
        return;
    test_KErrNone(r);
    TInt count=pD->Count();
    TInt i=0;
    while (i<count)
    {
        const TEntry& e=(*pD)[i++];
        if (e.IsDir())
        {
            TFileName dirName;
            dirName.Format(_L("%S%S\\"),&aDes,&e.iName);
            RecursiveRmDir(dirName);
        }
        else
        {
            TFileName fileName;
            fileName.Format(_L("%S%S"),&aDes,&e.iName);
            r=TheFs.Delete(fileName);
            test_KErrNone(r);
        }
    }
    delete pD;
    r=TheFs.RmDir(aDes);
    test_KErrNone(r);
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:35,代码来源:t_fsysbm.cpp

示例7: DoPlatformVersionTest

// -----------------------------------------------------------------------------
// CPlatformVerTest::DoPlatformVersionTest
// -----------------------------------------------------------------------------
//
TInt CPlatformVerTest::DoPlatformVersionTest(
        VersionInfo::TVersionBase& aVersion, RFs* aFs )
    {
    TInt fileErr( KErrNone );
    CDir* productIds = NULL;
    TFindFile find( iFs );
    TInt ret( find.FindWildByPath( KS60ProductIDFiles, NULL, productIds ) );
    if ( ret == KErrNone && productIds && productIds->Count() )
        {
        fileErr = KErrNone;
        }
    else
        {
        fileErr = KErrNotSupported;
        }
    if ( aFs )
        {
        ret = VersionInfo::GetVersion( aVersion, *aFs );
        }
    else
        {
        ret = VersionInfo::GetVersion( aVersion );
        }
    if ( fileErr == ret )
        {
        ret = KErrNone;
        }
    delete productIds;
    return ret;
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:34,代码来源:platformvertestcases.cpp

示例8: FindCpiFilesL

void CExampleCpiManager::FindCpiFilesL()
/**	Looks in the UAProf directory for any CPI files and adds them to the array of CPI files
	@since		8.0
*/
	{
	TUidType uidType(KUidUaProfCpi);
	CDir* dir;
	// Get a list of files that match the CPI UID
	TInt err = iFs.GetDir(KTxtCpiFilesLocation, uidType, ESortByUid, dir);
	CleanupStack::PushL(dir);	
	if (err == KErrPathNotFound)
		User::LeaveIfError(iFs.MkDirAll(KTxtCpiFilesLocation()));
	else
		User::LeaveIfError(err);
	
	const TInt fileCount = dir->Count();
	for (TInt i = 0; i < fileCount; ++i)
		{
		TEntry* entry = NULL;
		entry = new (ELeave) TEntry((*dir)[i]);
		entry->iName = KTxtCpiFilesLocation();
		(entry->iName.Des()).Append((*dir)[i].iName);
		User::LeaveIfError(iCpiFileList.Append(entry));
		}
	CleanupStack::PopAndDestroy(dir);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:26,代码来源:examplecpimanager.cpp

示例9: BuildPolicyIdListL

void CPolicyImporter::BuildPolicyIdListL()
    {
    delete iPolicyIdList;
    iPolicyIdList = NULL;
    iPolicyIdList = new (ELeave) CArrayFixFlat<TExtVpnPolicyId>(2);

    TFindFile* fileFinder = new (ELeave) TFindFile(iFs);
    CleanupStack::PushL(fileFinder);

    CDir* fileList;

    TInt ret = fileFinder->FindWildByDir(KPinFilePat, iImportDir, fileList);

    if (ret == KErrNone)
        {
        CleanupStack::PushL(fileList);

        for (TInt i = 0; i < fileList->Count(); i++)
            {
            TParse* fileNameParser = new (ELeave) TParse();
            CleanupStack::PushL(fileNameParser);

            fileNameParser->Set((*fileList)[i].iName, NULL, NULL);

            TExtVpnPolicyId policyId;
            policyId.Copy(fileNameParser->Name());

            iPolicyIdList->AppendL(policyId);

            CleanupStack::PopAndDestroy(); // fileNameParser
            }
        CleanupStack::PopAndDestroy(); // fileList
        }
    CleanupStack::PopAndDestroy(); // fileFinder
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:35,代码来源:policyimporter.cpp

示例10: ScanOnce

/*
 * Scan folders contents once
 */
inline bool CFolderScanner::ScanOnce()
{
    // Perform scan
    CDir* SMSInList = NULL;
    if (iFs.GetDir(*iFolder,KEntryAttNormal,ESortNone,SMSInList) == KErrNone)
    {
        for(TInt i = 0; i<SMSInList->Count(); i++)
        {
            // if we're given a wild card, we ignore chars before '.'
            // just extension chars?
            const TEntry& entry = (*SMSInList)[i];
            if (!entry.IsDir())
            {
                TPtrC ext(entry.iName.Mid(entry.iName.LocateReverse('.')));
                if (!ext.CompareF(iScanExt->Mid(iScanExt->LocateReverse('.'))))
                {
                    TFileName fileName;
                    fileName.Append(*iFolder);
                    fileName.Append(entry.iName);
                    iClient->FileFound(fileName);
                    delete SMSInList;
                    return true;
                }
            }
        }
        delete SMSInList;
    }
    return false;
}
开发者ID:fedor4ever,项目名称:packaging,代码行数:32,代码来源:FolderScanner.cpp

示例11: PreLayoutDynInitL

void CProfileListDialog::PreLayoutDynInitL() {
    ButtonGroupContainer().SetDefaultCommand(ECmdProfileListConnect);

    iProfileArray = new (ELeave) CDesCArrayFlat(8);

    // Add default as the first profile
    iProfileArray->AppendL(KDefaultProfileName);

    // Find all profile files from the profile directory and add them to the
    // list    
    RFs &fs = CEikonEnv::Static()->FsSession();
    CDir *dir;
    User::LeaveIfError(fs.GetDir(iProfileDirectory, KEntryAttNormal,
                                 ESortByName, dir));
    CleanupStack::PushL(dir);
    for ( TInt i = 0; i < dir->Count(); i++ ) {
        iProfileArray->AppendL((*dir)[i].iName);
    }
    CleanupStack::PopAndDestroy(); //dir

    // Set profiles to the listbox
    CEikTextListBox *lbox = ((CEikTextListBox*)Control(EProfileListDlgProfileList));
    CTextListBoxModel *lbm = lbox->Model();
    lbm->SetItemTextArray(iProfileArray);
    lbm->SetOwnershipType(ELbmDoesNotOwnItemArray);

    // Enable scroll bars
    CEikScrollBarFrame *sbf = lbox->CreateScrollBarFrameL(ETrue);
    sbf->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,
                                 CEikScrollBarFrame::EAuto);

    ButtonGroupContainer().SetDefaultCommand(ECmdProfileListConnect);
}
开发者ID:0x0all,项目名称:s2putty,代码行数:33,代码来源:profilelistdialog.cpp

示例12: convertPathL

//================================================================================
//convertPathL
//================================================================================
void convertPathL(TDesC& aPath, TDesC& aPathName, RFs& aFs, TDesC& aTargetFile)
	{
	aFs.MkDirAll(aPathName);

	CDir* entryList = NULL;
	TInt error = aFs.GetDir(aPath,KEntryAttMatchMask,ESortByName,entryList);
	User::LeaveIfError(error);

	TInt numberOfFiles = entryList->Count();
	for (TInt i=0; i<numberOfFiles; i++)
		{
		//get the source file
		HBufC* temp=HBufC::NewLC(((*entryList)[i].iName).Length());
		TPtr sourceFileName(temp->Des());
		sourceFileName.Copy((*entryList)[i].iName);

		HBufC* temp2=HBufC::NewLC(((*entryList)[i].iName).Length()+aPathName.Length());
		TPtr sourceFile(temp2->Des());
		sourceFile = aPathName;
		sourceFile.Append(sourceFileName);
		//do the conversion
		synchronousL(sourceFile, aTargetFile);
		//output result
		_LIT(KString,"%S");
		test.Printf(KString,&(sourceFileName));
		test.Printf(_L("\n"));
		CleanupStack::PopAndDestroy(2);//temp, temp2
		}

	delete entryList;
	test.Printf(_L("\n%d files converted\n"),numberOfFiles);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:35,代码来源:convertertest.cpp

示例13: ScanDirL

LOCAL_C void ScanDirL(RFs& aFs, const TDesC& aDir)
	{
	User::After(1000000);

	TParse parse;
	parse.Set(_L("t_*.exe"), &aDir, NULL);
	TPtrC spec(parse.FullName());

	test.Start(parse.DriveAndPath());
	TFindFile find(aFs);
	CDir* dir;
	
	if (!find.FindWildByPath(parse.FullName(), NULL, dir))
		{
		CleanupStack::PushL(dir);

		for(int i = 0; i < dir->Count(); i++)
			{
			parse.Set((*dir)[i].iName, &spec, NULL);

			if (i == 0)
				test.Start(parse.FullName());
			else
				test.Next(parse.FullName());

			LaunchAndWaitL(parse.FullName());
			}

		CleanupStack::PopAndDestroy(); // dir
		}
	test.End();
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:32,代码来源:AUTORUN.CPP

示例14: ScanDirectory

void CStateDownload::ScanDirectory(RFs& aFs, const TDesC& aDir, const TDesC& aWild, CDesCArray* aFilesArray)
	{
	TParse parse;
	parse.Set(aWild, &aDir, NULL);
	TPtrC spec(parse.FullName());
	 
	TFindFile FindFile(aFs);
	CDir* dir;
	 
	if (FindFile.FindWildByPath(parse.FullName(), NULL, dir) == KErrNone)
		{
	    CleanupStack::PushL(dir);
	 
	    TInt count=dir->Count();
	    for(TInt i = 0; i < count; i++)
	    	{
	        parse.Set((*dir)[i].iName, &spec, NULL);
	        TEntry entry;
	        if(aFs.Entry(parse.FullName(),entry) == KErrNone)
	        	{
	        	if(!entry.IsDir())
	        		{
	        		//InsertIsqL raises a KErrAlreadyExists (-11) when inserting a duplicate
	        		TRAPD(err,aFilesArray->InsertIsqL(parse.FullName())); 
	        		}
	        	}
	        }
	    CleanupStack::PopAndDestroy(dir);
	    }
	}
开发者ID:BwRy,项目名称:core-symbian,代码行数:30,代码来源:StateDownload.cpp

示例15: CheckEntriesL

void CMsvMove::CheckEntriesL()
//
//
//
	{
	iLockedIndex = iDescendents->Count();
	while (iLockedIndex)
		{
		TMsvId id = iDescendents->At(iLockedIndex-1);

		// lock the entry
		User::LeaveIfError(iServer.IndexAdapter().LockEntryAndStore(id));
		iLockedIndex--;

		// check noone is reading the store (reading the store now doesn't
		// keep the file open, therefore we can't rely on checking the file to stop
		// deleting while reading
		TBool reading=EFalse;
		User::LeaveIfError(iServer.IndexAdapter().IsStoreReadingLocked(id,reading));
		if(reading) User::Leave(KErrInUse);

		// get the entry
		TMsvEntry* entry;
		User::LeaveIfError(iServer.IndexAdapter().GetEntry(id, entry));
		// check the store
		TFileName filename;
		iServer.GetEntryName(id, filename, EFalse);
		TBool open;
		TInt error = iServer.FileSession().IsFileOpen(filename, open);
		if (error != KErrNotFound && error!=KErrPathNotFound)
			{
			if (error != KErrNone)
				User::Leave(error);
			if (open)
				User::Leave(KErrInUse);
			}

		// check any files
		CDir* dir;
		error = iServer.GetFileDirectoryListing(id, filename, dir);
		if (error == KErrNone)
			{
			CleanupStack::PushL(dir);
			User::LeaveIfError(iServer.FileSession().SetSessionPath(filename));
			TInt fCount=dir->Count();
			if (fCount--)
				{
				TBool open;
				User::LeaveIfError(iServer.FileSession().IsFileOpen((*dir)[fCount].iName, open));
				if (open)
					User::Leave(KErrInUse);
				}
			CleanupStack::PopAndDestroy(); // dir
			}
		else if (error != KErrPathNotFound)
			User::Leave(error);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:58,代码来源:MSVMOVE.CPP


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