本文整理汇总了C++中BList::AddList方法的典型用法代码示例。如果您正苦于以下问题:C++ BList::AddList方法的具体用法?C++ BList::AddList怎么用?C++ BList::AddList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BList
的用法示例。
在下文中一共展示了BList::AddList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
_DoSwap(BList& list, int32 firstIndex, int32 secondIndex, BList* firstItems,
BList* secondItems)
{
BListItem* item = (BListItem*)list.ItemAt(firstIndex);
list.SwapItems(firstIndex, secondIndex);
list.RemoveItems(secondIndex + 1, secondItems->CountItems());
list.RemoveItems(firstIndex + 1, firstItems->CountItems());
list.AddList(secondItems, firstIndex + 1);
int32 newIndex = list.IndexOf(item);
if (newIndex + 1 < list.CountItems())
list.AddList(firstItems, newIndex + 1);
else
list.AddList(firstItems);
}
示例2: WriteScores
void Hall::WriteScores(void)
{
BFile F;
int i;
struct score s;
entry_ref er;
BList *L;
L = new BList(NUMBER);
L->AddList(List1);
L->AddList(List2);
L->AddList(List3);
L->AddList(List4);
L->AddList(List5);
//fprintf(stderr, "WriteScores called\n");
if (_changed && REGISTERED)
{
//fprintf(stderr, "Setting F\n");
//get_ref_for_path("/boot/home/config/settings/BShisen.Scores", &er);
if (F.SetTo(path->Path(),//&er,
B_WRITE_ONLY | B_ERASE_FILE | B_CREATE_FILE) == B_NO_ERROR)
{
for ( i = 0; i < L->CountItems(); i++)
{
HSList *h;
memset(&s, 0, sizeof(struct score));
h = (HSList *)L->ItemAt(i);
s.gameID = h->GetGameID();
s.gameTime = h->GetGameTime();
s.gameTiles = h->GetNumberTiles();
s.absTime = h->GetTimeOfGame();
memcpy(s.Name, h->GetName(),
strlen(h->GetName()) + 1);
F.Write(&s, sizeof (struct score));
}
_changed = false;
}
//else fprintf(stderr, "Couldn't write to high scores file\n");
}
//fprintf(stderr, "WriteScores exiting\n");
delete L;
}
示例3: BList
void
HTGTimeLineView::addUnhandledTweets()
{
if(unhandledList->IsEmpty())
return;
BList *newList = new BList();
newList->AddList(unhandledList);
unhandledList->MakeEmpty();
HTGTweetItem *currentItem;
while(!listView->IsEmpty()) {
currentItem = (HTGTweetItem *)listView->FirstItem();
listView->RemoveItem(currentItem);
if(newList->CountItems() < 30) {//Only allow 30 tweets to be displayed at once... for now.
newList->AddItem(currentItem);
currentItem->ClearView(); //No need to keep everything in memory
//if the view is at the bottom of the scrollbar (invisible)
}
else
delete currentItem;
}
/*Sort tweets by date*/
newList->SortItems(*HTGTweetItem::sortByDateFunc);
/*Add our new list*/
listView->AddList(newList);
/*Clean up*/
unhandledList->MakeEmpty();
}
示例4:
//! newExtensionsList contains all the entries (char*) which are to be added.
status_t
merge_extensions(BMimeType& type, const BList& newExtensionsList,
const char* removeExtension)
{
BMessage extensions;
status_t status = type.GetFileExtensions(&extensions);
if (status < B_OK)
return status;
// replace the entry, and remove any equivalent entries
BList mergedList;
mergedList.AddList(&newExtensionsList);
int32 originalCount = mergedList.CountItems();
const char* extension;
for (int32 i = 0; extensions.FindString("extensions", i,
&extension) == B_OK; i++) {
for (int32 j = originalCount; j-- > 0;) {
if (!strcmp((const char*)mergedList.ItemAt(j), extension)) {
// Do not add this old item again, since it's already
// there.
mergedList.RemoveItem(j);
originalCount--;
}
}
// The item will be added behind "originalCount", so we cannot
// remove it accidentally in the next iterations, it's is added
// for good.
if (removeExtension == NULL || strcmp(removeExtension, extension))
mergedList.AddItem((void *)extension);
}
mergedList.SortItems(compare_extensions);
// Copy them to a new message (their memory is still part of the
// original BMessage)
BMessage newExtensions;
for (int32 i = 0; i < mergedList.CountItems(); i++) {
newExtensions.AddString("extensions",
(const char*)mergedList.ItemAt(i));
}
return type.SetFileExtensions(&newExtensions);
}