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


C++ CObList::GetCount方法代码示例

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


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

示例1: GetProfs

void CInfCreature::GetProfs(CObList &list)
{
	if (m_plAffects.GetCount() < 1)
		return;

	INF_AFF *pAff;
	POSITION pos = m_plAffects.GetHeadPosition();
	while(pos)
	{
		pAff = (INF_AFF*)m_plAffects.GetNext(pos);

		if (pAff->dwAffectType == AFF_TYPE_PROF)
		{
			CProfData *pProf = new CProfData;

			pProf->m_chProf = (BYTE)pAff->nNP2;

			if (m_infCre.chDualClass)
			{
				pProf->m_nFirstClass = HITRIBBLE(pAff->nNP1);
				pProf->m_nSecondClass = LOTRIBBLE(pAff->nNP1);
			}
			else
				pProf->m_nFirstClass = pAff->nNP1;

			list.AddTail(pProf);
		}
	}
	TRACE("CInfCreautre::GetProfs() - %d profs found.\n",list.GetCount());
}
开发者ID:devurandom,项目名称:shadowkeeper,代码行数:30,代码来源:InfCreature.cpp

示例2: GetList

void CObBinTree::GetList( CObList& list )
{
	ASSERT(list.IsEmpty());
	if( !list.IsEmpty() )list.RemoveAll();

	WalkTree( StoreInList, (LPVOID)&list, TV_INORDER );

	ASSERT( list.GetCount()==GetCount() );
}
开发者ID:EISALab,项目名称:AMGAgroundwater,代码行数:9,代码来源:tree_ob.cpp

示例3: dlg

