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


C++ BObjectList::AddItem方法代码示例

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


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

示例1: AddFolders

	status_t AddFolders(BObjectList<IMAPFolder>& folders)
	{
		IMAPConnectionWorker::MailboxMap::iterator iterator
			= fWorker.fMailboxes.begin();
		for (; iterator != fWorker.fMailboxes.end(); iterator++) {
			IMAPFolder* folder = iterator->first;
			if (!folders.AddItem(folder))
				return B_NO_MEMORY;
		}
		return B_OK;
	}
开发者ID:bhanug,项目名称:haiku,代码行数:11,代码来源:IMAPConnectionWorker.cpp

示例2:

bool
Model::ThreadWaitObjectGroup::GetThreadWaitObjects(
	BObjectList<ThreadWaitObject>& objects)
{
	ThreadWaitObjectList::Iterator it = fWaitObjects.GetIterator();
	while (ThreadWaitObject* object = it.Next()) {
		if (!objects.AddItem(object))
			return false;
	}

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

示例3: strdup

void
TokenizeToList(const char *string, BObjectList<BString> &stringList)
{
	if (!string)
		return;
	
	char *workstr = strdup(string);
	strtok(workstr, "\n");
	
	char *token = strtok(NULL,"\n");
	char *lasttoken = workstr;
	
	if (!token)
	{
		free(workstr);
		stringList.AddItem(new BString(string));
		return;
	}
	
	int32 length = 0;
	BString *newword = NULL;
	
	while (token)
	{
		length = token - lasttoken;
		
		newword = new BString(lasttoken, length + 1);
		lasttoken = token;
		stringList.AddItem(newword);

		token = strtok(NULL,"\n");
	}
	
	length = strlen(lasttoken);
	newword = new BString(lasttoken, length + 1);
	lasttoken = token;
	stringList.AddItem(newword);
		
	free(workstr);
}
开发者ID:humdingerb,项目名称:Paladin,代码行数:40,代码来源:FindWindow.cpp

示例4:

void
Team::GetWatchpointsInAddressRange(TargetAddressRange range,
	BObjectList<Watchpoint>& watchpoints) const
{
	int32 index = fWatchpoints.FindBinaryInsertionIndex(
		WatchpointByAddressPredicate(range.Start()));
	for (; Watchpoint* watchpoint = fWatchpoints.ItemAt(index); index++) {
		if (watchpoint->Address() > range.End())
			break;

		watchpoints.AddItem(watchpoint);
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:13,代码来源:Team.cpp

示例5:

BObjectList<Task>* TaskFS::GetTasks(TaskList forList)
{
	Task				*tmpTask		= NULL;
	BObjectList<Task>	*taskTaskList	= new BObjectList<Task>();
	int32	i;
	//grab a up to date List of Items
	GetTasks();
	for (i = 0; i<tasks->CountItems();i++) {
		tmpTask=tasks->ItemAt(i);
		if (*(tmpTask->GetTaskList()) == forList)
			taskTaskList->AddItem(tmpTask);
	}
	return taskTaskList;
}
开发者ID:Paradoxianer,项目名称:Tasks,代码行数:14,代码来源:TaskFS.cpp

示例6: addonName

status_t
ModuleManager::_GetAddOn(const char *name, ModuleAddOn **_addon)
{
	// search list first
	for (int32 i = 0; ModuleAddOn *addon = fAddOns.ItemAt(i); i++) {
		BString addonName(addon->Name());
		addonName << "/";
		if (!strcmp(name, addon->Name())
			|| !strncmp(addonName.String(), name, addonName.Length())) {
			addon->Get();
			*_addon = addon;
			return B_OK;
		}
	}
	// not in list yet, load from disk
	// iterate through module dirs
	for (int32 i = 0; gModuleDirs[i]; i++) {
		BPath path;
		if (path.SetTo(gModuleDirs[i]) == B_OK
			&& path.SetTo(path.Path(), name) == B_OK) {
			BEntry entry;
			for (;;) {
				if (entry.SetTo(path.Path()) == B_OK && entry.Exists()) {
					// found an entry: if it is a file, try to load it
					if (entry.IsFile()) {
						ModuleAddOn *addon = new ModuleAddOn;
						if (addon->Load(path.Path(), gModuleDirs[i]) == B_OK) {
							status_t status = addon->Get();
							if (status < B_OK) {
								delete addon;
								return status;
							}

							fAddOns.AddItem(addon);
							*_addon = addon;
							return B_OK;
						}
						delete addon;
					}
					break;
				}
				// chop off last path component
				if (path.GetParent(&path) != B_OK)
					break;
			}
		}
	}
	return B_ENTRY_NOT_FOUND;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:49,代码来源:module.cpp

示例7: data

status_t
DebugReportGenerator::_DumpRunningThreads(BFile& _output)
{
	AutoLocker< ::Team> locker(fTeam);

	BString data("\nActive Threads:\n");
	WRITE_AND_CHECK(_output, data);
	BObjectList< ::Thread> threads;
	::Thread* thread;
	for (ThreadList::ConstIterator it = fTeam->Threads().GetIterator();
		  (thread = it.Next());) {
		 threads.AddItem(thread);
	}

	threads.SortItems(&_CompareThreads);
	for (int32 i = 0; (thread = threads.ItemAt(i)) != NULL; i++) {
		try {
			data.SetToFormat("\tthread %" B_PRId32 ": %s %s\n", thread->ID(),
					thread->Name(), thread->IsMainThread()
						? "(main)" : "");
			WRITE_AND_CHECK(_output, data);

			if (thread->State() == THREAD_STATE_STOPPED) {
				data.SetToFormat("\t\tstate: %s",
					UiUtils::ThreadStateToString(thread->State(),
							thread->StoppedReason()));
				const BString& stoppedInfo = thread->StoppedReasonInfo();
				if (stoppedInfo.Length() != 0)
					data << " (" << stoppedInfo << ")";
				data << "\n\n";
				WRITE_AND_CHECK(_output, data);

				// we need to release our lock on the team here
				// since we might need to block and wait
				// on the stack trace.
				BReference< ::Thread> threadRef(thread);
				locker.Unlock();
				status_t error = _DumpDebuggedThreadInfo(_output, thread);
				if (error != B_OK)
					return error;
				locker.Lock();
			}
		} catch (...) {
			return B_NO_MEMORY;
		}
	}

	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:49,代码来源:DebugReportGenerator.cpp

示例8: new

status_t
DebuggerInterface::GetImageInfos(BObjectList<ImageInfo>& infos)
{
	// get the team's images
	image_info imageInfo;
	int32 cookie = 0;
	while (get_next_image_info(fTeamID, &cookie, &imageInfo) == B_OK) {
		ImageInfo* info = new(std::nothrow) ImageInfo(fTeamID, imageInfo.id,
			imageInfo.name, imageInfo.type, (addr_t)imageInfo.text,
			imageInfo.text_size, (addr_t)imageInfo.data, imageInfo.data_size);
		if (info == NULL || !infos.AddItem(info)) {
			delete info;
			return B_NO_MEMORY;
		}
	}

	// Also add the "commpage" image, which belongs to the kernel, but is used
	// by userland teams.
	cookie = 0;
	while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &imageInfo) == B_OK) {
		if ((addr_t)imageInfo.text >= USER_COMMPAGE_ADDR
			&& (addr_t)imageInfo.text < USER_COMMPAGE_ADDR + COMMPAGE_SIZE) {
			ImageInfo* info = new(std::nothrow) ImageInfo(B_SYSTEM_TEAM,
				imageInfo.id, imageInfo.name, imageInfo.type,
				(addr_t)imageInfo.text, imageInfo.text_size,
				(addr_t)imageInfo.data, imageInfo.data_size);
			if (info == NULL || !infos.AddItem(info)) {
				delete info;
				return B_NO_MEMORY;
			}
			break;
		}
	}

	return B_OK;
}
开发者ID:mariuz,项目名称:haiku,代码行数:36,代码来源:DebuggerInterface.cpp

示例9:

void
View::FindViews(uint32 flags, BObjectList<View>& list, int32& left)
{
    if ((Flags() & flags) == flags) {
        list.AddItem(this);
        left--;
        return;
    }

    for (View* child = FirstChild(); child; child = child->NextSibling()) {
        child->FindViews(flags, list, left);
        if (left == 0)
            break;
    }
}
开发者ID:mmanley,项目名称:Antares,代码行数:15,代码来源:View.cpp

示例10: new

status_t
LocalDebuggerInterface::GetThreadInfos(BObjectList<ThreadInfo>& infos)
{
	thread_info threadInfo;
	int32 cookie = 0;
	while (get_next_thread_info(fTeamID, &cookie, &threadInfo) == B_OK) {
		ThreadInfo* info = new(std::nothrow) ThreadInfo(threadInfo.team,
			threadInfo.thread, threadInfo.name);
		if (info == NULL || !infos.AddItem(info)) {
			delete info;
			return B_NO_MEMORY;
		}
	}

	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:16,代码来源:LocalDebuggerInterface.cpp

示例11: sizeof

status_t
LocalDebuggerInterface::GetSymbolInfos(team_id team, image_id image,
	BObjectList<SymbolInfo>& infos)
{
	// create a lookup context
	debug_symbol_lookup_context* lookupContext;
	status_t error = debug_create_symbol_lookup_context(team, image,
		&lookupContext);
	if (error != B_OK)
		return error;

	// create a symbol iterator
	debug_symbol_iterator* iterator;
	error = debug_create_image_symbol_iterator(
		lookupContext, image, &iterator);
	if (error != B_OK) {
		debug_delete_symbol_lookup_context(lookupContext);
		return error;
	}

	// get the symbols
	char name[1024];
	int32 type;
	void* address;
	size_t size;
	while (debug_next_image_symbol(iterator, name, sizeof(name), &type,
			&address, &size) == B_OK) {
		SymbolInfo* info = new(std::nothrow) SymbolInfo(
			(target_addr_t)(addr_t)address, size, type, name);
		if (info == NULL)
			break;
		if (!infos.AddItem(info)) {
			delete info;
			break;
		}
	}

	// delete the symbol iterator and lookup context
	debug_delete_symbol_iterator(iterator);
	debug_delete_symbol_lookup_context(lookupContext);

	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:43,代码来源:LocalDebuggerInterface.cpp

示例12: new

status_t
WPASupplicantApp::_StartWatchingInterfaceChanges(
	const wpa_supplicant *interface, StateChangeCallback callback, void *data)
{
	StateChangeWatchingEntry *entry
		= new(std::nothrow) StateChangeWatchingEntry(interface, callback, data);
	if (entry == NULL)
		return B_NO_MEMORY;

	if (!fWatchingEntryListLocker.Lock()) {
		delete entry;
		return B_ERROR;
	}

	status_t result = B_OK;
	if (!fWatchingEntryList.AddItem(entry)) {
		result = B_ERROR;
		delete entry;
	}

	fWatchingEntryListLocker.Unlock();
	return result;
}
开发者ID:kallisti5,项目名称:wpa_supplicant-haiku,代码行数:23,代码来源:main_haiku.cpp

示例13: 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;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:37,代码来源:DebuggerImageDebugInfo.cpp

示例14: dir

void
TTracker::CloseWindowAndChildren(const node_ref *node)
{
	BDirectory dir(node);
	if (dir.InitCheck() != B_OK)
		return;

	AutoLock<WindowList> lock(&fWindowList);
	BObjectList<BContainerWindow> closeList;

	// make a list of all windows to be closed
	// count from end to beginning so we can remove items safely
	for (int32 index = fWindowList.CountItems() - 1; index >= 0; index--) {
		BContainerWindow *window = dynamic_cast<BContainerWindow *>
			(fWindowList.ItemAt(index));
		if (window && window->TargetModel()) {
			BEntry wind_entry;
			wind_entry.SetTo(window->TargetModel()->EntryRef());

			if ((*window->TargetModel()->NodeRef() == *node)
				|| dir.Contains(&wind_entry)) {
				
				// ToDo:
				// get rid of the Remove here, BContainerWindow::Quit does it
				fWindowList.RemoveItemAt(index);
				closeList.AddItem(window);
			}
		}
	}

	// now really close the windows
	int32 numItems = closeList.CountItems();
	for (int32 index = 0; index < numItems; index++) {
		BContainerWindow *window = closeList.ItemAt(index);
		window->PostMessage(B_CLOSE_REQUESTED);
	}
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:37,代码来源:Tracker.cpp

示例15: installLocker

void
BreakpointManager::_UpdateImageBreakpoints(Image* image, bool removeOnly)
{
	AutoLocker<BLocker> installLocker(fLock);
	AutoLocker<Team> teamLocker(fTeam);

	// remove obsolete user breakpoint instances
	BObjectList<Breakpoint> breakpointsToUpdate;
	for (UserBreakpointList::ConstIterator it
			= fTeam->UserBreakpoints().GetIterator();
		UserBreakpoint* userBreakpoint = it.Next();) {
		int32 instanceCount = userBreakpoint->CountInstances();
		for (int32 i = instanceCount - 1; i >= 0; i--) {
			UserBreakpointInstance* instance = userBreakpoint->InstanceAt(i);
			Breakpoint* breakpoint = instance->GetBreakpoint();
			if (breakpoint == NULL || breakpoint->GetImage() != image)
				continue;

			userBreakpoint->RemoveInstanceAt(i);
			breakpoint->RemoveUserBreakpoint(instance);

			if (!breakpointsToUpdate.AddItem(breakpoint)) {
				_UpdateBreakpointInstallation(breakpoint);
				if (breakpoint->IsUnused())
					fTeam->RemoveBreakpoint(breakpoint);
			}

			delete instance;
		}
	}

	// update breakpoints
	teamLocker.Unlock();
	for (int32 i = 0; Breakpoint* breakpoint = breakpointsToUpdate.ItemAt(i);
			i++) {
		_UpdateBreakpointInstallation(breakpoint);
	}

	teamLocker.Lock();
	for (int32 i = 0; Breakpoint* breakpoint = breakpointsToUpdate.ItemAt(i);
			i++) {
		if (breakpoint->IsUnused())
			fTeam->RemoveBreakpoint(breakpoint);
	}

	// add breakpoint instances for function instances in the image (if we have
	// an image debug info)
	BObjectList<UserBreakpointInstance> newInstances;
	ImageDebugInfo* imageDebugInfo = image->GetImageDebugInfo();
	if (imageDebugInfo == NULL)
		return;

	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!
			}
//.........这里部分代码省略.........
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:101,代码来源:BreakpointManager.cpp


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