本文整理汇总了C++中OutStream::tailroom方法的典型用法代码示例。如果您正苦于以下问题:C++ OutStream::tailroom方法的具体用法?C++ OutStream::tailroom怎么用?C++ OutStream::tailroom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutStream
的用法示例。
在下文中一共展示了OutStream::tailroom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_compressed_data
void get_compressed_data(OutStream & stream) const override
{
if (stream.tailroom() <
static_cast<size_t>(2) + // Level1ComprFlags(1) + Level2ComprFlags(1)
this->bytes_in_output_buffer) {
LOG(LOG_ERR, "rdp_mppc_61_enc::get_compressed_data: Buffer too small");
throw Error(ERR_BUFFER_TOO_SMALL);
}
stream.out_uint8(this->Level1ComprFlags);
stream.out_uint8(this->Level2ComprFlags);
stream.out_copy_bytes(this->outputBuffer, this->bytes_in_output_buffer);
}
示例2: emit
void emit(OutStream & stream) const {
unsigned expected;
if ( (this->flags & BITMAP_COMPRESSION)
&& !(this->flags & NO_BITMAP_COMPRESSION_HDR)) {
expected = 26; /* destLeft(2) + destTop(2) + destRight(2) +
destBottom(2) + width(2) + height(2) +
bitsPerPixel(2) + flags(2) + bitmapLength(2) +
cbCompFirstRowSize(2) + cbCompMainBodySize(2) +
cbScanWidth(2) + cbUncompressedSize(2) */
}
else {
expected = 18; /* destLeft(2) + destTop(2) + destRight(2) +
destBottom(2) + width(2) + height(2) +
bitsPerPixel(2) + flags(2) + bitmapLength(2) */
}
if (!stream.has_room(expected)) {
LOG( LOG_ERR
, "BitmapData::emit - stream too small, need=%u, remains=%zu"
, expected, stream.tailroom());
throw Error(ERR_STREAM_MEMORY_TOO_SMALL);
}
stream.out_uint16_le(this->dest_left);
stream.out_uint16_le(this->dest_top);
stream.out_uint16_le(this->dest_right);
stream.out_uint16_le(this->dest_bottom);
stream.out_uint16_le(this->width);
stream.out_uint16_le(this->height);
stream.out_uint16_le(this->bits_per_pixel);
stream.out_uint16_le(this->flags);
stream.out_uint16_le(this->bitmap_length);
if ( (this->flags & BITMAP_COMPRESSION)
&& !(this->flags & NO_BITMAP_COMPRESSION_HDR)) {
stream.out_uint16_le(0x0000); /* cbCompFirstRowSize (2 bytes) */
stream.out_uint16_le(this->cb_comp_main_body_size);
stream.out_uint16_le(this->cb_scan_width);
stream.out_uint16_le(this->cb_uncompressed_size);
}
}