本文整理汇总了C++中bprivate::AppServerLink::FlushWithReply方法的典型用法代码示例。如果您正苦于以下问题:C++ AppServerLink::FlushWithReply方法的具体用法?C++ AppServerLink::FlushWithReply怎么用?C++ AppServerLink::FlushWithReply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bprivate::AppServerLink
的用法示例。
在下文中一共展示了AppServerLink::FlushWithReply方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unicode_block
unicode_block
BFont::Blocks() const
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_UNICODE_BLOCKS);
link.Attach<uint16>(fFamilyID);
link.Attach<uint16>(fStyleID);
int32 status;
if (link.FlushWithReply(status) != B_OK
|| status != B_OK) {
return unicode_block(~0LL, ~0LL);
}
unicode_block blocksForFont;
link.Read<unicode_block>(&blocksForFont);
return blocksForFont;
}
示例2:
/*! \brief queries the server for the name of the decorator with a certain index
\param index The index of the decorator to get the name for
\param name BString to receive the name of the decorator
\return B_OK if successful, B_ERROR if not
*/
status_t
get_decorator_name(const int32 &index, BString &name)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_DECORATOR_NAME);
link.Attach<int32>(index);
int32 code;
if (link.FlushWithReply(code) == B_OK && code == B_OK) {
char *string;
if (link.ReadString(&string) == B_OK) {
name = string;
free(string);
return B_OK;
}
}
return B_ERROR;
}
示例3: sizeof
status_t
_get_system_default_font_(const char* which, font_family family,
font_style style, float* _size)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_SYSTEM_DEFAULT_FONT);
link.AttachString(which, B_OS_NAME_LENGTH);
int32 status = B_ERROR;
if (link.FlushWithReply(status) != B_OK
|| status < B_OK)
return status;
link.ReadString(family, sizeof(font_family));
link.ReadString(style, sizeof(font_style));
link.Read<float>(_size);
return B_OK;
}
示例4:
font_file_format
BFont::FileFormat() const
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_FONT_FILE_FORMAT);
link.Attach<uint16>(fFamilyID);
link.Attach<uint16>(fStyleID);
int32 status;
if (link.FlushWithReply(status) != B_OK
|| status != B_OK) {
// just take a safe bet...
return B_TRUETYPE_WINDOWS;
}
uint16 format;
link.Read<uint16>(&format);
return (font_file_format)format;
}
示例5: locker
bool
BDragger::AreDraggersDrawn()
{
DraggerManager* manager = DraggerManager::Default();
AutoLocker<DraggerManager> locker(manager);
if (!manager->visibleInitialized) {
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_SHOW_ALL_DRAGGERS);
status_t status;
if (link.FlushWithReply(status) == B_OK && status == B_OK) {
link.Read<bool>(&manager->visible);
manager->visibleInitialized = true;
} else
return false;
}
return manager->visible;
}
示例6:
void
BBitmap::_ReconnectToAppServer()
{
BPrivate::AppServerLink link;
link.StartMessage(AS_RECONNECT_BITMAP);
link.Attach<BRect>(fBounds);
link.Attach<color_space>(fColorSpace);
link.Attach<uint32>(fFlags);
link.Attach<int32>(fBytesPerRow);
link.Attach<int32>(0);
link.Attach<int32>(fArea);
link.Attach<int32>(fAreaOffset);
status_t error;
if (link.FlushWithReply(error) == B_OK && error == B_OK) {
// server side success
// Get token
link.Read<int32>(&fServerToken);
link.Read<area_id>(&fServerArea);
}
}
示例7: sizeof
int32*
get_token_list(team_id team, int32* _count)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_WINDOW_LIST);
link.Attach<team_id>(team);
int32 code;
if (link.FlushWithReply(code) != B_OK || code != B_OK)
return NULL;
int32 count;
link.Read<int32>(&count);
int32* tokens = (int32*)malloc(count * sizeof(int32));
if (tokens == NULL)
return NULL;
link.Read(tokens, count * sizeof(int32));
*_count = count;
return tokens;
}
示例8: if
void
_init_global_fonts_()
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_SYSTEM_FONTS);
int32 code;
if (link.FlushWithReply(code) != B_OK
|| code != B_OK) {
printf("DEBUG: Couldn't initialize global fonts!\n");
return;
}
char type[B_OS_NAME_LENGTH];
while (link.ReadString(type, sizeof(type)) >= B_OK && type[0]) {
BFont dummy;
BFont* font = &dummy;
if (!strcmp(type, "plain"))
font = &sPlainFont;
else if (!strcmp(type, "bold"))
font = &sBoldFont;
else if (!strcmp(type, "fixed"))
font = &sFixedFont;
link.Read<uint16>(&font->fFamilyID);
link.Read<uint16>(&font->fStyleID);
link.Read<float>(&font->fSize);
link.Read<uint16>(&font->fFace);
link.Read<uint32>(&font->fFlags);
font->fHeight.ascent = kUninitializedAscent;
font->fExtraFlags = kUninitializedExtraFlags;
}
}
示例9: if
/*! \brief Initializes the bitmap.
\param bounds The bitmap dimensions.
\param colorSpace The bitmap's color space.
\param flags Creation flags.
\param bytesPerRow The number of bytes per row the bitmap should use.
\c B_ANY_BYTES_PER_ROW to let the constructor choose an appropriate
value.
\param screenID ???
*/
void
BBitmap::_InitObject(BRect bounds, color_space colorSpace, uint32 flags,
int32 bytesPerRow, screen_id screenID)
{
//printf("BBitmap::InitObject(bounds: BRect(%.1f, %.1f, %.1f, %.1f), format: %ld, flags: %ld, bpr: %ld\n",
// bounds.left, bounds.top, bounds.right, bounds.bottom, colorSpace, flags, bytesPerRow);
// TODO: Should we handle rounding of the "bounds" here? How does R5 behave?
status_t error = B_OK;
#ifdef RUN_WITHOUT_APP_SERVER
flags |= B_BITMAP_NO_SERVER_LINK;
#endif // RUN_WITHOUT_APP_SERVER
_CleanUp();
// check params
if (!bounds.IsValid() || !bitmaps_support_space(colorSpace, NULL)) {
error = B_BAD_VALUE;
} else {
// bounds is in floats and might be valid but much larger than what we
// can handle the size could not be expressed in int32
double realSize = bounds.Width() * bounds.Height();
if (realSize > (double)(INT_MAX / 4)) {
fprintf(stderr, "bitmap bounds is much too large: "
"BRect(%.1f, %.1f, %.1f, %.1f)\n",
bounds.left, bounds.top, bounds.right, bounds.bottom);
error = B_BAD_VALUE;
}
}
if (error == B_OK) {
int32 bpr = get_bytes_per_row(colorSpace, bounds.IntegerWidth() + 1);
if (bytesPerRow < 0)
bytesPerRow = bpr;
else if (bytesPerRow < bpr)
// NOTE: How does R5 behave?
error = B_BAD_VALUE;
}
// allocate the bitmap buffer
if (error == B_OK) {
// TODO: Let the app_server return the size when it allocated the bitmap
int32 size = bytesPerRow * (bounds.IntegerHeight() + 1);
if ((flags & B_BITMAP_NO_SERVER_LINK) != 0) {
fBasePointer = (uint8*)malloc(size);
if (fBasePointer) {
fSize = size;
fColorSpace = colorSpace;
fBounds = bounds;
fBytesPerRow = bytesPerRow;
fFlags = flags;
} else
error = B_NO_MEMORY;
} else {
// Ask the server (via our owning application) to create a bitmap.
BPrivate::AppServerLink link;
// Attach Data:
// 1) BRect bounds
// 2) color_space space
// 3) int32 bitmap_flags
// 4) int32 bytes_per_row
// 5) int32 screen_id::id
link.StartMessage(AS_CREATE_BITMAP);
link.Attach<BRect>(bounds);
link.Attach<color_space>(colorSpace);
link.Attach<uint32>(flags);
link.Attach<int32>(bytesPerRow);
link.Attach<int32>(screenID.id);
if (link.FlushWithReply(error) == B_OK && error == B_OK) {
// server side success
// Get token
link.Read<int32>(&fServerToken);
uint8 allocationFlags;
link.Read<uint8>(&allocationFlags);
link.Read<area_id>(&fServerArea);
link.Read<int32>(&fAreaOffset);
BPrivate::ServerMemoryAllocator* allocator
= BApplication::Private::ServerAllocator();
if ((allocationFlags & kNewAllocatorArea) != 0) {
error = allocator->AddArea(fServerArea, fArea,
fBasePointer, size);
} else {
error = allocator->AreaAndBaseFor(fServerArea, fArea,
fBasePointer);
if (error == B_OK)
//.........这里部分代码省略.........
示例10: 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;
}