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


C++ GetIterator函数代码示例

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


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

示例1: Serialize

void CLibraryHistory::Serialize(CArchive& ar, int nVersion)
{
	if ( nVersion < 7 ) return;

	int nCount = 0;
	POSITION pos;

	if ( ar.IsStoring() )
	{
		for ( pos = GetIterator() ; pos ; )
		{
			if ( GetNext( pos )->m_pFile != NULL ) nCount ++;
		}

		ar.WriteCount( nCount );

		for ( pos = GetIterator() ; pos ; )
		{
			CLibraryRecent* pRecent = GetNext( pos );
			if ( pRecent->m_pFile != NULL ) pRecent->Serialize( ar, nVersion );
		}

		ar << LastSeededTorrent.m_sPath;
		if ( LastSeededTorrent.m_sPath.GetLength() )
		{
			ar << LastSeededTorrent.m_sName;
			ar << LastSeededTorrent.m_tLastSeeded;
			ar.Write( &LastSeededTorrent.m_pBTH, sizeof(SHA1) );
		}
	}
	else
	{
		Clear();

		for ( nCount = ar.ReadCount() ; nCount > 0 ; nCount-- )
		{
			CLibraryRecent* pRecent = new CLibraryRecent();
			pRecent->Serialize( ar, nVersion );

			if ( pRecent->m_pFile != NULL )
			{
				m_pList.AddTail( pRecent );
			}
			else
			{
				delete pRecent;
			}
		}

		if ( nVersion > 22 )
		{
			ar >> LastSeededTorrent.m_sPath;
			if ( LastSeededTorrent.m_sPath.GetLength() )
			{
				ar >> LastSeededTorrent.m_sName;
				ar >> LastSeededTorrent.m_tLastSeeded;
				ar.Read( &LastSeededTorrent.m_pBTH, sizeof(SHA1) );
			}
		}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:59,代码来源:LibraryHistory.cpp

示例2: sizeof

//----------------------------------------------------------------------------------------------
int ObjectSerializer::SerializeUserDefinedType(ISerializable *pObj, TypeNode* pType, bool isPtr, fstream& pen)
{
	int     size = 0;
	bool    isNull = false;

	if (isPtr)
	{
		// Access the pointer pointed by the pointer to pointer
		pObj = (*(ISerializable**)pObj);
		int         length = 0;
		string      typeName;
		char        buffer[MaxTypeNameLength + 1];

		isNull = (NULL == pObj);
		pen.write(reinterpret_cast<char*>(&isNull), sizeof(bool));

		if (!isNull)
		{
			auto        objLayout = pObj->GetObjectLayout();

			typeName = g_ObjectFactory.FromCName(objLayout.CName());

			PerformLateBinding(pObj, pType);

			length = typeName.size();
			_ASSERTE(length <= MaxTypeNameLength);
			strcpy_s(buffer, typeName.c_str());
			buffer[length] = 0;
			pen.write(buffer, MaxTypeNameLength + 1);

			Iterator* addresses = objLayout.GetIterator();
			unsigned* addr32;
			for (int memberIdx = 0; addresses->MoveNext(); ++memberIdx)
			{
				_ASSERTE(memberIdx < pType->Children.size());
				addr32 = reinterpret_cast<unsigned*>(addresses->Current());
				SerializeType(reinterpret_cast<char*>(*addr32), pType->Children[memberIdx].Ptr32, pen);
			}
		}
		size = sizeof(unsigned);
	}
	else
	{
		auto objLayout = pObj->GetObjectLayout();
		Iterator* addresses = objLayout.GetIterator();
		unsigned* addr32;
		for (int memberIdx = 0; addresses->MoveNext(); ++memberIdx)
		{
			_ASSERTE(memberIdx < pType->Children.size());
			addr32 = reinterpret_cast<unsigned*>(addresses->Current());
			SerializeType(reinterpret_cast<char*>(*addr32), pType->Children[memberIdx].Ptr32, pen);
		}

		size = objLayout.TypeSize();
	}

	return size;
}
开发者ID:MHesham,项目名称:Serialization,代码行数:59,代码来源:ObjectSerializer.cpp

示例3: oLock

void CSecurity::Clear()
{
	CQuickLock oLock( m_pSection );

	for ( POSITION pos = m_Complains.GetStartPosition() ; pos ; )
	{
		DWORD pAddress;
		CComplain* pComplain;
		m_Complains.GetNextAssoc( pos, pAddress, pComplain );
		delete pComplain;
	}
	m_Complains.RemoveAll();

	for ( POSITION pos = GetIterator() ; pos ; )
	{
		delete GetNext( pos );
	}
	m_pRules.RemoveAll();

	m_Cache.clear();
	m_AddressMap.clear();
	m_pRuleIndexMap.clear();
	for ( BYTE nType = 0 ; nType < urnLast ; nType++ )
		m_HashMap[ nType ].clear();
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:25,代码来源:Security.cpp

示例4:

BNetworkCookieJar::~BNetworkCookieJar()
{
    BNetworkCookie* cookiePtr;

    for (Iterator it = GetIterator(); (cookiePtr = it.Next()) != NULL;)
        delete it.Remove();
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:7,代码来源:NetworkCookieJar.cpp

示例5: pLock

void CDownloadWithSources::RemoveOverlappingSources(QWORD nOffset, QWORD nLength)
{
	CQuickLock pLock( Transfers.m_pSection );

	for ( POSITION posSource = GetIterator() ; posSource ; )
	{
		CDownloadSource* pSource = GetNext( posSource );

		if ( pSource->TouchedRange( nOffset, nLength ) )
		{
			if ( GetTaskType() == dtaskMergeFile )
			{
				// Merging process can produce corrupted blocks, retry connection after 30 seconds
				pSource->m_nFailures = 0;
				pSource->Close( 30 );
			}
			else
			{
				theApp.Message( MSG_ERROR, IDS_DOWNLOAD_VERIFY_DROP,
					(LPCTSTR)CString( inet_ntoa( pSource->m_pAddress ) ), (LPCTSTR)pSource->m_sServer, (LPCTSTR)m_sName, nOffset, nOffset + nLength - 1 );
				pSource->Remove( TRUE, FALSE );
			}
		}
	}
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:25,代码来源:DownloadWithSources.cpp

示例6: ClearTodays

void CLibraryHistory::ClearTodays()
{
	for ( POSITION pos = GetIterator() ; pos ; )
	{
		GetNext( pos )->m_bToday = FALSE;
	}
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:7,代码来源:LibraryHistory.cpp

示例7: inet_ntoa

CPrivateChatWnd* CChatWindows::FindED2KFrame(DWORD nClientID, const SOCKADDR_IN* pServerAddress) const
{
	// For Low ID clients
	if ( ( nClientID > 0 ) && ( nClientID < 16777216 ) )  // ED2K Low ID
	{
		CString strLowID;
		strLowID.Format( L"%[email protected]%s:%hu",
		nClientID,
		(LPCTSTR)CString( inet_ntoa( pServerAddress->sin_addr ) ),
		pServerAddress->sin_port );

		for ( POSITION pos = GetIterator(); pos; )
		{
			CPrivateChatWnd* pFrame = static_cast<CPrivateChatWnd*>( GetNext( pos ) );

			if ( pFrame->IsKindOf( RUNTIME_CLASS(CPrivateChatWnd) ) )
			{
				if ( pFrame->Find( strLowID ) )
					return pFrame;
			}
		}
	}

	return NULL;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:25,代码来源:ChatWindows.cpp

示例8: OnExecuteFile

BOOL CPlugins::OnExecuteFile(LPCTSTR pszFile, BOOL bUseImageViewer)
{
	CPlugin* pImageViewer = NULL;

	for ( POSITION pos = GetIterator() ; pos ; )
	{
		CPlugin* pPlugin = GetNext( pos );

		if ( pPlugin->m_pExecute )
		{
			if ( pPlugin->m_sName == _T("PeerProject Image Viewer") )
			{
				pImageViewer = pPlugin;
				continue;
			}
			if ( pPlugin->m_pExecute->OnExecute( CComBSTR( pszFile ) ) == S_OK )
				return TRUE;
		}
	}

	if ( bUseImageViewer && pImageViewer )
		return ( pImageViewer->m_pExecute->OnExecute( CComBSTR( pszFile ) ) == S_OK );

	return FALSE;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:25,代码来源:Plugins.cpp

示例9: OnCommand

BOOL CPlugins::OnCommand(CChildWnd* pActiveWnd, UINT nCommandID)
{
	if ( pActiveWnd != NULL && pActiveWnd->IsKindOf( RUNTIME_CLASS(CPluginWnd) ) )
	{
		CPluginWnd* pPluginWnd = (CPluginWnd*)pActiveWnd;

		if ( pPluginWnd->m_pOwner )
		{
			if ( pPluginWnd->m_pOwner->OnCommand( nCommandID ) == S_OK )
				return TRUE;
		}
	}

	for ( POSITION pos = GetIterator() ; pos ; )
	{
		CPlugin* pPlugin = GetNext( pos );

		if ( pPlugin->m_pCommand )
		{
			if ( pPlugin->m_pCommand->OnCommand( nCommandID ) == S_OK )
				return TRUE;
		}
	}

	return FALSE;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:26,代码来源:Plugins.cpp

示例10: Clear

void CNetwork::Clear()
{
	for ( POSITION pos = GetIterator() ; pos ; )
	{
		GetNext( pos )->Disconnect();
	}
}
开发者ID:pics860,项目名称:callcenter,代码行数:7,代码来源:network.cpp

示例11: RunNeighbours

BOOL CNetwork::RunNeighbours()
{
	for ( POSITION posNext = GetIterator() ; posNext ; )
	{
		CTransfer* pTransfer = GetNext( posNext );
		
		try
		{
			if ( ! pTransfer->OnRun() ) return FALSE;
		}
		catch( CHAR* sError )
		{
			CString strHost = inet_ntoa( pTransfer->m_pHost.sin_addr );
			XDebugLog( MSG_ERROR, "error on channel '%s': %s", strHost, sError );
			return FALSE;
		}
#ifndef _DEBUG
		catch(...)
		{
			CString strHost = inet_ntoa( pTransfer->m_pHost.sin_addr );
			XDebugLog( MSG_ERROR, "error on channel '%s': %s", strHost, "a fatal error" );
			return FALSE;
		}
#endif
	}
	
	return TRUE;
}
开发者ID:pics860,项目名称:callcenter,代码行数:28,代码来源:network.cpp

示例12: time

BOOL CSecurity::IsDenied(const CQuerySearch* pQuery, const CString& strContent)
{
	const DWORD tNow = static_cast< DWORD >( time( NULL ) );

	CQuickLock oLock( m_pSection );

	for ( POSITION pos = GetIterator() ; pos ; )
	{
		POSITION posLast = pos;
		CSecureRule* pRule = GetNext( pos );

		if ( pRule->IsExpired( tNow ) )
		{
			m_pRules.RemoveAt( posLast );
			delete pRule;
		}
		else if ( pRule->Match( pQuery, strContent ) )
		{
			pRule->m_nToday ++;
			pRule->m_nEver ++;

			if ( pRule->m_nAction == CSecureRule::srDeny )   return TRUE;
			if ( pRule->m_nAction == CSecureRule::srAccept ) return FALSE;
		}
	}

	return m_bDenyPolicy;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:28,代码来源:Security.cpp

示例13: pLock

void CUploads::OnRename(LPCTSTR pszSource, LPCTSTR pszTarget)
{
	CSingleLock pLock( &Transfers.m_pSection );
	
	if ( pLock.Lock( 500 ) )
	{
		for ( POSITION pos = GetIterator() ; pos ; )
		{
			GetNext( pos )->OnRename( pszSource, pszTarget );
		}
		
		pLock.Unlock();
	}
	
	CSingleLock pLock2( &theApp.m_pSection );
	
	if ( pLock2.Lock( 500 ) )
	{
		if ( CMainWnd* pMainWnd = (CMainWnd*)theApp.m_pSafeWnd )
		{
			CMediaWnd* pMediaWnd = (CMediaWnd*)pMainWnd->m_pWindows.Find(
				RUNTIME_CLASS(CMediaWnd) );
			
			if ( pMediaWnd != NULL )
			{
				pMediaWnd->OnFileDelete( pszSource );
			}
		}
		
		pLock2.Unlock();
	}
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:32,代码来源:Uploads.cpp

示例14: GetCount

int CUploads::GetCount(CUploadTransfer* pExcept, int nState) const
{
	if ( pExcept == NULL && nState == -1 ) return m_pList.GetCount();
	
	int nCount = 0;
	
	for ( POSITION pos = GetIterator() ; pos ; )
	{
		CUploadTransfer* pUpload = GetNext( pos );
		
		if ( pUpload != pExcept )
		{
			switch ( nState )
			{
			case -1:
				nCount++;
				break;
			case -2:
				if ( pUpload->m_nState > upsNull ) nCount++;
				break;
			default:
				if ( pUpload->m_nState == nState ) nCount++;
				break;
			}
		}
	}
	
	return nCount;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:29,代码来源:Uploads.cpp

示例15: GetIterator

uint16_t CFX_ListItem::GetFirstChar() const {
  CPVT_Word word;
  CFX_Edit_Iterator* pIterator = GetIterator();
  pIterator->SetAt(1);
  pIterator->GetWord(word);
  return word.Word;
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:7,代码来源:fxet_list.cpp


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