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


C++ CFileList类代码示例

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


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

示例1: ADDTOCALLSTACK

void CResourceBase::AddResourceDir( LPCTSTR pszDirName )
{
	ADDTOCALLSTACK("CResourceBase::AddResourceDir");
	if ( pszDirName[0] == '\0' )
		return;

	CGString sFilePath = CGFile::GetMergedFileName( pszDirName, "*" GRAY_SCRIPT );

	CFileList filelist;
	int iRet = filelist.ReadDir( sFilePath, false );
	if ( iRet < 0 )
	{
		// also check script file path
		sFilePath = CGFile::GetMergedFileName(m_sSCPBaseDir, sFilePath.GetPtr());

		iRet = filelist.ReadDir( sFilePath, true );
		if ( iRet < 0 )
		{
			DEBUG_ERR(( "DirList=%d for '%s'\n", iRet, static_cast<LPCTSTR>(pszDirName) ));
			return;
		}
	}

	if ( iRet <= 0 )	// no files here.
	{
		return;
	}

	CGStringListRec * psFile = filelist.GetHead();
	for ( ; psFile; psFile = psFile->GetNext())
	{
		sFilePath = CGFile::GetMergedFileName( pszDirName, *psFile );
		AddResourceFile( sFilePath );
	}
}
开发者ID:roberpot,项目名称:Source,代码行数:35,代码来源:CResourceBase.cpp

示例2: Test0

LOCAL_C void Test0(RTest& aTest)
//
//	Scan for open files - no sessions
//	
	{
	aTest.Next(_L("Scan for open files with no sessions open"));
	CFileList* list;
	TOpenFileScan fileScan(TheFs);
	fileScan.NextL(list);
	if (list==NULL)
		return;
	TInt count=list->Count();
	if (count==1)
		{
		gRunByBatch=ETrue;
		gBatchFile=(*list)[0].iName;
		delete list;
		fileScan.NextL(list);
		if (list==NULL)
			return;
		count=list->Count();
		}
	while (count--)
		{
		TEntry entry=(*list)[count];
		aTest.Printf(_L("%d) EntryName = %S\n"),count,&entry.iName);
		}
	//aTest.Printf(_L("Test will fail unless files are closed.\n"));
	//aTest.Printf(_L("Press any key ...\n"));
	//aTest.Getch();
	}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:31,代码来源:svphost.cpp

示例3: ASSUME_LOCK

