您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CountItems函数代码示例

51自学网 2021-06-01 20:13:59
  C++
这篇教程C++ CountItems函数代码示例写得很实用,希望能帮到您。

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

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

示例1: CountItems

int32BListView::_CalcFirstSelected(int32 after){    if (after >= CountItems())        return -1;    int32 count = CountItems();    for (int32 i = after; i < count; i++) {        if (ItemAt(i)->IsSelected())            return i;    }    return -1;}
开发者ID:mmuman,项目名称:haiku,代码行数:14,


示例2: Items

	inline bool operator ==(const Selection& other)		{			if (other.CountItems() == CountItems()) {				int32* items = Items();				int32* otherItems = other.Items();				for (int32 i = 0; i < CountItems(); i++) {					if (items[i] != otherItems[i])						return false;					items++;					otherItems++;				}				return true;			} else				return false;		}
开发者ID:mariuz,项目名称:haiku,代码行数:15,


示例3: B_BENDIAN_TO_HOST_INT32

//------------------------------------------------------------------------------void BMessageField::PrintToStream(const char* name) const{	int32 type = B_BENDIAN_TO_HOST_INT32(Type());	printf("    entry %14s, type='%.4s', c=%2ld, ",		   name, (char*)&type, CountItems());	for (int32 i = 0; i < CountItems(); ++i)	{		if (i)		{			printf("                                            ");		}		PrintDataItem(i);	}}
开发者ID:BackupTheBerlios,项目名称:nemo,代码行数:16,


示例4: Entered

	virtual void Entered()	{		_DeleteItems();		if (fDirectory != NULL) {			void* cookie;			if (fDirectory->Open(&cookie, O_RDONLY) == B_OK) {				Node* node;				while (fDirectory->GetNextNode(cookie, &node) == B_OK) {					BlacklistMenuItem* item = _CreateItem(node);					node->Release();					if (item == NULL)						break;					AddItem(item);					item->UpdateBlacklisted();				}				fDirectory->Close(cookie);			}			SortItems(&BlacklistMenuItem::Less);		}		if (CountItems() > 0)			AddSeparatorItem();		AddItem(new(nothrow) MenuItem("Return to parent directory"));	}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:28,


示例5: PushState

void NetListView::FrameResized(float width, float height){	BListView::FrameResized(width, height);	//Ensure the bevel on the right is drawn properly	if(width < oldWidth)		oldWidth = width;	PushState();	BRect invalRect(oldWidth, 0, oldWidth, height);	ConvertFromParent(&invalRect);	BRegion lineRegion(invalRect);	ConstrainClippingRegion(&lineRegion);	Draw(invalRect);	oldWidth = width;	PopState();		//Do word wrapping	BFont curFont;	GetFont(&curFont);	float itemWidth = Bounds().Width();	float wrapWidth = (itemWidth - 6)/curFont.Size();	for(int itemNum = 0; itemNum < CountItems(); itemNum++)	{		NetListItem* item = (NetListItem*)(Items()[itemNum]);		item->SetWidth(itemWidth);		item->CalcWordWrap(wrapWidth);	}	//DoForEach(UpdateItem, (void*)this);	Invalidate();		BListView::FrameResized(width, height);}
开发者ID:thinkpractice,项目名称:bme,代码行数:31,


示例6: printf

void DraggableListView::MessageReceived(BMessage *message) {	if (message->what != B_PULSE) {		printf("DraggableListView:/n");		message->PrintToStream();		printf("/n");	}	switch(message->what) {		case SM_DRAG_FILTER: {			if (accepts_drags) {				int32 item_count;				type_code type_found;				message->GetInfo("filter_name", &type_found, &item_count);				int32 current_item = 0;				char* text = NULL;				int32 filter_id = 0;				message->FindString("filter_name", current_item, &text);				// Do add-filter stuff				BMessage app_msg(SM_ADD_FILTER);				app_msg.AddString("addon_name", text);				app_msg.AddInt32("position", CountItems());				BMessage reply;				be_app_messenger.SendMessage(&app_msg, &reply);				reply.FindInt32("filter_id", &filter_id);				BStringItem *newItem = new FilterItem(text, filter_id);				AddItem(newItem);			}			break;		}		default: {			BListView::MessageReceived(message);			break;		}	}}
开发者ID:HaikuArchives,项目名称:SoundMangler,代码行数:34,


示例7: RemoveItem

voidNetworkMenu::AttachedToWindow (void){	if (CountItems())	{		BMenuItem *item (NULL);		while ((item = RemoveItem((int32)0)) != NULL)			delete item;	}	BMessage msg;	BMessage *invoke (NULL);	for (int32 i = 0; (msg = vision_app->GetNetwork (i)), !msg.HasBool ("error"); i++)	{		const char *name = msg.FindString ("name");		invoke = new BMessage (fMsgConst);		invoke->AddString ("network", name);		BMenuItem *item (new BMenuItem(name, invoke));		AddItem (item);		if (!vision_app->CheckNetworkValid (name))			item->SetEnabled (false);	}	SetTargetForItems (fTarget.Target(NULL));	BMenu::AttachedToWindow();}
开发者ID:jessicah,项目名称:Vision,代码行数:25,


示例8:

IFWL_ListItem* CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget,                                                     int32_t nIndex) {  if (nIndex < 0 || nIndex >= CountItems(pWidget))    return nullptr;  return m_ItemArray[nIndex].get();}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,


示例9: cast_as

/*********************************************************** * DeleteItem ***********************************************************/voidHListView::DeleteItem(int32 index) {	HListItem* item = cast_as(RemoveItem(index), HListItem);	fPointerList.RemoveItem(item);	delete item;	HApp* app = cast_as(be_app, HApp);	bool queue;	int32 max_transfer;	app->Prefs()->GetData("queue", &queue);	app->Prefs()->GetData("max_transfer", &max_transfer);	if (queue) {		int32 num_task = max_transfer - CountDownloadingItems();		if (num_task > 0) {			int32 count = CountItems();			HListItem** items = (HListItem**)Items();			for (int32 i = 0; i < count; i++) {				item = items[i];				if (!item->IsStarted() && item->State() != T_FINISHED && item->State() != T_NOTFOUND) {					item->Start();					num_task--;				}				if (num_task <= 0)					break;			}		}	}}
开发者ID:kallisti5,项目名称:beget,代码行数:33,


示例10: CountItems

void ArpOutlineListView::ComputeDimens(ArpDimens& cur_dimens){	float min_w=0, min_h=0;	float pref_w=0, pref_h=0;		int32 num = CountItems();	int32 max_num = 4;	for( int32 i=0; i<num; i++ ) {		BListItem* item = ItemAt(i);		if( item ) {			item->Update(this,BasicFont());			float w = item->Width();			float h = item->Height();			min_h = max(min_h,h);			pref_w = max(pref_w,w);			if( max_num > 0 ) pref_h += h;			max_num--;		}	}	pref_h+=2;	float fw = BasicFont()->StringWidth("WWWW");	font_height fhs;	BasicFont()->GetHeight(&fhs);	float fh = fhs.ascent+fhs.descent+fhs.leading;	min_w = max(min_w,fw);	min_h = max(min_h,fh);	pref_w = max(pref_w,min_w);	pref_h = max(pref_h,min_h);		cur_dimens.X().SetTo(0, min_w, pref_w, ArpAnySize, 0);	cur_dimens.Y().SetTo(0, min_h, pref_h, ArpAnySize, 0);}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:32,


示例11: CountItems

boolBrowsingHistory::_AddItem(const BrowsingHistoryItem& item, bool internal){	int32 count = CountItems();	int32 insertionIndex = count;	for (int32 i = 0; i < count; i++) {		BrowsingHistoryItem* existingItem			= reinterpret_cast<BrowsingHistoryItem*>(			fHistoryItems.ItemAtFast(i));		if (item.URL() == existingItem->URL()) {			if (!internal) {				existingItem->Invoked();				_SaveSettings();			}			return true;		}		if (item < *existingItem)			insertionIndex = i;	}	BrowsingHistoryItem* newItem = new(std::nothrow) BrowsingHistoryItem(item);	if (!newItem || !fHistoryItems.AddItem(newItem, insertionIndex)) {		delete newItem;		return false;	}	if (!internal) {		newItem->Invoked();		_SaveSettings();	}	return true;}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:32,


示例12: max_c

voidBListView::_RescanSelection(int32 from, int32 to){	if (from > to) {		int32 tmp = from;		from = to;		to = tmp;	}	from = max_c(0, from);	to = min_c(to, CountItems() - 1);	if (fAnchorIndex != -1) {		if (fAnchorIndex == from)			fAnchorIndex = to;		else if (fAnchorIndex == to)			fAnchorIndex = from;	}	for (int32 i = from; i <= to; i++) {		if (ItemAt(i)->IsSelected()) {			fFirstSelected = i;			break;		}	}	if (fFirstSelected > from)		from = fFirstSelected;	fLastSelected = fFirstSelected;	for (int32 i = from; i <= to; i++) {		if (ItemAt(i)->IsSelected())			fLastSelected = i;	}}
开发者ID:RAZVOR,项目名称:haiku,代码行数:35,


示例13: AddListPrivate

bool ColumnListView::AddList(BList* newItems){	if(fHierarchical)		return AddListPrivate(newItems,fFullItemList.CountItems());	else		return AddListPrivate(newItems,CountItems());}
开发者ID:mariuz,项目名称:haiku,代码行数:7,


示例14: AddItemPrivate

bool ColumnListView::AddItem(CLVListItem* item){	if(fHierarchical)		return AddItemPrivate(item,fFullItemList.CountItems());	else		return AddItemPrivate(item,CountItems());}
开发者ID:mariuz,项目名称:haiku,代码行数:7,


示例15: lock

int32 QueryMenu::QueryThread(){	BAutolock lock(fQueryLock);	if (!lock.IsLocked())		return B_ERROR;	// Begin resolving query	fCancelQuery = false;	fQuery->Fetch();	// Build Menu	entry_ref ref;	node_ref node;	while (fQuery->GetNextRef(&ref) == B_OK && !fCancelQuery)	{		BEntry entry(&ref);		entry.GetNodeRef(&node);		EntryCreated(ref, node.node);	}	// Remove the group separator if there are no groups or no items without groups	BMenuItem *item;	if (dynamic_cast<BSeparatorItem *>(item = ItemAt(0)) != NULL)		RemoveItem(item);	else if (dynamic_cast<BSeparatorItem *>(item = ItemAt(CountItems() - 1)) != NULL)		RemoveItem(item);	return B_OK;}
开发者ID:HaikuArchives,项目名称:BeMailDaemon,代码行数:30,


示例16: CountItems

BPose*PoseList::DeepFindPose(const node_ref* node, int32* resultingIndex) const{	int32 count = CountItems();	for (int32 index = 0; index < count; index++) {		BPose* pose = ItemAt(index);		Model* model = pose->TargetModel();		if (*model->NodeRef() == *node) {			if (resultingIndex != NULL)				*resultingIndex = index;			return pose;		}		// if model is a symlink, try matching node with the target		// of the link		if (model->IsSymLink()) {			model = model->LinkTo();			if (model != NULL && *model->NodeRef() == *node) {				if (resultingIndex != NULL)					*resultingIndex = index;				return pose;			}		}	}	return NULL;}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:28,


示例17: OnUpdateActionState

void DesktopOpDropDown::OnUpdateActionState(){	if (GetAction())		return OpDropDown::OnUpdateActionState();	if (m_item_actions.GetCount() == 0)		return;	BOOL enabled = FALSE;		for (int i = 0; i < CountItems(); i++)	{		OpInputAction* action = NULL;		OpStatus::Ignore(m_item_actions.GetData(i, &action));				if (!action)			continue;		INT32 state = g_input_manager->GetActionState(action, GetParentInputContext());		//Update the selection to match the action state, but not when the user is		//selecting a new item in the dropdown window		if (m_dropdown_window == NULL && state & OpInputAction::STATE_SELECTED)		{			SelectItem(i, TRUE);		}		if (!(state & OpInputAction::STATE_DISABLED) || state & OpInputAction::STATE_ENABLED || IsCustomizing())			enabled = TRUE;	}	SetEnabled(enabled);}
开发者ID:prestocore,项目名称:browser,代码行数:32,


示例18: now

voidClipView::AdjustColors(){	bool fade;	int32 delay;	int32 step;	float maxlevel;	bool pause;	ClipdingerSettings* settings = my_app->Settings();	if (settings->Lock()) {		fade = settings->GetFade();		step = settings->GetFadeStep();		delay = settings->GetFadeDelay() * kMinuteUnits;		maxlevel = 1.0 + 0.025 * settings->GetFadeMaxLevel();		pause = settings->GetFadePause();		settings->Unlock();	}	if (pause)		return;	bigtime_t now(real_time_clock());	for (int32 i = 0; i < CountItems(); i++) {		ClipItem* sItem = dynamic_cast<ClipItem *> (ItemAt(i));		if (fade) {			bigtime_t minutes = (now - sItem->GetTimeSince()) / 60;			float level = B_NO_TINT				+ (maxlevel / step * ((float)minutes / delay) / kMinuteUnits);			sItem->SetColor(tint_color(ui_color(B_LIST_BACKGROUND_COLOR),			(level < maxlevel) ? level : maxlevel));  // limit to maxlevel		} else			sItem->SetColor(ui_color(B_LIST_BACKGROUND_COLOR));	}}
开发者ID:humdingerb,项目名称:clipdinger,代码行数:34,


示例19: CountItems

// _SetDropIndexvoidDragSortableListView::_SetDropIndex(int32 index){	if (fDropIndex != index) {		fDropIndex = index;		if (fDropIndex >= 0) {			int32 count = CountItems();			if (fDropIndex == count) {				BRect r;				if (ItemAt(count - 1)) {					r = ItemFrame(count - 1);					r.top = r.bottom;					r.bottom = r.top + 1.0;				} else {					r = Bounds();					r.bottom--;	// compensate for scrollbars moved slightly out of window				}				_SetDropAnticipationRect(r);			} else {				BRect r = ItemFrame(fDropIndex);				r.top--;				r.bottom = r.top + 1.0;				_SetDropAnticipationRect(r);			}		}	}}
开发者ID:DonCN,项目名称:haiku,代码行数:28,


示例20: bounds

voidTExpandoMenuBar::DrawBackground(BRect){	BRect bounds(Bounds());	rgb_color menuColor = ui_color(B_MENU_BACKGROUND_COLOR);	rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);	rgb_color dark = tint_color(menuColor, B_DARKEN_2_TINT);	rgb_color vlight = tint_color(menuColor, B_LIGHTEN_2_TINT);	int32 last = CountItems() - 1;	float start;	if (last >= 0) 		start = ItemAt(last)->Frame().right + 1;	else 		start = 0;		if (!fVertical) {		SetHighColor(vlight);		StrokeLine(BPoint(start, bounds.top+1), bounds.RightTop() + BPoint(0,1));		StrokeLine(BPoint(start, bounds.top+1), BPoint(start, bounds.bottom));		SetHighColor(hilite);		StrokeLine(BPoint(start+1, bounds.bottom), bounds.RightBottom());	}}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:25,


示例21: modifiers

// SetDropTargetRectvoidDragSortableListView::SetDropTargetRect(const BMessage* message, BPoint where){	if (AcceptDragMessage(message)) {		bool copy = modifiers() & B_SHIFT_KEY;		bool replaceAll = !message->HasPointer("list") && !copy;		BRect r = Bounds();		if (replaceAll) {			r.bottom--;	// compensate for scrollbar offset			_SetDropAnticipationRect(r);			fDropIndex = -1;		} else {			// offset where by half of item height			r = ItemFrame(0);			where.y += r.Height() / 2.0;				int32 index = IndexOf(where);			if (index < 0)				index = CountItems();			_SetDropIndex(index);			const uchar* cursorData = copy ? kCopyCursor : B_HAND_CURSOR;			BCursor cursor(cursorData);			SetViewCursor(&cursor, true);		}	}}
开发者ID:DonCN,项目名称:haiku,代码行数:29,


示例22: IndexOf

// DrawvoidDragSortableListView::Draw(BRect updateRect){	int32 firstIndex = IndexOf(updateRect.LeftTop());	int32 lastIndex = IndexOf(updateRect.RightBottom());	if (firstIndex >= 0) {		if (lastIndex < firstIndex)			lastIndex = CountItems() - 1;		// update rect contains items		BRect r = updateRect;		for (int32 i = firstIndex; i <= lastIndex; i++) {			r = ItemFrame(i);			DrawListItem(this, i, r);		}		updateRect.top = r.bottom + 1.0;		if (updateRect.IsValid()) {			SetLowColor(255, 255, 255, 255);			FillRect(updateRect, B_SOLID_LOW);		}	} else {		SetLowColor(255, 255, 255, 255);		FillRect(updateRect, B_SOLID_LOW);	}	// drop anticipation indication	if (fDropRect.IsValid()) {		SetHighColor(255, 0, 0, 255);		StrokeRect(fDropRect);	}/*	// focus indication	if (IsFocus()) {		SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));		StrokeRect(Bounds());	}*/}
开发者ID:DonCN,项目名称:haiku,代码行数:35,


示例23: while

boolShowImageWindow::RecentDocumentsMenu::AddDynamicItem(add_state addState){	if (addState != B_INITIAL_ADD)		return false;	while (CountItems() > 0)		delete RemoveItem(0L);	BMenuItem *item;	BMessage list, *msg;	entry_ref ref;	char name[B_FILE_NAME_LENGTH];	be_roster->GetRecentDocuments(&list, 20, NULL, kApplicationSignature);	for (int i = 0; list.FindRef("refs", i, &ref) == B_OK; i++) {		BEntry entry(&ref);		if (entry.Exists() && entry.GetName(name) == B_OK) {			msg = new BMessage(B_REFS_RECEIVED);			msg->AddRef("refs", &ref);			item = new EntryMenuItem(&ref, name, msg, 0, 0);			AddItem(item);			item->SetTarget(be_app, NULL);		}	}	return false;}
开发者ID:mmanley,项目名称:Antares,代码行数:28,


示例24: vlc_object_find

/***************************************************************************** * PlaylistView::SetPlaying *****************************************************************************/voidPlaylistView::RebuildList(){    playlist_t * p_playlist;    p_playlist = (playlist_t *) vlc_object_find( p_intf,        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );    if( !p_playlist )    {        return;    }    // remove all items    BListItem * item;    int32 count = CountItems();    while( ( item = RemoveItem( --count ) ) )        delete item;        // rebuild listview from VLC's playlist    vlc_mutex_lock( &p_playlist->object_lock );    for( int i = 0; i < p_playlist->i_size; i++ )        AddItem( new PlaylistItem( p_playlist->pp_items[i]->input.psz_name ) );    vlc_mutex_unlock( &p_playlist->object_lock );    vlc_object_release( p_playlist );}
开发者ID:forthyen,项目名称:SDesk,代码行数:29,


示例25:

voidAudioListView::RenumberTracks(){	for (int32 i = 0; i < CountItems(); i++) {		AudioListItem* item = dynamic_cast<AudioListItem *>(ItemAt(i));		item->SetTrack(i);	}}
开发者ID:HaikuArchives,项目名称:BurnItNow,代码行数:8,



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


C++ Cprintf函数代码示例
C++ CountArray函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。