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


C++ BReference类代码示例

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


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

示例1: locker

void
TeamWindow::_SetActiveImage(Image* image)
{
	if (image == fActiveImage)
		return;

	if (fActiveImage != NULL)
		fActiveImage->ReleaseReference();

	fActiveImage = image;

	AutoLocker< ::Team> locker(fTeam);

	ImageDebugInfo* imageDebugInfo = NULL;
	BReference<ImageDebugInfo> imageDebugInfoReference;

	if (fActiveImage != NULL) {
		fActiveImage->AcquireReference();

		imageDebugInfo = fActiveImage->GetImageDebugInfo();
		imageDebugInfoReference.SetTo(imageDebugInfo);

		// If the debug info is not loaded yet, request it.
		if (fActiveImage->ImageDebugInfoState() == IMAGE_DEBUG_INFO_NOT_LOADED)
			fListener->ImageDebugInfoRequested(fActiveImage);
	}

	locker.Unlock();

	fImageListView->SetImage(fActiveImage);
	fImageFunctionsView->SetImageDebugInfo(imageDebugInfo);
}
开发者ID:DonCN,项目名称:haiku,代码行数:32,代码来源:TeamWindow.cpp

示例2:

BReference<Crossing>
WindowArea::_CrossingByPosition(Crossing* crossing, SATGroup* group)
{
	BReference<Crossing> crossRef = NULL;

	Tab* oldHTab = crossing->HorizontalTab();
	BReference<Tab> hTab = group->FindHorizontalTab(oldHTab->Position());
	if (!hTab)
		hTab = group->_AddHorizontalTab(oldHTab->Position());
	if (!hTab)
		return crossRef;

	Tab* oldVTab = crossing->VerticalTab();
	crossRef = hTab->FindCrossing(oldVTab->Position());
	if (crossRef)
		return crossRef;

	BReference<Tab> vTab = group->FindVerticalTab(oldVTab->Position());
	if (!vTab)
		vTab = group->_AddVerticalTab(oldVTab->Position());
	if (!vTab)
		return crossRef;

	return hTab->AddCrossing(vTab);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:25,代码来源:SATGroup.cpp

示例3:

status_t
BNetworkAddress::SetTo(const char* host, const char* service, uint32 flags)
{
	BReference<const BNetworkAddressResolver> resolver
		= BNetworkAddressResolver::Resolve(host, service, flags);
	if (resolver.Get() == NULL)
		return B_NO_MEMORY;
	status_t status = resolver->InitCheck();
	if (status != B_OK)
		return status;

	// Prefer IPv6 addresses

	uint32 cookie = 0;
	status = resolver->GetNextAddress(AF_INET6, &cookie, *this);
	if (status != B_OK) {
		cookie = 0;
		status = resolver->GetNextAddress(&cookie, *this);
		if (status != B_OK)
			Unset();
	}
	fHostName = host;
	fStatus = status;
	return status;
}
开发者ID:looncraz,项目名称:haiku,代码行数:25,代码来源:NetworkAddress.cpp

示例4: _ParseLinkAddress

status_t
BNetworkAddress::SetTo(int family, const char* host, const char* service,
	uint32 flags)
{
	if (family == AF_LINK) {
		if (service != NULL)
			return B_BAD_VALUE;
		return _ParseLinkAddress(host);
			// SetToLinkAddress takes care of setting fStatus
	}

	BReference<const BNetworkAddressResolver> resolver
		= BNetworkAddressResolver::Resolve(family, host, service, flags);
	if (resolver.Get() == NULL)
		return B_NO_MEMORY;
	status_t status = resolver->InitCheck();
	if (status != B_OK)
		return status;

	uint32 cookie = 0;
	status = resolver->GetNextAddress(&cookie, *this);
	if (status != B_OK)
		Unset();
	fHostName = host;
	fStatus = status;
	return status;
}
开发者ID:looncraz,项目名称:haiku,代码行数:27,代码来源:NetworkAddress.cpp

示例5: print_socket_line

static void
print_socket_line(net_socket_private* socket, const char* prefix)
{
	BReference<net_socket_private> parent = socket->parent.GetReference();
	kprintf("%s%p %2d.%2d.%2d %6ld %p %p  %p%s\n", prefix, socket,
		socket->family, socket->type, socket->protocol, socket->owner,
		socket->first_protocol, socket->first_info, parent.Get(),
		parent.Get() != NULL ? socket->is_connected ? " (c)" : " (p)" : "");
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:9,代码来源:net_socket.cpp

示例6: STRACE_SAT

void
SATGroup::_SpawnNewGroup(const WindowAreaList& newGroup)
{
	STRACE_SAT("SATGroup::_SpawnNewGroup\n");
	SATGroup* group = new (std::nothrow)SATGroup;
	if (!group)
		return;
	BReference<SATGroup> groupRef;
	groupRef.SetTo(group, true);

	for (int i = 0; i < newGroup.CountItems(); i++)
		newGroup.ItemAt(i)->PropagateToGroup(group);

	_EnsureGroupIsOnScreen(group);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:15,代码来源:SATGroup.cpp

示例7: message

void
InspectorWindow::ExpressionEvaluated(ExpressionInfo* info, status_t result,
	ExpressionResult* value)
{
	BMessage message(MSG_EXPRESSION_EVALUATED);
	message.AddInt32("result", result);
	BReference<ExpressionResult> reference;
	if (value != NULL) {
		reference.SetTo(value);
		message.AddPointer("value", value);
	}

	if (PostMessage(&message) == B_OK)
		reference.Detach();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:15,代码来源:InspectorWindow.cpp

示例8: bad_alloc

status_t
WriterImplBase::InitHeapReader(size_t headerSize)
{
	// allocate the compression/decompression algorithm
	CompressionAlgorithmOwner* compressionAlgorithm = NULL;
	BReference<CompressionAlgorithmOwner> compressionAlgorithmReference;

	DecompressionAlgorithmOwner* decompressionAlgorithm = NULL;
	BReference<DecompressionAlgorithmOwner> decompressionAlgorithmReference;

	switch (fParameters.Compression()) {
		case B_HPKG_COMPRESSION_NONE:
			break;
		case B_HPKG_COMPRESSION_ZLIB:
			compressionAlgorithm = CompressionAlgorithmOwner::Create(
				new(std::nothrow) BZlibCompressionAlgorithm,
				new(std::nothrow) BZlibCompressionParameters(
					fParameters.CompressionLevel()));
			compressionAlgorithmReference.SetTo(compressionAlgorithm, true);

			decompressionAlgorithm = DecompressionAlgorithmOwner::Create(
				new(std::nothrow) BZlibCompressionAlgorithm,
				new(std::nothrow) BZlibDecompressionParameters);
			decompressionAlgorithmReference.SetTo(decompressionAlgorithm, true);

			if (compressionAlgorithm == NULL
				|| compressionAlgorithm->algorithm == NULL
				|| compressionAlgorithm->parameters == NULL
				|| decompressionAlgorithm == NULL
				|| decompressionAlgorithm->algorithm == NULL
				|| decompressionAlgorithm->parameters == NULL) {
				throw std::bad_alloc();
			}
			break;
		default:
			fErrorOutput->PrintError("Error: Invalid heap compression\n");
			return B_BAD_VALUE;
	}

	// create heap writer
	fHeapWriter = new PackageFileHeapWriter(fErrorOutput, fFile, headerSize,
		compressionAlgorithm, decompressionAlgorithm);
	fHeapWriter->Init();

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

示例9: ASSERT

void
SATWindow::_InitGroup()
{
	ASSERT(fGroupCookie == &fOwnGroupCookie);
	ASSERT(fOwnGroupCookie.GetGroup() == NULL);
	STRACE_SAT("SATWindow::_InitGroup %s\n", fWindow->Title());
	SATGroup* group = new (std::nothrow)SATGroup;
	if (!group)
		return;
	BReference<SATGroup> groupRef;
	groupRef.SetTo(group, true);

	/* AddWindow also will trigger the window to hold a reference on the new
	group. */
	if (!groupRef->AddWindow(this, NULL, NULL, NULL, NULL))
		STRACE_SAT("SATWindow::_InitGroup(): adding window to group failed\n");
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例10: dump_socket

static int
dump_socket(int argc, char** argv)
{
	if (argc < 2) {
		kprintf("usage: %s [address]\n", argv[0]);
		return 0;
	}

	net_socket_private* socket = (net_socket_private*)parse_expression(argv[1]);

	kprintf("SOCKET %p\n", socket);
	kprintf("  family.type.protocol: %d.%d.%d\n",
		socket->family, socket->type, socket->protocol);
	BReference<net_socket_private> parent = socket->parent.GetReference();
	kprintf("  parent:               %p\n", parent.Get());
	kprintf("  first protocol:       %p\n", socket->first_protocol);
	kprintf("  first module_info:    %p\n", socket->first_info);
	kprintf("  options:              %x\n", socket->options);
	kprintf("  linger:               %d\n", socket->linger);
	kprintf("  bound to device:      %" B_PRIu32 "\n", socket->bound_to_device);
	kprintf("  owner:                %ld\n", socket->owner);
	kprintf("  max backlog:          %ld\n", socket->max_backlog);
	kprintf("  is connected:         %d\n", socket->is_connected);
	kprintf("  child_count:          %lu\n", socket->child_count);

	if (socket->child_count == 0)
		return 0;

	kprintf("    pending children:\n");
	SocketList::Iterator iterator = socket->pending_children.GetIterator();
	while (net_socket_private* child = iterator.Next()) {
		print_socket_line(child, "      ");
	}

	kprintf("    connected children:\n");
	iterator = socket->connected_children.GetIterator();
	while (net_socket_private* child = iterator.Next()) {
		print_socket_line(child, "      ");
	}

	return 0;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:42,代码来源:net_socket.cpp

示例11: _ParseLinkAddress

status_t
BNetworkAddress::SetTo(int family, const char* host, uint16 port, uint32 flags)
{
	if (family == AF_LINK) {
		if (port != 0)
			return B_BAD_VALUE;
		return _ParseLinkAddress(host);
	}

	BReference<const BNetworkAddressResolver> resolver
		= BNetworkAddressResolver::Resolve(family, host, port, flags);
	if (resolver.Get() == NULL)
		return B_NO_MEMORY;
	status_t status = resolver->InitCheck();
	if (status != B_OK)
		return status;

	uint32 cookie = 0;
	return resolver->GetNextAddress(&cookie, *this);
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:20,代码来源:NetworkAddress.cpp

示例12: ProcessPendingEvents

void
CliContext::WaitForThreadOrUser()
{
	ProcessPendingEvents();

// TODO: Deal with SIGINT as well!
	for (;;) {
		_PrepareToWaitForEvents(
			EVENT_USER_INTERRUPT | EVENT_THREAD_STOPPED);

		// check whether there are any threads stopped already
		Thread* stoppedThread = NULL;
		BReference<Thread> stoppedThreadReference;

		AutoLocker<Team> teamLocker(fTeam);

		for (ThreadList::ConstIterator it = fTeam->Threads().GetIterator();
				Thread* thread = it.Next();) {
			if (thread->State() == THREAD_STATE_STOPPED) {
				stoppedThread = thread;
				stoppedThreadReference.SetTo(thread);
				break;
			}
		}

		teamLocker.Unlock();

		if (stoppedThread != NULL) {
			if (fCurrentThread == NULL)
				SetCurrentThread(stoppedThread);

			_SignalInputLoop(EVENT_THREAD_STOPPED);
		}

		uint32 events = _WaitForEvents();
		if ((events & EVENT_QUIT) != 0 || stoppedThread != NULL) {
			ProcessPendingEvents();
			return;
		}
	}
}
开发者ID:looncraz,项目名称:haiku,代码行数:41,代码来源:CliContext.cpp

示例13:

status_t
BNetworkAddress::SetTo(const char* host, uint16 port, uint32 flags)
{
	BReference<const BNetworkAddressResolver> resolver
		= BNetworkAddressResolver::Resolve(host, port, flags);
	if (resolver.Get() == NULL)
		return B_NO_MEMORY;
	status_t status = resolver->InitCheck();
	if (status != B_OK)
		return status;

	// Prefer IPv6 addresses

	uint32 cookie = 0;
	status = resolver->GetNextAddress(AF_INET6, &cookie, *this);
	if (status == B_OK)
		return B_OK;

	cookie = 0;
	return resolver->GetNextAddress(&cookie, *this);
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:21,代码来源:NetworkAddress.cpp

示例14: add_boot_volume_item

static void
add_boot_volume_item(Menu* menu, Directory* volume, const char* name)
{
	BReference<PackageVolumeInfo> volumeInfo;
	PackageVolumeState* selectedState = NULL;
	if (volume == sBootVolume->RootDirectory()) {
		volumeInfo.SetTo(sBootVolume->GetPackageVolumeInfo());
		selectedState = sBootVolume->GetPackageVolumeState();
	} else {
		volumeInfo.SetTo(new(std::nothrow) PackageVolumeInfo);
		if (volumeInfo->SetTo(volume, "system/packages") == B_OK)
			selectedState = volumeInfo->States().Head();
		else
			volumeInfo.Unset();
	}

	BootVolumeMenuItem* item = new(nothrow) BootVolumeMenuItem(name);
	menu->AddItem(item);

	Menu* subMenu = NULL;

	if (volumeInfo != NULL) {
		subMenu = new(std::nothrow) Menu(CHOICE_MENU, "Select Haiku version");

		for (PackageVolumeStateList::ConstIterator it
				= volumeInfo->States().GetIterator();
			PackageVolumeState* state = it.Next();) {
			PackageVolumeStateMenuItem* stateItem
				= new(nothrow) PackageVolumeStateMenuItem(state->DisplayName(),
					volumeInfo, state);
			subMenu->AddItem(stateItem);
			stateItem->SetTarget(user_menu_boot_volume_state);
			stateItem->SetData(volume);

			if (state == selectedState) {
				stateItem->SetMarked(true);
				stateItem->Select(true);
				item->UpdateStateName(stateItem->VolumeState());
			}
		}
	}

	if (subMenu != NULL && subMenu->CountItems() > 1) {
		item->SetSubmenu(subMenu);
	} else {
		delete subMenu;
		item->SetTarget(user_menu_boot_volume);
		item->SetData(volume);
	}

	if (volume == sBootVolume->RootDirectory()) {
		item->SetMarked(true);
		item->Select(true);
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:55,代码来源:menu.cpp

示例15: new

status_t
DwarfType::CreateDerivedArrayType(int64 lowerBound, int64 elementCount,
	bool extendExisting, ArrayType*& _resultType)
{
	DwarfArrayType* resultType = NULL;
	BReference<DwarfType> baseTypeReference;
	if (extendExisting)
		resultType = dynamic_cast<DwarfArrayType*>(this);

	if (resultType == NULL) {
		resultType = new(std::nothrow)
			DwarfArrayType(fTypeContext, fName, NULL, this);
		baseTypeReference.SetTo(resultType, true);
	}

	if (resultType == NULL)
		return B_NO_MEMORY;

	DwarfSubrangeType* subrangeType = new(std::nothrow) DwarfSubrangeType(
		fTypeContext, fName, NULL, resultType, BVariant(lowerBound),
		BVariant(lowerBound + elementCount - 1));
	if (subrangeType == NULL)
		return B_NO_MEMORY;

	BReference<DwarfSubrangeType> subrangeReference(subrangeType, true);

	DwarfArrayDimension* dimension = new(std::nothrow) DwarfArrayDimension(
		subrangeType);
	if (dimension == NULL)
		return B_NO_MEMORY;
	BReference<DwarfArrayDimension> dimensionReference(dimension, true);

	if (!resultType->AddDimension(dimension))
		return B_NO_MEMORY;

	baseTypeReference.Detach();

	_resultType = resultType;
	return B_OK;
}
开发者ID:RAZVOR,项目名称:haiku,代码行数:40,代码来源:DwarfTypes.cpp


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