CFileList* CLibraryMaps::WhatsNew(const CQuerySearch* pSearch, int nMaximum) const
{
	ASSUME_LOCK( Library.m_pSection );

	const DWORD tNow = static_cast< DWORD >( time( NULL ) );
	CFileList* pHits = NULL;

	for ( POSITION pos = GetFileIterator() ; pos ; )
	{
		CLibraryFile* pFile = GetNextFile( pos );

		if ( pFile->IsAvailable() && pFile->IsShared() && pFile->m_oSHA1 &&
			( ! pSearch->m_pSchema || pSearch->m_pSchema->Equals( pFile->m_pSchema ) ) )
		{
			const DWORD nTime = pFile->GetCreationTime();
			if ( nTime && nTime + 12 * 60 * 60 > tNow )		// 12 hours
			{
				pFile->m_nHitsToday++;
				pFile->m_nHitsTotal++;

				if ( ! pHits )
					pHits = new CFileList;
				pHits->AddTail( pFile );
				if ( nMaximum && pHits->GetCount() >= nMaximum )
					break;
			}
		}
	}

	return pHits;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:31,代码来源:LibraryMaps.cpp

示例4: loadFileLists

void loadFileLists(CFileList& files, OPTIONS& opt) 
{
	// check type of input -> file | direcotry | list
	if(opt.inputFile.size() > 0) {
		vector<string>::iterator it;
		for(it = opt.inputFile.begin(); it != opt.inputFile.end(); it++) {
			if(fs::is_regular_file(fs::path(*it)))
				files.AddItem((*it).c_str());
			else
				cout << "WARNING: input file " << *it << " not found" << endl;
		}
	}

	if(!opt.inputList.empty()) {
		vector<string>::iterator it;
		for(it = opt.inputList.begin(); it != opt.inputList.end(); it++) {
			if(!(*it).empty())
				ReadTestList((*it).c_str(), &files, opt.inExt.c_str());
		}
	}

	if(files.ListLength() < 1) {
		error_report = string("None suitable input files found");
		throw runtime_error(error_report.c_str());
	}
}
开发者ID:GMMTeam,项目名称:GMM,代码行数:26,代码来源:main.cpp

示例5: Test1

LOCAL_C void Test1()	
//
//	This test is only called by default drive
//	Test OpenFileScan			
//
	{
	test.Next(_L("Scan for open files - one session only"));

	RFile file1,file2,file3;
	TFileName fn;
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FILE.CPP");
	fn[0] = gExeFileName[0];
	r=file2.Open(TheFs,fn,EFileRead);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	
	CFileList* list;
	TOpenFileScan fileScan(TheFs);
	fileScan.NextL(list);

	if (gRunByBatch)
		{
		test(list!=NULL);
		test(list->Count()==1);
		TEntry entry=(*list)[0];
		test(entry.iName.FindF(_L(".BAT"))>=0);
		delete list;
		fileScan.NextL(list);
		}

	test(list!=NULL);
	TInt count=list->Count();
	test(count==3);
	TEntry entry=(*list)[0];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	entry=(*list)[1];
	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
	entry=(*list)[2];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	TThreadId threadId=fileScan.ThreadId();
	RThread current;
	TThreadId currentId=current.Id();
	test(threadId==currentId);
	delete list;

	fileScan.NextL(list);
	test(list==NULL);

	file1.Close();
	file2.Close();
	file3.Close();
	}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:59,代码来源:svphost.cpp

示例6: ASSUME_LOCK

void CLibraryDictionary::BuildHashTable()
{
	ASSUME_LOCK( Library.m_pSection );

	if ( m_bValid )
		return;

	if ( ! m_pTable )
	{
		m_pTable = new CQueryHashTable();
		if ( ! m_pTable )
			return;
		m_pTable->Create();
	}

	m_pTable->Clear();

	// Add words to hash table
	//TRACE( L"[LD] Dictionary size: %d words\n", m_oWordMap.GetCount() );
	//TRACE( L"[LD] Hash table size: %d\n", m_oWordMap.GetHashTableSize() );
	for ( POSITION pos1 = m_oWordMap.GetStartPosition(); pos1; )
	{
		CString strWord;
		CFileList* pList = NULL;
		m_oWordMap.GetNextAssoc( pos1, strWord, pList );

		//TRACE( L"[LD] Word \"%hs\" found %d time(s) in %d file(s)\n", (LPCSTR)CT2A( strWord ), oWord.m_nCount, oWord.m_pList->GetCount() );
		for ( POSITION pos2 = pList->GetHeadPosition(); pos2; )
		{
			const CLibraryFile* pFile = pList->GetNext( pos2 );

			// Check if the file can be uploaded
			if ( pFile->IsShared() )
			{
				// Add the keyword to the table
				m_pTable->AddExactString( strWord );
				break;
			}
		}
	}

	// Add sha1/ed2k hashes to hash table
	for ( POSITION pos = LibraryMaps.GetFileIterator(); pos; )
	{
		const CLibraryFile* pFile = LibraryMaps.GetNextFile( pos );

		// Check if the file can be uploaded
		if ( pFile->IsShared() )
			m_pTable->AddHashes( *pFile );
	}

	m_bValid = true;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:53,代码来源:LibraryDictionary.cpp

示例7: List

void CFileContainerArc::List(CFileList &list, const char *mask, unsigned flags)
{
	TString<256> Path; Path = mask;
	char *name = Path.rchr('/');
	FDirInfo *Dir;
	if (name)
	{
		*name++ = 0;
		Dir = FindDir(Path);
		if (!Dir) return;			// directory not found
	}
	else
	{
		name = Path;
		Dir  = &Root;
	}
	// list directories and files
#if FS_DIR != FS_FILE<<1
#error Check FS_DIR / FS_FILE relationship
#endif
	for (unsigned Flag = FS_FILE; Flag <= FS_DIR; Flag <<= 1)
	{
		if (!(flags & Flag)) continue;

		CListIterator it;
		if (Flag == FS_FILE)		// cannot write this as "it = (Flag == FS_FILE) ? ..."
			it = Dir->Files;
		else
			it = Dir->Dirs;

		for ( ; it; ++it)
		{
			if (!appMatchWildcard(it->name, name)) continue;

			TString<256> Name; Name = it->name;
			// process NOEXT
			if (flags & FS_NOEXT)
			{
				char *s = Name.rchr('.');
				if (s) *s = 0;
			}

			CFileItem *item, *place;
			if (!(item = list.Find(Name, &place)))
			{
				item = new (Name, &list) CFileItem;
				// here: item->flags=0
				list.InsertAfter(item, place);
			}
			item->flags |= containFlags|Flag;
		}
	}
}
开发者ID:RkShaRkz,项目名称:Quake2,代码行数:53,代码来源:FileContainerArc.cpp

示例8: oLock

bool CLocalSearch::ExecuteSharedFiles(INT_PTR nMaximum, INT_PTR& nHits)
{
	CSingleLock oLock( &Library.m_pSection );
	if ( ! oLock.Lock( 250 ) )
		return false;

	auto_ptr< CFileList > pFiles( Library.Search(
		m_pSearch, nMaximum, FALSE,
		// Ghost files only for G2
		m_nProtocol != PROTOCOL_G2 ) );

	if ( pFiles.get() )
	{
		CFileList oFilesInPacket;

		for ( POSITION pos = pFiles->GetHeadPosition() ;
			pos && ( ! nMaximum || ( nHits + oFilesInPacket.GetCount() < nMaximum ) ); )
		{
			CLibraryFile* pFile = pFiles->GetNext( pos );

			if ( IsValidForHit( pFile ) )
			{
				oFilesInPacket.AddTail( pFile );
			}
		}

		SendHits( oFilesInPacket );

		nHits += oFilesInPacket.GetCount();
	}

	// Is it a browser request?
	if ( ! m_pSearch && m_nProtocol == PROTOCOL_G2 )
	{
		// Send virtual tree		
		DispatchPacket( AlbumToPacket( Library.GetAlbumRoot() ) );

		// Send physical tree
		DispatchPacket( FoldersToPacket() );
	}

	return true;
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:43,代码来源:LocalSearch.cpp

示例9: strlen

void CFileBrowser::ChangeDir(const std::string & filename, int selection)
{
	std::string newpath;
	if((m_Mode != ModeSC) && (filename == ".."))
	{
		std::string::size_type pos = Path.substr(0,Path.length()-1).rfind('/');

#ifdef ENABLE_MOVIEPLAYER_VLC
		bool is_vlc = (strncmp(Path.c_str(), VLC_URI, strlen(VLC_URI)) == 0);
#endif
		if (pos == std::string::npos)
		{
			newpath = Path;
		}
		else
		{
#ifdef ENABLE_MOVIEPLAYER_VLC
			if (is_vlc && (pos < strlen(VLC_URI) - 1))
				newpath = VLC_URI;
			else
#endif
				newpath = Path.substr(0, pos + 1);
		}

#ifdef ENABLE_MOVIEPLAYER_VLC
		if (strncmp(is_vlc ? &(newpath.c_str()[strlen(VLC_URI)]) : newpath.c_str(), base.c_str(), base.length()) != 0)
			return;
#endif
	}
	else
	{
		newpath=filename;
	}
	if(m_Mode != ModeSC && (newpath.rfind('/') != newpath.length()-1 || newpath.length() == 0))
	{
		newpath += '/';
	}
	filelist.clear();
	Path = newpath;
	name = newpath;
	CFileList allfiles;
	readDir(newpath, &allfiles);
	// filter
	CFileList::iterator file = allfiles.begin();
	for(; file != allfiles.end() ; file++)
	{
		if(Filter != NULL && (!S_ISDIR(file->Mode)) && use_filter)
		{
			if(!Filter->matchFilter(file->Name))
			{
				continue;
			}
			if(Hide_records) {
				int ext_pos = file->Name.rfind('.');
				if( ext_pos > 0) {
					std::string extension = file->Name.substr(ext_pos + 1, name.length() - ext_pos);
					if(strcasecmp(extension.c_str(), "ts") == 0) {
						std::string fname = file->Name.substr(0, ext_pos) + ".xml";
						if(access(fname.c_str(), F_OK) == 0)
							continue;
					}
				}
			}
		}
		if(Dir_Mode && (!S_ISDIR(file->Mode)))
		{
			continue;
		}
		filelist.push_back(*file);
	}
	// sort result
	sort(filelist.begin(), filelist.end(), sortBy[g_settings.filebrowser_sortmethod]);

	selected = 0;
	if ((selection != -1) && (selection < (int)filelist.size()))
		selected = selection;
	paintHead();
	paint();
}
开发者ID:Firmeware,项目名称:max-tdt,代码行数:79,代码来源:filebrowser.cpp

示例10: oLock

CFileList* CLibraryMaps::LookupFilesByHash(const CPeerProjectFile* pFilter, BOOL bSharedOnly, BOOL bAvailableOnly, int nMaximum) const
{
	CQuickLock oLock( Library.m_pSection );

	CFileList* pFiles = NULL;

	if ( pFilter->m_oSHA1 )
	{
		for ( CLibraryFile* pFile = m_pSHA1Map[ pFilter->m_oSHA1[ 0 ] & HASH_MASK ] ;
			pFile ; pFile = pFile->m_pNextSHA1 )
		{
			if ( validAndEqual( pFile->m_oSHA1, pFilter->m_oSHA1 ) &&
				 *pFile == *pFilter &&
				 pFile->CheckFileAttributes( pFilter->m_nSize, bSharedOnly, bAvailableOnly ) )
			{
				if ( ! pFiles )
					pFiles = new CFileList;
				if ( pFiles->Find( pFile ) == NULL )
				{
					if ( bSharedOnly )
					{
						pFile->m_nHitsToday++;
						pFile->m_nHitsTotal++;
					}
					pFiles->AddTail( pFile );
					if ( nMaximum && pFiles->GetCount() >= nMaximum )
						break;
				}
			}
		}

		return pFiles;
	}

	if ( pFilter->m_oED2K )
	{
		for ( CLibraryFile* pFile = m_pED2KMap[ pFilter->m_oED2K[ 0 ] & HASH_MASK ] ;
			pFile ; pFile = pFile->m_pNextED2K )
		{
			if ( validAndEqual( pFile->m_oED2K, pFilter->m_oED2K ) &&
				 *pFile == *pFilter &&
				 pFile->CheckFileAttributes( pFilter->m_nSize, bSharedOnly, bAvailableOnly ) )
			{
				if ( ! pFiles )
					pFiles = new CFileList;
				if ( pFiles->Find( pFile ) == NULL )
				{
					if ( bSharedOnly )
					{
						pFile->m_nHitsToday++;
						pFile->m_nHitsTotal++;
					}
					pFiles->AddTail( pFile );
					if ( nMaximum && pFiles->GetCount() >= nMaximum )
						return pFiles;
				}
			}
		}

		return pFiles;
	}

	if ( pFilter->m_oTiger )
	{
		for ( CLibraryFile* pFile = m_pTigerMap[ pFilter->m_oTiger[ 0 ] & HASH_MASK ] ;
			pFile ; pFile = pFile->m_pNextTiger )
		{
			if ( validAndEqual( pFile->m_oTiger, pFilter->m_oTiger ) &&
				 *pFile == *pFilter &&
				 pFile->CheckFileAttributes( pFilter->m_nSize, bSharedOnly, bAvailableOnly ) )
			{
				if ( ! pFiles )
					pFiles = new CFileList;
				if ( pFiles->Find( pFile ) == NULL )
				{
					if ( bSharedOnly )
					{
						pFile->m_nHitsToday++;
						pFile->m_nHitsTotal++;
					}
					pFiles->AddTail( pFile );
					if ( nMaximum && pFiles->GetCount() >= nMaximum )
						break;
				}
			}
		}

		return pFiles;
	}

	if ( pFilter->m_oBTH )
	{
		for ( CLibraryFile* pFile = m_pBTHMap[ pFilter->m_oBTH[ 0 ] & HASH_MASK ] ;
			pFile ; pFile = pFile->m_pNextBTH )
		{
			if ( validAndEqual( pFile->m_oBTH, pFilter->m_oBTH ) &&
				 *pFile == *pFilter &&
				 pFile->CheckFileAttributes( pFilter->m_nSize, bSharedOnly, bAvailableOnly ) )
			{
				if ( ! pFiles )
//.........这里部分代码省略.........
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:101,代码来源:LibraryMaps.cpp

示例11: Test5

LOCAL_C void Test5()
//
// Test OpenFileScan
//
	{

	test.Next(_L("Scan for open files - mixed RDirs and RFiles"));

	RFile file1,file2,file3;
	TFileName fn;
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	TInt r=file1.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FILE.CPP");
	fn[0] = gExeFileName[0];
	r=file2.Open(TheFs,fn,EFileRead);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	r=file3.Open(TheFs,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	
	RDir dir1,dir2,dir3,dir4;
	fn = _L("Z:\\TEST\\*.XDE");
	fn[0] = gExeFileName[0];
	r=dir1.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir2.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir3.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir4.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);

	CFileList* list;
	TOpenFileScan fileScan(TheFs);
	fileScan.NextL(list);

	if (gRunByBatch)
		{
		test(list!=NULL);
		test(list->Count()==1);
		TEntry entry=(*list)[0];
		test(entry.iName.FindF(_L(".BAT"))>=0);
		delete list;
		fileScan.NextL(list);
		}

	test(list!=NULL);
	TInt count=list->Count();
	test(count==3);
	TEntry entry=(*list)[0];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	entry=(*list)[1];
	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
	entry=(*list)[2];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	TThreadId threadId=fileScan.ThreadId();
	RThread current;
	TThreadId currentId=current.Id();
	test(threadId==currentId);
	delete list;

	fileScan.NextL(list);
	test(list==NULL);

	file1.Close();
	file2.Close();
	file3.Close();
	dir1.Close();
	dir2.Close();
	dir3.Close();
	dir4.Close();
	}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:75,代码来源:svphost.cpp

示例12: Test4

LOCAL_C void Test4()
//
// Test openfilescan - rdirs, empty, full, empty rdirs.
//
	{
	test.Next(_L("Scan for open files - check RDir sessions are ignored"));

	RFs fs1,fs2,fs3,fs4;
	TFileName fn;
	TInt r=fs1.Connect();
	test(r==KErrNone);
	r=fs2.Connect();
	test(r==KErrNone);
	r=fs3.Connect();
	test(r==KErrNone);
	r=fs4.Connect();
	test(r==KErrNone);

	RDir dir1,dir2,dir3,dir4;
	fn = _L("Z:\\TEST\\*.XDE");
	fn[0] = gExeFileName[0];
	r=dir1.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir2.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir3.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir4.Open(TheFs,fn,KEntryAttMaskSupported);
	test(r==KErrNone);

	RFile file1,file2,file3;
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FILE.CPP");
	fn[0] = gExeFileName[0];
	r=file2.Open(fs2,fn,EFileRead);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	
	RDir dir5,dir6,dir7,dir8;
	fn = _L("Z:\\TEST\\*.XDE");
	fn[0] = gExeFileName[0];
	r=dir5.Open(fs4,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir6.Open(fs4,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir7.Open(fs4,fn,KEntryAttMaskSupported);
	test(r==KErrNone);
	r=dir8.Open(fs4,fn,KEntryAttMaskSupported);
	test(r==KErrNone);

	CFileList* list;
	TOpenFileScan fileScan(TheFs);
	fileScan.NextL(list);

	if (gRunByBatch)
		{
		test(list!=NULL);
		test(list->Count()==1);
		TEntry entry=(*list)[0];
		test(entry.iName.FindF(_L(".BAT"))>=0);
		delete list;
		fileScan.NextL(list);
		}

	test(list!=NULL);
	TInt count=list->Count();
	test(count==3);
	TEntry entry=(*list)[0];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	entry=(*list)[1];
	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
	entry=(*list)[2];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	TThreadId threadId=fileScan.ThreadId();
	RThread current;
	TThreadId currentId=current.Id();
	test(threadId==currentId);
	delete list;

	fileScan.NextL(list);
	test(list==NULL);

	file1.Close();
	file2.Close();
	file3.Close();
	dir1.Close();	dir2.Close();
	dir3.Close();	dir4.Close();
	dir5.Close();	dir6.Close();
	dir7.Close();	dir8.Close();
	fs1.Close();	fs2.Close();
	fs3.Close();	fs4.Close();
	}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:98,代码来源:svphost.cpp

示例13: Test3

LOCAL_C void Test3()
//
// Test openfilescan - empty, full, empty full
//
	{
	test.Next(_L("Scan for open files - multiple sessions"));

	RFs fs1,fs2,fs3,fs4;
	TInt r=fs1.Connect();
	test(r==KErrNone);
	r=fs2.Connect();
	test(r==KErrNone);
	r=fs3.Connect();
	test(r==KErrNone);
	r=fs4.Connect();
	test(r==KErrNone);

	RFile file1,file2,file3;
	TFileName fn;
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	r=file1.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FILE.CPP");
	fn[0] = gExeFileName[0];
	r=file2.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	r=file3.Open(fs2,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	
	r=file1.Open(fs4,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FILE.CPP");
	fn[0] = gExeFileName[0];
	r=file2.Open(fs4,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	fn = _L("Z:\\TEST\\T_FSRV.CPP");
	fn[0] = gExeFileName[0];
	r=file3.Open(fs4,fn,EFileRead|EFileShareReadersOnly);
	test(r==KErrNone);
	
	CFileList* list;
	TOpenFileScan fileScan(TheFs);
	fileScan.NextL(list);

	if (gRunByBatch)
		{
		test(list!=NULL);
		test(list->Count()==1);
		TEntry entry=(*list)[0];
		test(entry.iName.FindF(_L(".BAT"))>=0);
		delete list;
		fileScan.NextL(list);
		}

	test(list!=NULL);
	TInt count=list->Count();
	test(count==3);
	TEntry entry=(*list)[0];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	entry=(*list)[1];
	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
	entry=(*list)[2];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	TThreadId threadId=fileScan.ThreadId();
	RThread current;
	TThreadId currentId=current.Id();
	test(threadId==currentId);
	delete list;

	fileScan.NextL(list);
	test(list!=NULL);
	count=list->Count();
	test(count==3);
	entry=(*list)[0];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	entry=(*list)[1];
	test(entry.iName.FindF(_L("T_FILE.CPP"))>=0);
	entry=(*list)[2];
	test(entry.iName.FindF(_L("T_FSRV.CPP"))>=0);
	threadId=fileScan.ThreadId();
	currentId=current.Id();
	test(threadId==currentId);
	delete list;

	fileScan.NextL(list);
	test(list==NULL);

	file1.Close();
	file2.Close();
	file3.Close();
	fs1.Close();
	fs2.Close();
	fs3.Close();
	fs4.Close();
	}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:98,代码来源:svphost.cpp

示例14: getWorkingDirectory

//! Creates a list of files and directories in the current working directory
IFileList* CFileSystem::createFileList()
{
	CFileList* r = 0;
	io::path Path = getWorkingDirectory();
	Path.replace('\\', '/');
	if (Path.lastChar() != '/')
		Path.append('/');

	//! Construct from native filesystem
	if (FileSystemType == FILESYSTEM_NATIVE)
	{
		io::path fullPath;
		// --------------------------------------------
		//! Windows version
		#ifdef _IRR_WINDOWS_API_
		#if !defined ( _WIN32_WCE )

		r = new CFileList(Path, true, false);

		struct _finddata_t c_file;
		long hFile;

		if( (hFile = _findfirst( "*", &c_file )) != -1L )
		{
			do
			{
				fullPath = Path + c_file.name;

				r->addItem(fullPath, c_file.size, (_A_SUBDIR & c_file.attrib) != 0, 0);
			}
			while( _findnext( hFile, &c_file ) == 0 );

			_findclose( hFile );
		}
		#endif

		//TODO add drives
		//entry.Name = "E:\\";
		//entry.isDirectory = true;
		//Files.push_back(entry);
		#endif

		// --------------------------------------------
		//! Linux version
		#if (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))


		r = new CFileList(Path, false, false);

		r->addItem(Path + "..", 0, true, 0);

		//! We use the POSIX compliant methods instead of scandir
		DIR* dirHandle=opendir(Path.c_str());
		if (dirHandle)
		{
			struct dirent *dirEntry;
			while ((dirEntry=readdir(dirHandle)))
			{
				u32 size = 0;
				bool isDirectory = false;
				fullPath = Path + dirEntry->d_name;

				if((strcmp(dirEntry->d_name, ".")==0) ||
				   (strcmp(dirEntry->d_name, "..")==0))
				{
					continue;
				}
				struct stat buf;
				if (stat(dirEntry->d_name, &buf)==0)
				{
					size = buf.st_size;
					isDirectory = S_ISDIR(buf.st_mode);
				}
				#if !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__CYGWIN__)
				// only available on some systems
				else
				{
					isDirectory = dirEntry->d_type == DT_DIR;
				}
				#endif

				r->addItem(fullPath, size, isDirectory, 0);
			}
			closedir(dirHandle);
		}
		#endif
	}
	else
	{
		//! create file list for the virtual filesystem
		r = new CFileList(Path, false, false);

		//! add relative navigation
		SFileListEntry e2;
		SFileListEntry e3;

		//! PWD
		r->addItem(Path + ".", 0, true, 0);

//.........这里部分代码省略.........
开发者ID:RealBadAngel,项目名称:irrlicht.netcp,代码行数:101,代码来源:CFileSystem.cpp

示例15: dprintf

void CFileBrowser::addRecursiveDir(CFileList * re_filelist, std::string rpath, bool bRootCall)
{
	neutrino_msg_t      msg;
	neutrino_msg_data_t data;

	int n;

	dprintf(DEBUG_INFO, "CFileBrowser::addRecursiveDir %s\n", rpath.c_str());

	if (bRootCall) 
		bCancel = false;

	g_RCInput->getMsg_us(&msg, &data, 1);
	if (msg == CRCInput::RC_home)
	{
		// home key cancel scan
		bCancel = true;
	}
	else if (msg != CRCInput::RC_timeout)
	{
		// other event, save to low priority queue
		g_RCInput->postMsg( msg, data, false );
	}
	
	if(bCancel)
		return;

	if ( ((rpath.empty()) || ((*rpath.rbegin()) != '/')))
	{
		rpath += '/';
	}

	CFileList tmplist;
	if(!readDir(rpath, &tmplist))
	{
		perror(("Recursive scandir: " + rpath).c_str());
	}
	else
	{
		n = tmplist.size();
		
		for(int i = 0; i < n;i++)
		{
			std::string basename = tmplist[i].Name.substr(tmplist[i].Name.rfind('/')+1);
			
			if( basename != ".." )
			{
				if(Filter != NULL && (!S_ISDIR(tmplist[i].Mode)) && use_filter)
				{
					if(!Filter->matchFilter(tmplist[i].Name))
					{
						continue;
					}
				}
				if(!S_ISDIR(tmplist[i].Mode))
					re_filelist->push_back(tmplist[i]);
				else
					addRecursiveDir(re_filelist,tmplist[i].Name, false);
			}
		}
	}
}
开发者ID:n3wb13,项目名称:neutrinohd2,代码行数:62,代码来源:filebrowser.cpp


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