LRESULT CNewWindowDlg::OnP4UserList(WPARAM wParam, LPARAM lParam)
{
	CCmd_Users *pCmd= (CCmd_Users *) wParam;

	if(!pCmd->GetError())
	{
		SET_APP_HALTED(TRUE);

		// Get the column names and count
		CStringArray cols;
		int nbrcols = MainFrame()->GetUserColNamesAndCount(cols);

		CString str;
		CString caption = LoadStringResource(IDS_PERFORCE_USERS);
		CString subkey  = _T("User List");

		CObList const *users = pCmd->GetList();
	    CObList *objs = new CObList;

		int index = 0;
		for(POSITION pos= users->GetHeadPosition(); pos != NULL; index++)
		{
        	CP4User *user = (CP4User *) users->GetNext(pos);
			int subitem;
			CP4Object *newObj= new CP4Object();
			for (subitem = -1; ++subitem < nbrcols; )
			{
				switch(subitem)
				{
				case 0:
					str = user->GetUserName();
					break;
				case 1:
					str = user->GetEmail();
					break;
				case 2:
					str = user->GetFullName();
					break;
				case 3:
					str = user->GetLastAccess();
					break;
				default:
					ASSERT(0);
					continue;
				}
				if (!subitem)
					newObj->Create(str);
				else
					newObj->AddField(str);
			}
			objs->AddHead(newObj);
			delete user;
		}

		if( objs->GetCount() == 0 )
		{
			CString txt;
			txt.FormatMessage(IDS_NO_s_AVAILABLE, caption);
			AfxMessageBox(txt, MB_ICONEXCLAMATION);
			SET_APP_HALTED(FALSE);
			delete objs;
			return 0;
		}

		CString msg;
		msg.FormatMessage( IDS_NUMBER_OF_USERS_n, index );
		MainFrame()->UpdateStatus( msg );

		// Display the dialog box.
		CP4ListBrowse dlg(&(MainFrame()->GetUserView()->GetListCtrl()));
		dlg.SetP4ObjectFont(GetFont());
		dlg.SetP4ObjectType(P4USER_SPEC);
		dlg.SetP4ObjectList(objs);
		dlg.SetP4ObjectCols(&cols);
		dlg.SetP4ObjectCurr(&m_user);
		dlg.SetP4ObjectSKey(&subkey);
		dlg.SetP4ObjectCaption(&caption);
		dlg.SetP4ObjectImage(CP4ViewImageList::VI_USER);

		CString old_port;
		CString old_user;
		if (!m_bSamePort)
		{
			old_port = GET_P4REGPTR()->GetP4Port();
			old_user = GET_P4REGPTR()->GetP4User();
			GET_P4REGPTR()->SetP4Port(m_port, TRUE, FALSE, FALSE);
			GET_P4REGPTR()->SetP4User(_T(""), TRUE, FALSE, FALSE);
		}
		int retcode= dlg.DoModal();
		if (!m_bSamePort)
		{
			GET_P4REGPTR()->SetP4Port(old_port, TRUE, FALSE, FALSE);
			GET_P4REGPTR()->SetP4User(old_user, TRUE, FALSE, FALSE);
		}
		SET_APP_HALTED(FALSE);

		// Delete the object list
		for(POSITION pos=objs->GetHeadPosition(); pos!=NULL; )
			delete (CP4Object *) objs->GetNext(pos);
		delete objs;
//.........这里部分代码省略.........
开发者ID:danieljennings,项目名称:p4win,代码行数:101,代码来源:NewWindowDlg.cpp

示例4: while

LRESULT CNewWindowDlg::OnP4ClientList(WPARAM wParam, LPARAM lParam)
{
	CCmd_Clients *pCmd= (CCmd_Clients *) wParam;

	if(!pCmd->GetError())
	{
		SET_APP_HALTED(TRUE);

		// Get the column names and count
		CStringArray cols;
		int nbrcols = MainFrame()->GetClientColNamesAndCount(cols);
		CString subkey  = _T("Client List");

		CObList const *clients = pCmd->GetList();
	    CObList *objs = new CObList;

		int index = 0;		// initialized only to make the compiler shutup
		BOOL isFiltered = GET_P4REGPTR()->GetClientFilteredFlags();

		if ( isFiltered )
			index = LoadClientList(clients, objs, nbrcols, TRUE);

		if( !isFiltered || objs->GetCount() == 0 )
			 index = LoadClientList(clients, objs, nbrcols, isFiltered = FALSE);

		if( objs->GetCount() == 0 )
		{
			CString txt;
			txt.FormatMessage(IDS_NO_s_AVAILABLE, LoadStringResource(IDS_PERFORCE_CLIENTS));
			AfxMessageBox(txt, MB_ICONEXCLAMATION);
			SET_APP_HALTED(FALSE);
		}
		else while (1)
		{
			CString msg;
			msg.FormatMessage( IDS_NUMBER_OF_CLIENTS_n, index );
			MainFrame()->UpdateStatus( msg );

			CString caption = LoadStringResource(IDS_PERFORCE_CLIENTS);
			if (isFiltered)
				caption += LoadStringResource(IDS_FILTERED_INPAREN);

			// Display the dialog box.
			CP4ListBrowse dlg(&(MainFrame()->GetClientView()->GetListCtrl()));
			dlg.SetP4ObjectFont(GetFont());
			dlg.SetP4ObjectType(P4CLIENT_SPEC);
			dlg.SetP4ObjectList(objs);
			dlg.SetP4ObjectCols(&cols);
			dlg.SetP4ObjectCurr(&m_client);
			dlg.SetP4ObjectSKey(&subkey);
			dlg.SetP4ObjectCaption(&caption);
			dlg.SetP4ObjectImage(CP4ViewImageList::VI_CLIENT);
			dlg.SetP4ObjectIsFiltered(isFiltered);

			CString old_port;
			CString old_user;
			if (!m_bSamePort)
			{
				old_port = GET_P4REGPTR()->GetP4Port();
				old_user = GET_P4REGPTR()->GetP4User();
				GET_P4REGPTR()->SetP4Port(m_port, TRUE, FALSE, FALSE);
				GET_P4REGPTR()->SetP4User(_T(""), TRUE, FALSE, FALSE);
			}
			int retcode= dlg.DoModal();
			if (!m_bSamePort)
			{
				GET_P4REGPTR()->SetP4Port(old_port, TRUE, FALSE, FALSE);
				GET_P4REGPTR()->SetP4User(old_user, TRUE, FALSE, FALSE);
			}
			SET_APP_HALTED(FALSE);

			CString *objname= dlg.GetSelectedP4Object();
			if(retcode == IDOK && !objname->IsEmpty())
				::SendMessage(m_hWnd, WM_BROWSECALLBACK1, 0, (LPARAM)objname);
			else if (retcode == IDC_REFRESH)
			{
				if (isFiltered)
				{
					isFiltered = FALSE;
					index = LoadClientList(clients, objs, nbrcols, FALSE);
					continue;
				}
				else
					PostMessage(WM_BROWSECLIENTS, 0, 0);
			}

			// Delete the object list
			for(POSITION pos=objs->GetHeadPosition(); pos!=NULL; )
				delete (CP4Object *) objs->GetNext(pos);
			break;
		}
		delete objs;
		for(POSITION pos= clients->GetHeadPosition(); pos != NULL; )
		{
       		CP4Client *client = (CP4Client *) clients->GetNext(pos);
			delete client;
		}
	}
	delete pCmd;
	MainFrame()->ClearStatus();
//.........这里部分代码省略.........
开发者ID:danieljennings,项目名称:p4win,代码行数:101,代码来源:NewWindowDlg.cpp

示例5: LoadImages

BOOL CSpellBitmaps::LoadImages(BOOL bBlankOnly, CProgressCtrl *pCtrl)
{
	if (!m_ilSpells.Create(32,32,ILC_COLOR32,270,30))
		return(FALSE);

	CObList *pSpells;
	if (!_infKey.GetResList(RESTYPE_SPL,pSpells))
		return(FALSE);

	CDC *pDC = AfxGetMainWnd()->GetDC();
	BITMAPINFOHEADER bih;
	memset(&bih,0,sizeof(BITMAPINFOHEADER));

	BYTE chBits[32*32*sizeof(COLORREF)];
	COLORREF clrWhite = RGB(255,255,255);
	for (int i=0;i<32*32;i++)
		memcpy(chBits+i*sizeof(COLORREF),&clrWhite,sizeof(COLORREF));

	bih.biSize = sizeof(BITMAPINFOHEADER);
	bih.biWidth = 32;
	bih.biHeight = 32;
	bih.biPlanes = 1;
	bih.biBitCount = 32;
	bih.biCompression = BI_RGB;

	HBITMAP hNoIcon = ::CreateDIBitmap(
		pDC->GetSafeHdc(),
		&bih,
		CBM_INIT,
		chBits,
		(BITMAPINFO*)&bih,
		DIB_RGB_COLORS);

	AfxGetMainWnd()->ReleaseDC(pDC);

	m_nEmptyIndex = m_ilSpells.Add(CBitmap::FromHandle(hNoIcon),RGB(0,0,0));
	::DeleteObject(hNoIcon);

	if (bBlankOnly)
	{
		pCtrl->SetRange(0,1);
		pCtrl->SetPos(1);
		return(TRUE);
	}

	MSG msg;
	if (pCtrl)
	{
		pCtrl->SetRange32(0,pSpells->GetCount()-1);
		pCtrl->SetPos(0);
	}

	CResInfo *pResInfo;
	CInfBifFile *pBifFile;
	CSpellBitmapInfo *pInfo;
	int nIndex;
	int nCount = 1;
	char szSpellIcon[10];
	CString strName;
	HBITMAP hBitmap;
	BITMAP bm;
	INF_SPL spl;

	memset(szSpellIcon,0,10);
	POSITION pos = pSpells->GetHeadPosition();
	while(pos)
	{
		if (pCtrl)
		{
			pCtrl->SetPos(++nCount);

			while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
			{
				::TranslateMessage(&msg);
				::DispatchMessage(&msg);
			}
		}
		
		pResInfo = (CResInfo*)pSpells->GetNext(pos);

		pBifFile = _infKey.GetBifFile(pResInfo);
		if (!pBifFile || !pBifFile->IsValid())
			continue;

		if (pBifFile->GetData(pResInfo->wLocator,&spl) == -1)
			continue;

		memcpy(szSpellIcon,spl.chSpellIcon,8);

		// See if we already have the icon in the list.
		if (m_mapInfo.Lookup(szSpellIcon,(CObject*&)pInfo))
			continue;

		if (!GetSpellBitmap(pResInfo,spl,GetSysColor(COLOR_WINDOW),hBitmap))
			continue;

		// At least one of the icon images is the wrong size. This causes the
		// image control to get confused somehow. So now I'm checking to make
		// sure the image really is 32x32 and not adding it if isn't. Berserk
		// "SPIN117" has a goofy sized icon, in fact it's a squirrel. It has 2
//.........这里部分代码省略.........
开发者ID:devurandom,项目名称:shadowkeeper,代码行数:101,代码来源:SpellBitmaps.cpp

示例6: is_empty

/** \brief Indicates whether the list is empty
 *
 * \ingroup group__concept__shim__collection_logical__is_empty
 *
 */
inline int is_empty(CObList const& l)
{
    return 0 == l.GetCount();
}
开发者ID:JerYme,项目名称:stlsoft,代码行数:9,代码来源:lists.hpp

示例7: SetProfs

void CInfCreature::SetProfs(CObList &list)
{
	INF_AFF *pAff;

	// Start by deleting all existing profs.
	POSITION posPrev;
	POSITION pos = m_plAffects.GetHeadPosition();
	while(pos)
	{
		posPrev = pos;
		pAff = (INF_AFF*)m_plAffects.GetNext(pos);

		if (pAff->dwAffectType == AFF_TYPE_PROF)
		{
			m_infCre.dwAffectCount--;
			if (m_infCre.dwAffectCount < 0)
				m_infCre.dwAffectCount = 0;

			m_plAffects.RemoveAt(posPrev);
			delete pAff;

			// Since I really don't know how the list is ordered I'm starting the
			// loop over each time I delete one.
			pos = m_plAffects.GetHeadPosition();
		}
	}

	if (list.GetCount() < 1)
		return;

	// Add an affect structure back for each proficiency.
	CProfData *pData;
	pos = list.GetHeadPosition();
	while(pos)
	{
		pData = (CProfData*)list.GetNext(pos);

		pAff = new INF_AFF;
		memset(pAff,0,sizeof(INF_AFF));

		pAff->dwAffectType = AFF_TYPE_PROF;
		pAff->nNP2 = pData->m_chProf;

		if (m_infCre.chDualClass)
			pAff->nNP1 = MAKETRIBBLE(pData->m_nSecondClass,pData->m_nFirstClass);
		else
			pAff->nNP1 = pData->m_nFirstClass;

		pAff->dwFlags = 0x09;
		pAff->wProbability1 = 0x64;
		pAff->dwUnknown3[0] = 0xFFFFFFFF;
		pAff->dwUnknown3[1] = 0xFFFFFFFF;
		pAff->dwUnknown3[2] = 0xFFFFFFFF;
		pAff->dwUnknown3[3] = 0xFFFFFFFF;
		pAff->dwUnknown4[2] = 0xFFFFFFFF;
		pAff->dwUnknown5[1] = 0x01;

		m_plAffects.AddTail(pAff);
		m_infCre.dwAffectCount++;

		delete pData;
	}

	list.RemoveAll();
}
开发者ID:devurandom,项目名称:shadowkeeper,代码行数:65,代码来源:InfCreature.cpp

示例8: main


//.........这里部分代码省略.........
	l4.push_front(0.234);
	lPrint(l4);
	cout << '\n';
	LPrint<double>(l4);
	cout << endl;

	double_list l5;
	l5.assign(l4.begin(), l4.end());
	lPrint(l5);

	cout << endl;
	double_list::iterator iter;
	iter = l5.begin();
	l5.insert(iter, 65.5434);
	lPrint(l5);

	cout << endl;
	l5.erase(iter);
	lPrint(l5);
	l5.remove(65.5434);
	cout << endl;
	lPrint(l5);

	cout << endl;
	l5.remove_if(is_greater_ten);
	lPrint(l5);

	cout << "\nSorting\n";

	l4.sort();
	l4.sort(less<double>());
	lPrint(l4);
	cout << endl;
	l4.sort(greater);
	lPrint(l4);

	cout << "\nIs list empty? " << ((l4.empty()) ? "Yes" : "No") << endl;

	l4.clear();

	cout << "Is list empty? " << ((l4.empty()) ? "Yes" : "No") << endl;

	std::list<Event<>*> myList;
	myList.push_back(new Event<>("Тест 1", "Москва", 0, EVENT_TYPE_CONFERENCE));
	myList.push_back(new Event<>("Тест 2", "Москва", 0, EVENT_TYPE_CONFERENCE));

	myList.reverse();

	for (auto i = myList.begin(); i != myList.end(); ++i) {
		cout << **i << endl;
	}

	myList.sort(comp);
	myList.remove_if(is_test);
	myList.reverse();
	myList.insert(myList.begin(), new Event<>("Тест 3", "Москва", 0, EVENT_TYPE_CONFERENCE));
	myList.pop_front();
	myList.erase(myList.begin());
	myList.push_back(new Event<>("Тест 4", "Москва", 0, EVENT_TYPE_CONFERENCE));
	myList.clear();

	cout << "Is list empty? " << ((myList.empty()) ? "Yes" : "No") << endl;

	CObList list;
	list.AddTail(new Event<>("Тест 1", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.AddTail(new Event<>("Тест 2", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.AddHead(new Event<>("Тест 3", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.InsertAfter(list.GetHeadPosition(), new Event<>("Тест 4", "Москва", 0, EVENT_TYPE_CONFERENCE));
	list.InsertBefore(list.GetTailPosition(), new Event<>("Тест 5", "Москва", 0, EVENT_TYPE_CONFERENCE));

	POSITION pos;
	for (pos = list.GetHeadPosition(); pos != NULL;)
	{
		cout << *((Event<>*) list.GetNext(pos)) << endl << endl;
	}

	for (pos = list.GetTailPosition(); pos != NULL;)
	{
		cout << *((Event<>*) list.GetPrev(pos)) << endl << endl;
	}

	list.RemoveHead();
	list.RemoveTail();

	cout << "Elements count: " << list.GetCount() << endl;

	cout << "Is list empty? " << ((list.IsEmpty()) ? "Yes" : "No") << endl;

	Events* evts = new Events();
	evts->Add(new Event<>("Тест 1", "Москва", 0, EVENT_TYPE_CONFERENCE));
	evts->Add(new Event<>("Тест 2", "Москва", 0, EVENT_TYPE_CONFERENCE));
	evts->Add(new Event<>("Тест 3", "Москва", 0, EVENT_TYPE_CONFERENCE));
	evts->AddToEnd(new Event<>("Тест 4", "Москва", 0, EVENT_TYPE_CONFERENCE));
	evts->Add(new Event<>("Тест 5", "Москва", 0, EVENT_TYPE_CONFERENCE));

	cout << *evts << endl;

	system("pause");
	return 0;
}
开发者ID:lukaville,项目名称:bmstu-lb-2014,代码行数:101,代码来源:lab8.cpp


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