• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetIterator函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: rand

CG2Neighbour* CNeighboursWithG2::GetRandomHub(CG2Neighbour* pExcept, GGUID* pGUID)
{
    CPtrArray pRandom;

    for ( POSITION pos = GetIterator() ; pos ; )
    {
        CG2Neighbour* pNeighbour = (CG2Neighbour*)GetNext( pos );

        if (	pNeighbour->m_nState == nrsConnected &&
                pNeighbour->m_nProtocol == PROTOCOL_G2 &&
                pNeighbour->m_nNodeType != ntLeaf &&
                pNeighbour != pExcept )
        {
            if ( pNeighbour->m_pGUIDCache->Lookup( pGUID ) == NULL )
            {
                pRandom.Add( pNeighbour );
            }
        }
    }

    int nSize = pRandom.GetSize();
    if ( ! nSize ) return NULL;

    nSize = rand() % nSize;

    return (CG2Neighbour*)pRandom.GetAt( nSize );
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:27,代码来源:NeighboursWithG2.cpp


示例17: GetTorrentCount

int CUploads::GetTorrentCount(int nState) const
{
	int nCount = 0;
	
	for ( POSITION pos = GetIterator() ; pos ; )
	{
		CUploadTransfer* pUpload = GetNext( pos );

		if ( pUpload->m_nProtocol == PROTOCOL_BT )
		{
			switch ( nState )
			{
			case -1:
				nCount++;
				break;
			case -2:
				if ( pUpload->m_nState > upsNull ) nCount++;
				break;
			case -3:
				if ( pUpload->m_nState >= upsUploading ) nCount++;
				break;
			default:
				if ( pUpload->m_nState == nState ) nCount++;
				break;
			}
		}
	}
	
	return nCount;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:30,代码来源:Uploads.cpp


示例18: _T

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

		for ( POSITION pos = GetIterator() ; pos ; )
		{
			CPrivateChatFrame* pFrame = reinterpret_cast<CPrivateChatFrame*>( GetNext( pos ) );
			
			if ( pFrame->IsKindOf( RUNTIME_CLASS(CPrivateChatFrame) ) )
			{
				if ( ( strLowID == pFrame->m_sNick ) && ( pFrame->m_pSession == NULL ) )
				{
					return pFrame;
				}	
			}
		}
	}

	return NULL;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:28,代码来源:ChatWindows.cpp


示例19: VALIDATE_NOT_NULL

ECode NetworkIdentitySet::WriteToStream(
    /* [in] */ IDataOutput* out)
{
    VALIDATE_NOT_NULL(out);
    out->WriteInt32(VERSION_ADD_NETWORK_ID);
    Int32 size;
    GetSize(&size);
    out->WriteInt32(size);
    AutoPtr<IIterator> iter;
    GetIterator((IIterator**)&iter);
    while (Ptr(iter)->Func(iter->HasNext)) {
        AutoPtr<INetworkIdentity> ident = INetworkIdentity::Probe(Ptr(iter)->Func(iter->GetNext));
        Int32 type;
        ident->GetType(&type);
        out->WriteInt32(type);
        Int32 subtype;
        ident->GetSubType(&subtype);
        out->WriteInt32(subtype);
        String subscriberId;
        ident->GetSubscriberId(&subscriberId);
        WriteOptionalString(out, subscriberId);
        String networkId;
        ident->GetNetworkId(&networkId);
        WriteOptionalString(out, networkId);
        Boolean roaming;
        ident->GetRoaming(&roaming);
        out->WriteBoolean(roaming);
    }
    return NOERROR;
}
开发者ID:XilongPei,项目名称:Elastos5,代码行数:30,代码来源:NetworkIdentitySet.cpp


示例20: GetNext

// Takes a connected computer to ignore, and a GUID (do)
// Randomly chooses a neighbour from amongst those that are connected, running Gnutella2, hubs, and don't know about the GUID
// Returns a pointer to that randomly selected neighbour
CG2Neighbour* CNeighboursWithG2::GetRandomHub(CG2Neighbour* pExcept, const Hashes::Guid& oGUID)
{
	// Make a new local empty list that will hold pointers to neighbours
	CArray< CG2Neighbour* > pRandom;

	// Loop through each computer we're connected to
	for ( POSITION pos = GetIterator() ; pos ; )
	{
		// Get the neighbour under the current position, and move to the next one in the list
		CNeighbour* pNeighbour = GetNext( pos );

		// If this is a Gnutella2 hub
		if ( pNeighbour->m_nState == nrsConnected   &&	// We've finished the handshake with this computer, and
			 pNeighbour->m_nProtocol == PROTOCOL_G2 &&	// It's running Gnutella2 software, and
			 pNeighbour->m_nNodeType != ntLeaf      &&	// Our connection to it isn't down to a leaf, and
			 pNeighbour != pExcept )					// It's not the one the caller told us to avoid
		{
			// And it doesn't know the given GUID, add it to the random list
			if ( static_cast< CG2Neighbour* >( pNeighbour )->m_pGUIDCache->Lookup( oGUID ) == NULL )
				pRandom.Add( static_cast< CG2Neighbour* >( pNeighbour ) );
		}
	}

	// If we didn't find any neighbours to put in the list, return null
	INT_PTR nSize = pRandom.GetSize();
	if ( ! nSize ) return NULL;

	// Choose a random number between 0 and nSize - 1, use it as an index, and return the neighbour at it
	nSize = GetRandomNum< INT_PTR >( 0, nSize - 1 );
	return pRandom.GetAt( nSize );
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:34,代码来源:NeighboursWithG2.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetKeyName函数代码示例发布时间:2022-05-30
下一篇:
C++ GetItemText函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap