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


C++ BList类代码示例

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


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

示例1: while

void
BOutlineListView::_CullInvisibleItems(BList& list)
{
	int32 index = 0;
	while (index < list.CountItems()) {
		if (reinterpret_cast<BListItem*>(list.ItemAt(index))->IsItemVisible())
			++index;
		else
			list.RemoveItem(index);
	}
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2:

// RemoveSelected
void
DragSortableListView::RemoveSelected()
{
	BList indices;
	GetSelectedItems(indices);

	DeselectAll();

	if (indices.CountItems() > 0)
		RemoveItemList(indices);
}
开发者ID:DonCN,项目名称:haiku,代码行数:12,代码来源:ListViews.cpp

示例3: while

void
NotifyList::UpdateList(BObjectList<NotifyListItem> *newList)
{
  while (CountItems() > 0)
    delete RemoveItem ((int32)0);
  BList updateList;
  // make private copy of list items otherwise things go bad
  for (int32 i = 0; i < newList->CountItems(); i++)
    updateList.AddItem (new NotifyListItem (*newList->ItemAt(i)));
  AddList(&updateList);
}
开发者ID:xray7224,项目名称:Vision,代码行数:11,代码来源:NotifyList.cpp

示例4: RemoveFrontTest

void RemoveFrontTest() {
  cout << "BList::remove_front" << endl;
  BList<int> hundred;
  GenerateBack(hundred, 0, 100);

  for (int i = 0; i < 100; ++i) {
    assert(hundred.size() == 100-i);
    assert(hundred.front() == i);
    assert(hundred.back() == 99);
    hundred.remove_front();
  }
}
开发者ID:tphan2650,项目名称:Project-2,代码行数:12,代码来源:test_main.cpp

示例5: BList

TPolygon::TPolygon( TPolygon *polygon )
{
	m_PointList = new BList();
	
	BList *ptList = polygon->GetPointList();
	
	//	Copy data over
	for (int32 index = 0; index < ptList->CountItems(); index++)
	{
		m_PointList->AddItem( ptList->ItemAt(index) );
	}
}
开发者ID:ModeenF,项目名称:UltraDV,代码行数:12,代码来源:TPolygon.cpp

示例6: BList

void RemoveAttribute::DoRemoveAttribute(PDocument *doc, BMessage *node, BMessage *valueContainer,BMessage *undoMessage)
{
	node->PrintToStream();
	valueContainer->PrintToStream();
	undoMessage->PrintToStream();
	status_t	err				= B_OK;
	int32 		i				= 0;
	int32		j				= 0;
	BList		*subGroupList	= new BList();
	BMessage	*subGroup		= NULL;
	BMessage	*tmpSubGroup	= new BMessage();
	BList		*changed		= doc->GetChangedNodes();
	//do 
	char		*name			= NULL;
	char		*tmpName		= NULL;
	char		*subGroupName	= NULL;
	type_code	type			= B_ANY_TYPE;
	void*		oldValue		= NULL;
	int32		index			= 0;
	int32		count			= 0;
	ssize_t 	size			= 0;
	err = valueContainer->FindString("name",(const char**)&name);
	err = err | valueContainer->FindInt32("index",(int32 *)&index);
	subGroup = node;
	subGroupList->AddItem(subGroup);
	while (valueContainer->FindString("subgroup",i,(const char**)&subGroupName) == B_OK)
	{	
		subGroup->FindMessage(subGroupName,tmpSubGroup);
		subGroupList->AddItem(tmpSubGroup);
		subGroup	= tmpSubGroup;
		tmpSubGroup	= new BMessage();
		i++;
	}
	delete tmpSubGroup;
#ifdef B_ZETA_VERSION_1_0_0
	while ((subGroup->GetInfo(B_ANY_TYPE, j, (const char **)&tmpName, &type, &count) == B_OK) && ((count-1) != index))
#else
	while((subGroup->GetInfo(B_ANY_TYPE, j, (char**)&tmpName, &type, &count) == B_OK) && ((count-1) != index))
#endif
		j++;
	subGroup->FindData(name,type,count-1,(const void **)&oldValue,&size);

	undoMessage->AddData("deletedAttribut",type,oldValue,size);
	undoMessage->AddString("deletedName",name);
	undoMessage->AddInt32("deletedType",type);
	subGroup->RemoveData(name,index);
	for (i=subGroupList->CountItems()-1;i>0;i--)
	{
		tmpSubGroup = (BMessage *)subGroupList->ItemAt(i-1);
		valueContainer->FindString("subgroup",i-1,(const char**)&subGroupName);
		if (tmpSubGroup)
			tmpSubGroup->ReplaceMessage(subGroupName,(BMessage *)subGroupList->ItemAt(i));
		delete subGroupList->RemoveItem(i);
	}
	changed->AddItem(node);
	
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:57,代码来源:RemoveAttribute.cpp

示例7: SaveAlert

bool TCueSheetWindow::MyQuitRequested()
{
	bool retVal = true;
	bool quit       = false;

	// Ask user to save document
	if (fCueSheetView->IsDirty()) {
		long userVal = SaveAlert();

		// Check user response
		switch( userVal)
		{
		// User does not want to save
		case 0:
			fCueSheetView->SetDirty(false);
			retVal = true;
			break;

		// User decided not to quit
		case 1:
			retVal = false;
			break;

		// User wants to save
		case 2:
			retVal = true;
			break;

		default:
			retVal = true;
		}
	}

	// Remove ourself from list	if window is closing
	if (retVal) {
		BList* theList = static_cast<MuseumApp*>(be_app)->GetCueSheetList();
		if (theList) {
			theList->RemoveItem(this);

			// If this is the last cue sheet open, tell application to quit
			if (theList->CountItems() == 0)
				be_app->PostMessage(B_QUIT_REQUESTED);
		}
	}

	// Now tell app to fix Windows menu to reflect new state
	if (quit == false)
		be_app->PostMessage(FIX_WINDOWS_MENU_MSG);

	// Return user response to application
	return retVal;
}
开发者ID:Barrett17,项目名称:UltraDV,代码行数:52,代码来源:TCueSheetWindow.cpp

示例8: CountItems

// RemoveAll
void
DragSortableListView::RemoveAll()
{
	BList indices;
	int32 count = CountItems();
	for (int32 i = 0; i < count; i++) {
		if (!indices.AddItem((void*)(addr_t)i))
			break;
	}

	if (indices.CountItems() > 0)
		RemoveItemList(indices);
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例9:

bool
PairsView::_HasBitmap(BList& bitmaps, BBitmap* bitmap)
{
	// TODO: if this takes too long, we could build a hash value for each
	// bitmap in a separate list
	for (int32 i = bitmaps.CountItems(); i-- > 0;) {
		BBitmap* item = (BBitmap*)bitmaps.ItemAtFast(i);
		if (!memcmp(item->Bits(), bitmap->Bits(), item->BitsLength()))
			return true;
	}

	return false;
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:13,代码来源:PairsView.cpp

示例10: ShiftDragGroup

void CLVColumnLabelView::ShiftDragGroup(int32 NewPos)
//Shift the drag group into a new position
{
	int32 NumberOfGroups = fDragGroups.CountItems();
	int32 GroupCounter;
	CLVDragGroup* ThisGroup;
	int32 ColumnCounter;
	BList NewDisplayList;

	//Copy the groups up to the new position
	for(GroupCounter = 0; GroupCounter < NewPos; GroupCounter++)
	{
		if(GroupCounter != fDragGroup)
		{
			ThisGroup = (CLVDragGroup*)fDragGroups.ItemAt(GroupCounter);
			for(ColumnCounter = ThisGroup->GroupStartDispListIndex; ColumnCounter <=
				ThisGroup->GroupStopDispListIndex; ColumnCounter++)
			NewDisplayList.AddItem(fDisplayList->ItemAt(ColumnCounter));
		}
	}
	//Copy the group into the new position
	ThisGroup = (CLVDragGroup*)fDragGroups.ItemAt(fDragGroup);
	for(ColumnCounter = ThisGroup->GroupStartDispListIndex; ColumnCounter <=
		ThisGroup->GroupStopDispListIndex; ColumnCounter++)
	NewDisplayList.AddItem(fDisplayList->ItemAt(ColumnCounter));
	//Copy the rest of the groups, but skip the dragging group
	for(GroupCounter = NewPos; GroupCounter < NumberOfGroups; GroupCounter++)
	{
		if(GroupCounter != fDragGroup)
		{
			ThisGroup = (CLVDragGroup*)fDragGroups.ItemAt(GroupCounter);
			for(ColumnCounter = ThisGroup->GroupStartDispListIndex; ColumnCounter <=
				ThisGroup->GroupStopDispListIndex; ColumnCounter++)
			NewDisplayList.AddItem(fDisplayList->ItemAt(ColumnCounter));
		}
	}

	//Set the new order
	*fDisplayList = NewDisplayList;

	//Update columns and drag groups
	fParent->UpdateColumnSizesDataRectSizeScrollBars();
	UpdateDragGroups();
	SetSnapMinMax();

	//Inform the program that the display order changed
	int32* NewOrder = new int32[fParent->CountColumns()];
	fParent->GetDisplayOrder(NewOrder);
	fParent->DisplayOrderChanged(NewOrder);
	delete[] NewOrder;
}
开发者ID:HaikuArchives,项目名称:SantasGiftBag,代码行数:51,代码来源:CLVColumnLabelView.cpp

示例11: max

// _GetBuffersFor
//
// Adds pointers to all buffers to the list that contain data of the
// supplied interval.
void
MediaTrackAudioSupplier::_GetBuffersFor(BList& buffers, int64 position,
								 int64 frames) const
{
	buffers.MakeEmpty();
	for (int32 i = 0; Buffer* buffer = _BufferAt(i); i++) {
		// Calculate the intersecting interval and add the buffer if it is
		// not empty.
		int32 startFrame = max(position, buffer->offset);
		int32 endFrame = min(position + frames, buffer->offset + buffer->size);
		if (startFrame < endFrame)
			buffers.AddItem(buffer);
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:18,代码来源:MediaTrackAudioSupplier.cpp

示例12: BApplication

TBarApp::TBarApp()
	:	BApplication(kDeskbarSignature),
		fSettingsFile(NULL),
		fPreferencesWindow(NULL)
{
	InitSettings();
	InitIconPreloader();

	fBarWindow = new TBarWindow();
	fBarView = fBarWindow->BarView();

	be_roster->StartWatching(this);

	gLocalizedNamePreferred
		= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();

	sBarTeamInfoList.MakeEmpty();

	BList teamList;
	int32 numTeams;
	be_roster->GetAppList(&teamList);
	numTeams = teamList.CountItems();
	for (int32 i = 0; i < numTeams; i++) {
		app_info appInfo;
		team_id tID = (team_id)teamList.ItemAt(i);
		if (be_roster->GetRunningAppInfo(tID, &appInfo) == B_OK) {
			AddTeam(appInfo.team, appInfo.flags, appInfo.signature,
				&appInfo.ref);
		}
	}

	sSubscribers.MakeEmpty();

	fSwitcherMessenger = BMessenger(new TSwitchManager(fSettings.switcherLoc));

	fBarWindow->Show();

	// Call UpdatePlacement() after the window is shown because expanded apps
	// need to resize the window.
	if (fBarWindow->Lock()) {
		fBarView->UpdatePlacement();
		fBarWindow->Unlock();
	}

	// this messenger now targets the barview instead of the
	// statusview so that all additions to the tray
	// follow the same path
	fStatusViewMessenger = BMessenger(fBarWindow->FindView("BarView"));
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:49,代码来源:BarApp.cpp

示例13: new

bool
StyleListView::HandleDropMessage(const BMessage* message, int32 dropIndex)
{
	// Let SimpleListView handle drag-sorting (when drag came from ourself)
	if (SimpleListView::HandleDropMessage(message, dropIndex))
		return true;

	if (fCommandStack == NULL || fStyleContainer == NULL)
		return false;

	// Drag may have come from another instance, like in another window.
	// Reconstruct the Styles from the archive and add them at the drop
	// index.
	int index = 0;
	BList styles;
	while (true) {
		BMessage archive;
		if (message->FindMessage("style archive", index, &archive) != B_OK)
			break;
		Style* style = new(std::nothrow) Style(&archive);
		if (style == NULL)
			break;
		
		if (!styles.AddItem(style)) {
			delete style;
			break;
		}

		index++;
	}

	int32 count = styles.CountItems();
	if (count == 0)
		return false;

	AddStylesCommand* command = new(std::nothrow) AddStylesCommand(
		fStyleContainer, (Style**)styles.Items(), count, dropIndex);

	if (command == NULL) {
		for (int32 i = 0; i < count; i++)
			delete (Style*)styles.ItemAtFast(i);
		return false;
	}

	fCommandStack->Perform(command);

	return true;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:48,代码来源:StyleListView.cpp

示例14: new

bool
PathListView::HandleDropMessage(const BMessage* message, int32 dropIndex)
{
	// Let SimpleListView handle drag-sorting (when drag came from ourself)
	if (SimpleListView::HandleDropMessage(message, dropIndex))
		return true;

	if (fCommandStack == NULL || fPathContainer == NULL)
		return false;

	// Drag may have come from another instance, like in another window.
	// Reconstruct the Styles from the archive and add them at the drop
	// index.
	int index = 0;
	BList paths;
	while (true) {
		BMessage archive;
		if (message->FindMessage("path archive", index, &archive) != B_OK)
			break;

		VectorPath* path = new(std::nothrow) VectorPath(&archive);
		if (path == NULL)
			break;
		
		if (!paths.AddItem(path)) {
			delete path;
			break;
		}

		index++;
	}

	int32 count = paths.CountItems();
	if (count == 0)
		return false;

	AddPathsCommand* command = new(nothrow) AddPathsCommand(fPathContainer,
		(VectorPath**)paths.Items(), count, true, dropIndex);
	if (command == NULL) {
		for (int32 i = 0; i < count; i++)
			delete (VectorPath*)paths.ItemAtFast(i);
		return false;
	}

	fCommandStack->Perform(command);

	return true;
}
开发者ID:DonCN,项目名称:haiku,代码行数:48,代码来源:PathListView.cpp

示例15: switch

// MessageReceived
void
ShapeListView::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case MSG_REMOVE:
			RemoveSelected();
			break;
		case MSG_DUPLICATE: {
			int32 count = CountSelectedItems();
			int32 index = 0;
			BList items;
			for (int32 i = 0; i < count; i++) {
				index = CurrentSelection(i);
				BListItem* item = ItemAt(index);
				if (item)
					items.AddItem((void*)item);
			}
			CopyItems(items, index + 1);
			break;
		}
		case MSG_RESET_TRANSFORMATION: {
			BList shapes;
			_GetSelectedShapes(shapes);
			int32 count = shapes.CountItems();
			if (count < 0)
				break;

			Transformable* transformables[count];
			for (int32 i = 0; i < count; i++) {
				Shape* shape = (Shape*)shapes.ItemAtFast(i);
				transformables[i] = shape;
			}

			ResetTransformationCommand* command = 
				new ResetTransformationCommand(transformables, count);

			fCommandStack->Perform(command);
			break;
		}
		case MSG_FREEZE_TRANSFORMATION: {
			BList shapes;
			_GetSelectedShapes(shapes);
			int32 count = shapes.CountItems();
			if (count < 0)
				break;

			FreezeTransformationCommand* command = 
				new FreezeTransformationCommand((Shape**)shapes.Items(),
					count);

			fCommandStack->Perform(command);
			break;
		}
		default:
			SimpleListView::MessageReceived(message);
			break;
	}
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:59,代码来源:ShapeListView.cpp


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