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


C++ AppServerLink::Read方法代码示例

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


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

示例1: sizeof

void
BFont::GetEscapements(const char charArray[], int32 numChars,
	escapement_delta* delta, BPoint escapementArray[],
	BPoint offsetArray[]) const
{
	if (charArray == NULL || numChars < 1 || escapementArray == NULL)
		return;

	BPrivate::AppServerLink link;
	link.StartMessage(AS_GET_ESCAPEMENTS);
	link.Attach<uint16>(fFamilyID);
	link.Attach<uint16>(fStyleID);
	link.Attach<float>(fSize);
	link.Attach<uint8>(fSpacing);
	link.Attach<float>(fRotation);
	link.Attach<uint32>(fFlags);

	link.Attach<float>(delta ? delta->nonspace : 0.0);
	link.Attach<float>(delta ? delta->space : 0.0);
	link.Attach<bool>(offsetArray != NULL);
	link.Attach<int32>(numChars);

	// TODO: Should we not worry about the port capacity here?!?
	uint32 bytesInBuffer = UTF8CountBytes(charArray, numChars);
	link.Attach<int32>(bytesInBuffer);
	link.Attach(charArray, bytesInBuffer);

	int32 code;
	if (link.FlushWithReply(code) != B_OK || code != B_OK)
		return;

	link.Read(escapementArray, sizeof(BPoint) * numChars);
	if (offsetArray)
		link.Read(offsetArray, sizeof(BPoint) * numChars);
}
开发者ID:looncraz,项目名称:haiku,代码行数:35,代码来源:Font.cpp

示例2: sizeof

status_t
get_window_order(int32 workspace, int32** _tokens, int32* _count)
{
	BPrivate::AppServerLink link;

	link.StartMessage(AS_GET_WINDOW_ORDER);
	link.Attach<int32>(workspace);

	int32 code;
	status_t status = link.FlushWithReply(code);
	if (status != B_OK)
		return status;
	if (code != B_OK)
		return code;

	int32 count;
	link.Read<int32>(&count);

	*_tokens = (int32*)malloc(count * sizeof(int32));
	if (*_tokens == NULL)
		return B_NO_MEMORY;

	link.Read(*_tokens, count * sizeof(int32));
	*_count = count;
	return B_OK;
}
开发者ID:mmanley,项目名称:Antares,代码行数:26,代码来源:InterfaceDefs.cpp

示例3: sizeof

/*!	\brief Returns the overlay_restrictions structure for this bitmap
*/
status_t
BBitmap::GetOverlayRestrictions(overlay_restrictions* restrictions) const
{
	if ((fFlags & B_BITMAP_WILL_OVERLAY) == 0)
		return B_BAD_TYPE;

	BPrivate::AppServerLink link;

	link.StartMessage(AS_GET_BITMAP_OVERLAY_RESTRICTIONS);
	link.Attach<int32>(fServerToken);

	status_t status;
	if (link.FlushWithReply(status) < B_OK)
		return status;

	link.Read(restrictions, sizeof(overlay_restrictions));
	return B_OK;
}
开发者ID:orangejua,项目名称:haiku,代码行数:20,代码来源:Bitmap.cpp

示例4:

client_window_info*
get_window_info(int32 serverToken)
{
	BPrivate::AppServerLink link;

	link.StartMessage(AS_GET_WINDOW_INFO);
	link.Attach<int32>(serverToken);

	int32 code;
	if (link.FlushWithReply(code) != B_OK || code != B_OK)
		return NULL;

	int32 size;
	link.Read<int32>(&size);

	client_window_info* info = (client_window_info*)malloc(size);
	if (info == NULL)
		return NULL;

	link.Read(info, size);
	return info;
}
开发者ID:mmanley,项目名称:Antares,代码行数:22,代码来源:InterfaceDefs.cpp

示例5: malloc

status_t
get_mouse_bitmap(BBitmap** bitmap, BPoint* hotspot)
{
	if (bitmap == NULL && hotspot == NULL)
		return B_BAD_VALUE;
	
	BPrivate::AppServerLink link;
	link.StartMessage(AS_GET_CURSOR_BITMAP);
	
	int32 code;
	status_t status = link.FlushWithReply(code);
	if (status != B_OK)
		return status;
	if (code != B_OK)
		return code;
	
	uint32 size = 0;
	uint32 cursorWidth = 0;
	uint32 cursorHeight = 0;
	
	// if link.Read() returns an error, the same error will be returned on
	// subsequent calls, so we'll check only the return value of the last call
	link.Read<uint32>(&size);
	link.Read<uint32>(&cursorWidth);
	link.Read<uint32>(&cursorHeight);
	if (hotspot == NULL) {
		BPoint dummy;
		link.Read<BPoint>(&dummy);
	} else
		link.Read<BPoint>(hotspot);

	void* data = NULL;
	if (size > 0)
		data = malloc(size);
	if (data == NULL)
		return B_NO_MEMORY;
	
	status = link.Read(data, size);
	if (status != B_OK) {
		free(data);
		return status;
	}
	
	BBitmap* cursorBitmap = new (std::nothrow) BBitmap(BRect(0, 0,
		cursorWidth - 1, cursorHeight - 1), B_RGBA32);
	
	if (cursorBitmap == NULL) {
		free(data);
		return B_NO_MEMORY;
	}
	status = cursorBitmap->InitCheck();
	if (status == B_OK)
		cursorBitmap->SetBits(data, size, 0, B_RGBA32);

	free(data);
	
	if (status == B_OK && bitmap != NULL)
		*bitmap = cursorBitmap;
	else
		delete cursorBitmap;
	
	return status;
}
开发者ID:royalharsh,项目名称:haiku,代码行数:63,代码来源:InterfaceDefs.cpp


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