本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}