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


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

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


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

示例1: OnCbnCloseupSchemas

void CDownloadGroupDlg::OnCbnCloseupSchemas()
{
    // Get filters
    CList< CString > oList;
    for ( int nItem = 0 ; nItem < m_wndFilterList.GetCount() ; nItem++ )
    {
        CString strFilter;
        m_wndFilterList.GetLBText( nItem, strFilter );
        if ( oList.Find( strFilter ) == NULL )
            oList.AddTail( strFilter );
    }

    // Remove old schema filters (preserve custom ones)
    if ( CSchemaPtr pOldSchema = SchemaCache.Get( m_sOldSchemaURI ) )
    {
        for ( POSITION pos = pOldSchema->GetFilterIterator(); pos ; )
        {
            CString strFilter;
            BOOL bResult;
            pOldSchema->GetNextFilter( pos, strFilter, bResult );
            if ( bResult )
            {
                strFilter.Insert( 0, _T('.') );
                while ( POSITION pos = oList.Find( strFilter ) )
                    oList.RemoveAt( pos );
            }
        }
    }

    // Add new schema filters
    if ( CSchemaPtr pNewSchema = SchemaCache.Get( m_wndSchemas.GetSelectedURI() ) )
    {
        for ( POSITION pos = pNewSchema->GetFilterIterator(); pos ; )
        {
            CString strFilter;
            BOOL bResult;
            pNewSchema->GetNextFilter( pos, strFilter, bResult );
            if ( bResult )
            {
                strFilter.Insert( 0, _T('.') );
                oList.AddTail( strFilter );
            }
        }
    }

    // Refill interface filters list
    m_wndFilterList.ResetContent();
    for ( POSITION pos = oList.GetHeadPosition() ; pos ; )
        m_wndFilterList.AddString( oList.GetNext( pos ) );

    m_sOldSchemaURI = m_wndSchemas.GetSelectedURI();
}
开发者ID:nlstone,项目名称:Shareaza,代码行数:52,代码来源:DlgDownloadGroup.cpp

示例2: Update

