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


C++ CFileList::Find方法代码示例

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


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

示例1: 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

示例2: ProcessWord

void CLibraryDictionary::ProcessWord(CLibraryFile& oFile, const CString& strWord, bool bAdd, bool bCanUpload)
{
	ASSUME_LOCK( Library.m_pSection );

	CFileList* pList = NULL;
	if ( m_oWordMap.Lookup( strWord, pList ) )
	{
		if ( POSITION pos = pList->Find( &oFile ) )
		{
			if ( ! bAdd )
			{
				pList->RemoveAt( pos );
				if ( pList->IsEmpty() )
				{
					delete pList;

					VERIFY( m_oWordMap.RemoveKey( strWord ) );

					if ( bCanUpload && m_bValid )
						Invalidate();
				}
			}
		}
		else
		{
			if ( bAdd )
			{
				pList->AddTail( &oFile );

				if ( bCanUpload && m_bValid )
					m_pTable->AddExactString( strWord );
			}
		}
	}
	else if ( bAdd )
	{
		pList = new CFileList;
		if ( pList )
		{
			pList->AddTail( &oFile );
			m_oWordMap.SetAt( strWord, pList );

			if ( bCanUpload && m_bValid )
				m_pTable->AddExactString( strWord );
		}
	}
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:47,代码来源:LibraryDictionary.cpp

示例3: LookupFilesByHash

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


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