本文整理汇总了C++中BObjectList::RemoveItemAt方法的典型用法代码示例。如果您正苦于以下问题:C++ BObjectList::RemoveItemAt方法的具体用法?C++ BObjectList::RemoveItemAt怎么用?C++ BObjectList::RemoveItemAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BObjectList
的用法示例。
在下文中一共展示了BObjectList::RemoveItemAt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
/*static*/ status_t
SpecificImageDebugInfo::GetFunctionsFromSymbols(
const BObjectList<SymbolInfo>& symbols,
BObjectList<FunctionDebugInfo>& functions, DebuggerInterface* interface,
const ImageInfo& imageInfo, SpecificImageDebugInfo* info)
{
// create the function infos
int32 functionsAdded = 0;
for (int32 i = 0; SymbolInfo* symbol = symbols.ItemAt(i); i++) {
if (symbol->Type() != B_SYMBOL_TYPE_TEXT)
continue;
FunctionDebugInfo* function = new(std::nothrow) BasicFunctionDebugInfo(
info, symbol->Address(), symbol->Size(), symbol->Name(),
Demangler::Demangle(symbol->Name()));
if (function == NULL || !functions.AddItem(function)) {
delete function;
int32 index = functions.CountItems() - 1;
for (; functionsAdded >= 0; functionsAdded--, index--) {
function = functions.RemoveItemAt(index);
delete function;
}
return B_NO_MEMORY;
}
functionsAdded++;
}
return B_OK;
}
示例2:
/** We share one global list for all BMediaFormats in the team - since the
* format data can change at any time, we have to update the list to ensure
* that we are working on the latest data set. The list is always sorted by
* description. The formats lock has to be held when you call this function.
*/
static status_t
update_media_formats()
{
if (!sLock.IsLocked())
return B_NOT_ALLOWED;
// We want the add-ons to register themselves with the format manager, so
// the list is up to date.
AddOnManager::GetInstance()->RegisterAddOns();
BMessage reply;
FormatManager::GetInstance()->GetFormats(sLastFormatsUpdate, reply);
// do we need an update at all?
bool needUpdate;
if (reply.FindBool("need_update", &needUpdate) < B_OK)
return B_ERROR;
if (!needUpdate)
return B_OK;
// update timestamp and check if the message is okay
type_code code;
int32 count;
if (reply.FindInt64("timestamp", &sLastFormatsUpdate) < B_OK
|| reply.GetInfo("formats", &code, &count) < B_OK)
return B_ERROR;
// overwrite already existing formats
int32 index = 0;
for (; index < sFormats.CountItems() && index < count; index++) {
meta_format* item = sFormats.ItemAt(index);
const meta_format* newItem;
ssize_t size;
if (reply.FindData("formats", MEDIA_META_FORMAT_TYPE, index,
(const void**)&newItem, &size) == B_OK)
*item = *newItem;
}
// allocate additional formats
for (; index < count; index++) {
const meta_format* newItem;
ssize_t size;
if (reply.FindData("formats", MEDIA_META_FORMAT_TYPE, index,
(const void**)&newItem, &size) == B_OK)
sFormats.AddItem(new meta_format(*newItem));
}
// remove no longer used formats
while (count < sFormats.CountItems())
delete sFormats.RemoveItemAt(count);
return B_OK;
}
示例3: RemoveNickFromList
void ChannelAgent::RemoveNickFromList(BObjectList<BString>& list, const char* data)
{
int32 count(list.CountItems());
for (int32 i = 0; i < count; i++) {
if (list.ItemAt(i)->ICompare(data) == 0) {
delete list.RemoveItemAt(i);
break;
}
}
}
示例4: BMenu
BMenu*
MenuBuilder::BuildMenu(KeyBind* bind, MenuFilter* filter,
CustomMenuCreator* custom)
{
if (bind == NULL)
return NULL;
// The first item describe the menu
BMenu* menu = new BMenu(bind[0].label);
if (filter != NULL)
filter->FilterMenu(menu, bind[0].message);
BObjectList<BMenu> menuList;
menuList.AddItem(menu);
for (int i = 1; bind[i].itemType != FABER_EOF; i++) {
menu = menuList.ItemAt(menuList.CountItems()-1);
if (bind[i].itemType == FABER_ITEM_START) {
BMenu* subMenu = NULL;
subMenu = new BMenu(bind[i].label);
if (filter != NULL)
filter->FilterMenu(subMenu, bind[i].message);
menu->AddItem(subMenu);
menuList.AddItem(subMenu);
} else if (bind[i].itemType == FABER_ITEM_END) {
if (menuList.CountItems() > 1)
menuList.RemoveItemAt(menuList.CountItems()-1);
} else if (bind[i].itemType == FABER_CUSTOM_ITEM) {
if (custom == NULL)
continue;
BMenu* customMenu = custom->CreateCustomMenu(bind[i].message);
if (customMenu != NULL)
menu->AddItem(customMenu);
} else if (bind[i].itemType == FABER_SUBITEM) {
BMenuItem* item = BuildMenuItem(bind[i].message, bind[i].label);
if (filter != NULL)
filter->FilterItem(item, bind[i].message);
menu->AddItem(item);
} else if (bind[i].itemType == FABER_SPLITTER)
menu->AddItem(new BSeparatorItem());
}
return menuList.ItemAt(0);
}
示例5:
void
WPASupplicantApp::_NotifyInterfaceStateChanged(BMessage *message)
{
const wpa_supplicant *interface;
if (message->FindPointer("interface", (void **)&interface) != B_OK)
return;
if (!fWatchingEntryListLocker.Lock())
return;
for (int32 i = 0; i < fWatchingEntryList.CountItems(); i++) {
StateChangeWatchingEntry *entry = fWatchingEntryList.ItemAt(i);
if (entry->MessageReceived(interface, message)) {
delete fWatchingEntryList.RemoveItemAt(i);
i--;
}
}
fWatchingEntryListLocker.Unlock();
}
示例6: symbols
status_t
DebuggerImageDebugInfo::GetFunctions(BObjectList<FunctionDebugInfo>& functions)
{
BObjectList<SymbolInfo> symbols(20, true);
status_t error = fDebuggerInterface->GetSymbolInfos(fImageInfo.TeamID(),
fImageInfo.ImageID(), symbols);
if (error != B_OK)
return error;
// sort the symbols -- not necessary, but a courtesy to ImageDebugInfo which
// will peform better when inserting functions at the end of a list
symbols.SortItems(&_CompareSymbols);
// create the function infos
int32 functionsAdded = 0;
for (int32 i = 0; SymbolInfo* symbol = symbols.ItemAt(i); i++) {
if (symbol->Type() != B_SYMBOL_TYPE_TEXT)
continue;
FunctionDebugInfo* function = new(std::nothrow) BasicFunctionDebugInfo(
this, symbol->Address(), symbol->Size(), symbol->Name(),
Demangler::Demangle(symbol->Name()));
if (function == NULL || !functions.AddItem(function)) {
delete function;
int32 index = functions.CountItems() - 1;
for (; functionsAdded >= 0; functionsAdded--, index--) {
function = functions.RemoveItemAt(index);
delete function;
}
return B_NO_MEMORY;
}
functionsAdded++;
}
return B_OK;
}
示例7: installLocker
//.........这里部分代码省略.........
for (UserBreakpointList::ConstIterator it
= fTeam->UserBreakpoints().GetIterator();
UserBreakpoint* userBreakpoint = it.Next();) {
// get the function
Function* function = fTeam->FunctionByID(
userBreakpoint->Location().GetFunctionID());
if (function == NULL)
continue;
const SourceLocation& sourceLocation
= userBreakpoint->Location().GetSourceLocation();
target_addr_t relativeAddress
= userBreakpoint->Location().RelativeAddress();
// iterate through the function instances
for (FunctionInstanceList::ConstIterator it
= function->Instances().GetIterator();
FunctionInstance* functionInstance = it.Next();) {
if (functionInstance->GetImageDebugInfo() != imageDebugInfo)
continue;
// get the breakpoint address for the instance
target_addr_t instanceAddress = 0;
if (functionInstance->SourceFile() != NULL) {
// We have a source file, so get the address for the source
// location.
Statement* statement = NULL;
FunctionDebugInfo* functionDebugInfo
= functionInstance->GetFunctionDebugInfo();
functionDebugInfo->GetSpecificImageDebugInfo()
->GetStatementAtSourceLocation(functionDebugInfo,
sourceLocation, statement);
if (statement != NULL) {
instanceAddress = statement->CoveringAddressRange().Start();
// TODO: What about BreakpointAllowed()?
statement->ReleaseReference();
// TODO: Make sure we do hit the function in question!
}
}
if (instanceAddress == 0) {
// No source file (or we failed getting the statement), so try
// to use the same relative address.
if (relativeAddress > functionInstance->Size())
continue;
instanceAddress = functionInstance->Address() + relativeAddress;
// TODO: Make sure it does at least hit an instruction!
}
// create the user breakpoint instance
UserBreakpointInstance* instance = new(std::nothrow)
UserBreakpointInstance(userBreakpoint, instanceAddress);
if (instance == NULL || !newInstances.AddItem(instance)) {
delete instance;
continue;
}
if (!userBreakpoint->AddInstance(instance)) {
newInstances.RemoveItemAt(newInstances.CountItems() - 1);
delete instance;
}
// get/create the breakpoint for the address
target_addr_t address = instance->Address();
Breakpoint* breakpoint = fTeam->BreakpointAtAddress(address);
if (breakpoint == NULL) {
breakpoint = new(std::nothrow) Breakpoint(image, address);
if (breakpoint == NULL || !fTeam->AddBreakpoint(breakpoint)) {
delete breakpoint;
break;
}
}
breakpoint->AddUserBreakpoint(instance);
instance->SetBreakpoint(breakpoint);
}
}
// install the breakpoints for the new user breakpoint instances
teamLocker.Unlock();
for (int32 i = 0; UserBreakpointInstance* instance = newInstances.ItemAt(i);
i++) {
Breakpoint* breakpoint = instance->GetBreakpoint();
if (breakpoint == NULL
|| _UpdateBreakpointInstallation(breakpoint) != B_OK) {
// something went wrong -- remove the instance
teamLocker.Lock();
instance->GetUserBreakpoint()->RemoveInstance(instance);
if (breakpoint != NULL) {
breakpoint->AddUserBreakpoint(instance);
if (breakpoint->IsUnused())
fTeam->RemoveBreakpoint(breakpoint);
}
teamLocker.Unlock();
}
}
}