void CLibraryFolderCtrl::Update(DWORD nUpdateCookie)
{
	CList< CLibraryFolder* > pAlready;

	for ( HTREEITEM hItem = GetChildItem( m_hRoot ) ; hItem ; )
	{
		HTREEITEM hNext = GetNextSiblingItem( hItem );

		CLibraryFolder* pFolder = (CLibraryFolder*)GetItemData( hItem );

		if ( LibraryFolders.CheckFolder( pFolder ) )
		{
			Update( pFolder, hItem, NULL, nUpdateCookie, FALSE );
			pAlready.AddTail( pFolder );
		}
		else
		{
			DeleteItem( hItem );
		}

		hItem = hNext;
	}

	for ( POSITION pos = LibraryFolders.GetFolderIterator() ; pos ; )
	{
		CLibraryFolder* pFolder = LibraryFolders.GetNextFolder( pos );

		if ( pAlready.Find( pFolder ) == NULL )
		{
			Update( pFolder, NULL, m_hRoot, nUpdateCookie, FALSE );
		}
	}
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:33,代码来源:CtrlSharedFolder.cpp

示例3: GetNextRowAfterDel

CZGridRow* CDlgParamSet::GetNextRowAfterDel( CZGridRow*pCurItem)
{
	CZGridRow* pParaentItem=NULL;
	CZGridRow* pNextItem=NULL;

	CList<CBCGPGridRow*, CBCGPGridRow*> lst;

	//要删除的pRow
	//pCurItem = (CZGridRow*)m_wndGridTree.GetRow(nIndex);

	//if (pCurItem==NULL)		return n;

	pParaentItem = (CZGridRow*)pCurItem->GetParent();
	pParaentItem->GetSubItems(lst);
	POSITION pos =lst.Find(pCurItem);
	lst.GetNext (pos);
	 
	if (pos==NULL)
		pNextItem=pParaentItem;
	else
		pNextItem=(CZGridRow*)lst.GetAt(pos);
	
	return pNextItem;

}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:25,代码来源:DlgParamSet.cpp

示例4: AdjustAppointments

void CBCGPPlannerPrintMonth::AdjustAppointments ()
{
	XBCGPAppointmentArray& arQueryApps = GetQueryedAppointments ();

	const int nDays = GetViewDuration ();

	if (arQueryApps.GetSize () == 0 || m_ViewRects.GetSize () != nDays)
	{
		return;
	}

	for (int i = 0; i < arQueryApps.GetSize (); i++)
	{
		CBCGPAppointment* pApp = arQueryApps[i];
		ASSERT_VALID (pApp);

		pApp->ResetPrint ();
	}

	COleDateTime date (m_DateStart);

	COleDateTimeSpan spanDay (1, 0, 0, 0);
	const int delta = m_nRowHeight + 2 * m_OnePoint.cy;

	for (int nDay = 0; nDay < nDays; nDay ++)
	{
		CRect rect (m_ViewRects [nDay]);
		rect.top += m_nRowHeight + 2 * m_OnePoint.cy;
		rect.DeflateRect (m_OnePoint.cx, 0);

		BOOL bTopEq    = TRUE;
		BOOL bBottomEq = TRUE;
		
		if (nDay > 0)
		{
			bTopEq    = m_ViewRects [nDay].top == m_ViewRects [nDay - 1].top;
			bBottomEq = m_ViewRects [nDay].bottom == m_ViewRects [nDay - 1].bottom;
		}

		CList<int, int> lsItems;

		for (int i = 0; i < arQueryApps.GetSize (); i++)
		{
			CBCGPAppointment* pApp = arQueryApps[i];
			ASSERT_VALID (pApp);

			if (CBCGPPlannerView::IsAppointmentInDate (*pApp, date))
			{
				CRect rtApp (rect);

				int nItem = 0;

				while(TRUE)
				{
					POSITION pos = lsItems.Find (nItem);
					if (pos != NULL)
					{
						nItem++;
					}
					else
					{
						break;
					}
				}

				rtApp.top += nItem * delta;
				rtApp.bottom = rtApp.top + m_nRowHeight;

				BOOL bAllOrMulti = pApp->IsAllDay () || pApp->IsMultiDay ();

				// check for add new rect
				if (nDay > 0)
				{
					if (bTopEq && bAllOrMulti)
					{
						if (!pApp->GetDSPrint ().IsEmpty ())
						{
							CRect rt;
							rt = pApp->GetRectPrint (date - spanDay);

							if (!rt.IsRectEmpty () && rtApp.top != rt.top)
							{
								rtApp.top    = rt.top;
								rtApp.bottom = rt.bottom;
							}
						}
					}
				}

				if (((bTopEq && !bBottomEq) ||
					 (!bAllOrMulti && 
					  !CBCGPPlannerView::IsOneDay (pApp->GetStart (), pApp->GetFinish ()))) &&
					!pApp->GetDSDraw ().IsEmpty ())
				{
					CRect rtInter;
					rtInter.IntersectRect (rtApp, m_ViewRects [nDay]);

					if (rtInter.Height () < rtApp.Height () || 
						rtInter.bottom >= rect.bottom || !bAllOrMulti)
					{
//.........这里部分代码省略.........
开发者ID:iclosure,项目名称:jframework,代码行数:101,代码来源:BCGPPlannerPrintMonth.cpp

示例5: Query

void CBCGPRecurrence::Query (XBCGPAppointmentArray& ar, const COleDateTime& date1, const COleDateTime& date2) const
{
	ar.RemoveAll ();

	POSITION Pos = m_Exceptions.GetStartPosition ();
	COleDateTime Key;
	XBCGPRecurrenceException* Val = NULL;

	CList<COleDateTime, const COleDateTime&> exceptions;

	CBCGPAppointment* pApp = NULL;

	while (Pos != NULL)
	{
		m_Exceptions.GetNextAssoc (Pos, Key, Val);

		if (Val != NULL && !Val->m_Deleted)
		{
			if ((date1 <= Val->m_dtStart && Val->m_dtStart <= date2) || 
				(date1 <= Val->m_dtFinish && Val->m_dtFinish <= date2) ||
				(Val->m_dtStart < date1 && date2 < Val->m_dtFinish))
			{
				pApp = CreateClone (Key);

				if (pApp != NULL)
				{
					exceptions.AddTail (Key);
					ar.Add (pApp);
				}
			}
		}
	}

	CBCGPRecurrenceBaseRule* pRule = GetRule ();
	ASSERT_VALID(pRule);

	if (pRule == NULL)
	{
		return;
	}

	BOOL bNext = TRUE;
	COleDateTime dt1 (pRule->GetDateStart ());

	if (!CBCGPPlannerView::IsOneDay (m_pAppointment->GetStart (), 
			m_pAppointment->GetFinish ()))
	{
		if (dt1 < date1)
		{
			COleDateTimeSpan span ((double)((int)
				((double)m_pAppointment->GetDuration () + 0.5)));

			COleDateTime d (date1 - span);
			if (d > dt1)
			{
				dt1 = pRule->GetSiblingEventDay (d);
			}

			bNext = FALSE;
		}
	}

	if (bNext)
	{
		if (dt1 <= date2)
		{
			if (dt1 <= date1)
			{
				dt1 = pRule->GetSiblingEventDay (date1);
			}
		}
	}

	if (dt1 == COleDateTime ())
	{
		return;
	}

	while (dt1 <= date2)
	{
		if (exceptions.Find (dt1) == NULL 
			&& !ExceptionExists (dt1))
		{
			pApp = CreateClone (dt1);

			if (pApp != NULL)
			{
				if (pApp->GetFinish () != date1 ||
					(pApp->GetStart () == pApp->GetFinish () && pApp->GetFinish () == date1))
				{
					ar.Add (pApp);
				}
				else
				{
					delete pApp;
				}
			}
		}

		dt1 = pRule->GetNextEventDay (dt1);
//.........这里部分代码省略.........
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:101,代码来源:BCGPRecurrence.cpp

示例6: AdjustAppointments


//.........这里部分代码省略.........
				{
					continue;
				}

				if (!bDragDrop)
				{
					if(n == 1 && nApp == 0)
					{
						continue;
					}
				}

				XBCGPAppointmentArray& arApps = 
					n == 0
					? arAllOrMulti
					: (nApp == 0 ? arDragApps : arQueryApps);

				for (int i = 0; i < arApps.GetSize (); i++)
				{
					CBCGPAppointment* pApp = arApps[i];
					ASSERT_VALID (pApp);

					BOOL bAllOrMulti = pApp->IsAllDay () || pApp->IsMultiDay ();

					if (CBCGPPlannerView::IsAppointmentInDate (*pApp, date) &&
						((n == 0 && bAllOrMulti) || (n == 1 && !bAllOrMulti)))
					{
						CRect rtApp (rect);

						int nItem = 0;

						while(TRUE)
						{
							POSITION pos = lsItems.Find (nItem);
							if (pos != NULL)
							{
								nItem++;
							}
							else
							{
								break;
							}
						}

						rtApp.top += nItem * delta;
						rtApp.bottom = rtApp.top + m_nRowHeight;

						// check for add new rect
						if (nDay > 0)
						{
							if (bTopEq && bAllOrMulti)
							{
								if (!pApp->GetDSDraw ().IsEmpty ())
								{
									CRect rt;
									rt = pApp->GetRectDraw (date - spanDay);

									if (!rt.IsRectEmpty () && rtApp.top != rt.top)
									{
										rtApp.top    = rt.top;
										rtApp.bottom = rt.bottom;
									}
								}
							}
						}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:66,代码来源:BCGPPlannerViewMonth.cpp

示例7: Run


//.........这里部分代码省略.........
#ifdef _DEBUG
						// in debugmode we load and verify all hashsets
						ASSERT( pCurFile->GetAICHHashset()->LoadHashSet() );
//			 			pCurFile->GetAICHHashset()->DbgTest();
						pCurFile->GetAICHHashset()->FreeHashSet();
#endif
						break;
					}
				}
				if (bFound) // hashset is available, everything fine with this file
					continue;
			}
			pCurFile->GetAICHHashset()->SetStatus(AICH_ERROR);
			m_liToHash.AddTail(pCurFile);
		}
	}
	sharelock.Unlock();

	// removed all unused AICH hashsets from known2.met
	if (!thePrefs.IsRememberingDownloadedFiles() && liUsedHashs.GetCount() != liKnown2Hashs.GetCount()){
		file.SeekToBegin();
		try {
			uint32 nExistingSize = (UINT)file.GetLength();
			uint16 nHashCount;
			ULONGLONG posWritePos = 0;
			ULONGLONG posReadPos = 0;
			uint32 nPurgeCount = 0;
			while (file.GetPosition() < nExistingSize){
				CAICHHash aichHash(&file);
				nHashCount = file.ReadUInt16();
				if (file.GetPosition() + nHashCount*CAICHHash::GetHashSize() > nExistingSize){
					AfxThrowFileException(CFileException::endOfFile, 0, file.GetFileName());
				}
				if (liUsedHashs.Find(aichHash) == NULL){
					// unused hashset skip the rest of this hashset
					file.Seek(nHashCount*CAICHHash::GetHashSize(), CFile::current);
					nPurgeCount++;
				}
				else if(nPurgeCount == 0){
					// used Hashset, but it does not need to be moved as nothing changed yet
					file.Seek(nHashCount*CAICHHash::GetHashSize(), CFile::current);
					posWritePos = file.GetPosition();
				}
				else{
					// used Hashset, move position in file
					BYTE* buffer = new BYTE[nHashCount*CAICHHash::GetHashSize()];
					file.Read(buffer, nHashCount*CAICHHash::GetHashSize());
					posReadPos = file.GetPosition();
					file.Seek(posWritePos, CFile::begin);
					file.Write(aichHash.GetRawHash(), CAICHHash::GetHashSize());
					file.WriteUInt16(nHashCount);
					file.Write(buffer, nHashCount*CAICHHash::GetHashSize());
					delete[] buffer;
					posWritePos = file.GetPosition();
					file.Seek(posReadPos, CFile::begin); 
				}
			}
			posReadPos = file.GetPosition();
			file.SetLength(posWritePos);
			theApp.QueueDebugLogLine(false, _T("Cleaned up known2.met, removed %u hashsets (%s)"), nPurgeCount, CastItoXBytes(posReadPos-posWritePos)); 

			file.Flush();
			file.Close();
		}
		catch(CFileException* error){
			if (error->m_cause == CFileException::endOfFile){
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:67,代码来源:AICHSyncThread.cpp

示例8: OnInitDialog

BOOL CFileSharingPage::OnInitDialog()
{
	CFilePropertiesPage::OnInitDialog();

	m_wndTags.AddString( L"" );

	{
		CQuickLock oLock( UploadQueues.m_pSection );

		CList< CString > pAdded;

		for ( POSITION pos = UploadQueues.GetIterator(); pos; )
		{
			CUploadQueue* pQueue = UploadQueues.GetNext( pos );

			if ( ! pQueue->m_sShareTag.IsEmpty() )
			{
				if ( pAdded.Find( pQueue->m_sShareTag ) == NULL )
				{
					pAdded.AddTail( pQueue->m_sShareTag );
					m_wndTags.AddString( pQueue->m_sShareTag );
				}
			}
		}

		if ( pAdded.IsEmpty() )
		{
			m_wndTags.AddString( L"Release" );
			m_wndTags.AddString( L"Popular" );
		}
	}

	{
		CQuickLock oLock( Library.m_pSection );

		if ( CLibraryFile* pSingleFile = GetFile() )
		{
			m_bOverride	= pSingleFile->IsSharedOverride();
			m_bShare	= pSingleFile->IsShared();
			m_sTags		= pSingleFile->m_sShareTags;
		}
		else
		{
			CLibraryListPtr pList( GetList() );
			if ( pList )
			{
				for ( POSITION pos = pList->GetHeadPosition(); pos; )
				{
					if ( CLibraryFile* pFile = pList->GetNextFile( pos ) )
					{
						m_bOverride	= pFile->IsSharedOverride();
						m_bShare	= pFile->IsShared();
						m_sTags		= pFile->m_sShareTags;
					}
				}
			}
		}
	}

	UpdateData( FALSE );
	m_wndShare.EnableWindow( m_bOverride );

	return TRUE;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:64,代码来源:PageFileSharing.cpp

示例9: Run


//.........这里部分代码省略.........
	// removed all unused AICH hashsets from known2.met
	if (liUsedHashs.GetCount() != liKnown2Hashs.GetCount() && 
		// EastShare START - Added by TAHO, .met file control
		/*
		(!thePrefs.IsRememberingDownloadedFiles() || thePrefs.DoPartiallyPurgeOldKnownFiles()))
		*/
			(!thePrefs.IsRememberingDownloadedFiles() ||
			  thePrefs.DoPartiallyPurgeOldKnownFiles() || 
			  thePrefs.DoCompletlyPurgeOldKnownFiles() ||
			  thePrefs.DoRemoveAichImmediatly()
			)
		)
		// EastShare END   - Added by TAHO, .met file control
	{
		file.SeekToBegin();
		try {
			uint8 header = file.ReadUInt8();
			if (header != KNOWN2_MET_VERSION){
				AfxThrowFileException(CFileException::endOfFile, 0, file.GetFileName());
			}

			uint32 nExistingSize = (UINT)file.GetLength();
			uint32 nHashCount;
			ULONGLONG posWritePos = file.GetPosition();
			ULONGLONG posReadPos = file.GetPosition();
			uint32 nPurgeCount = 0;
			uint32 nPurgeBecauseOld = 0;
			while (file.GetPosition() < nExistingSize){
				CAICHHash aichHash(&file);
				nHashCount = file.ReadUInt32();
				if (file.GetPosition() + nHashCount*CAICHHash::GetHashSize() > nExistingSize){
					AfxThrowFileException(CFileException::endOfFile, 0, file.GetFileName());
				}
				if (!thePrefs.IsRememberingDownloadedFiles() && liUsedHashs.Find(aichHash) == NULL)
				{
					// unused hashset skip the rest of this hashset
					file.Seek(nHashCount*CAICHHash::GetHashSize(), CFile::current);
					nPurgeCount++;
				}
				else if (thePrefs.IsRememberingDownloadedFiles() && theApp.knownfiles->ShouldPurgeAICHHashset(aichHash))
				{
					// EastShare START - Added by TAHO, .met file control
					/*
					ASSERT( thePrefs.DoPartiallyPurgeOldKnownFiles() );
					*/
					ASSERT( thePrefs.DoPartiallyPurgeOldKnownFiles() || thePrefs.DoRemoveAichImmediatly());
					// EastShare END   - Added by TAHO, .met file control
					// also unused (purged) hashset skip the rest of this hashset
					file.Seek(nHashCount*CAICHHash::GetHashSize(), CFile::current);
					nPurgeCount++;
					nPurgeBecauseOld++;
				}
				else if(nPurgeCount == 0){
					// used Hashset, but it does not need to be moved as nothing changed yet
					file.Seek(nHashCount*CAICHHash::GetHashSize(), CFile::current);
					posWritePos = file.GetPosition();
					CAICHRecoveryHashSet::AddStoredAICHHash(aichHash);
				}
				else{
					// used Hashset, move position in file
					BYTE* buffer = new BYTE[nHashCount*CAICHHash::GetHashSize()];
					file.Read(buffer, nHashCount*CAICHHash::GetHashSize());
					posReadPos = file.GetPosition();
					file.Seek(posWritePos, CFile::begin);
					file.Write(aichHash.GetRawHash(), CAICHHash::GetHashSize());
					file.WriteUInt32(nHashCount);
开发者ID:e1z0,项目名称:sMule,代码行数:67,代码来源:AICHSyncThread.cpp


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