Quick Links: |
#include <bdlsb_fixedmeminstreambuf.h>
Public Member Functions | |
FixedMemInStreamBuf (const char *buffer, bsl::size_t length) | |
~FixedMemInStreamBuf () | |
FixedMemInStreamBuf * | pubsetbuf (char *buffer, bsl::streamsize length) |
FixedMemInStreamBuf * | pubsetbuf (const char *buffer, bsl::streamsize length) |
const char * | data () const |
bsl::size_t | length () const |
Protected Member Functions | |
virtual pos_type | seekoff (off_type offset, bsl::ios_base::seekdir way, bsl::ios_base::openmode which=bsl::ios_base::in) |
virtual pos_type | seekpos (pos_type position, bsl::ios_base::openmode which=bsl::ios_base::in) |
virtual FixedMemInStreamBuf * | setbuf (char *buffer, bsl::streamsize length) |
FixedMemInStreamBuf * | setbuf (const char *buffer, bsl::streamsize length) |
virtual bsl::streamsize | showmanyc () |
virtual bsl::streamsize | xsgetn (char_type *destination, bsl::streamsize length) |
This class implements the input functionality of the basic_streambuf
protocol, using client-supplied char *
memory.
See Component bdlsb_fixedmeminstreambuf
bdlsb::FixedMemInStreamBuf::FixedMemInStreamBuf | ( | const char * | buffer, | |
bsl::size_t | length | |||
) |
Create a FixedMemInStreamBuf
that provides access to the character sequence in the specified buffer
of the specified length
. The behavior is undefined unless buffer != 0 && length > 0
or length == 0
.
bdlsb::FixedMemInStreamBuf::~FixedMemInStreamBuf | ( | ) |
Destroy this stream buffer.
virtual pos_type bdlsb::FixedMemInStreamBuf::seekoff | ( | off_type | offset, | |
bsl::ios_base::seekdir | way, | |||
bsl::ios_base::openmode | which = bsl::ios_base::in | |||
) | [protected, virtual] |
Set the position indicator to the relative specified offset
from the base position indicated by the specified way
and return the resulting absolute position on success or pos_type(-1) on failure. Optionally specify which
area of the stream buffer. The seek operation will fail if which
does not include the flag bsl::ios_base::in
or if the resulting absolute position is less than zero or greater than the value returned by length
.
virtual pos_type bdlsb::FixedMemInStreamBuf::seekpos | ( | pos_type | position, | |
bsl::ios_base::openmode | which = bsl::ios_base::in | |||
) | [protected, virtual] |
Set the position indicator to the specified position
and return the resulting absolute position on success or pos_type(-1) on failure. Optionally specify which
area of the stream buffer. The seekpos
operation will fail if which
does not include the flag bsl::ios_base::in
or if position is less then zero or greater than the value returned by length
.
virtual FixedMemInStreamBuf* bdlsb::FixedMemInStreamBuf::setbuf | ( | char * | buffer, | |
bsl::streamsize | length | |||
) | [protected, virtual] |
FixedMemInStreamBuf* bdlsb::FixedMemInStreamBuf::setbuf | ( | const char * | buffer, | |
bsl::streamsize | length | |||
) | [protected] |
Reinitialize this stream buffer to use the specified character buffer
having the specified length
. Return the pointer providing modifiable access to this stream buffer. The behavior is undefined unless buffer != 0 && length > 0
or length == 0
. Upon re-initialization for use of the new buffer, neither the content nor the next input position indicator are preserved. Note that buffer
is held but not owned.
virtual bsl::streamsize bdlsb::FixedMemInStreamBuf::showmanyc | ( | ) | [protected, virtual] |
Return the number of characters currently available for reading from this stream buffer, or -1 if there are none.
virtual bsl::streamsize bdlsb::FixedMemInStreamBuf::xsgetn | ( | char_type * | destination, | |
bsl::streamsize | length | |||
) | [protected, virtual] |
Read the specified length
number of characters into the specified destination
. Return the number of characters successfully read. The behavior is undefined unless 0 <= length
.
FixedMemInStreamBuf* bdlsb::FixedMemInStreamBuf::pubsetbuf | ( | char * | buffer, | |
bsl::streamsize | length | |||
) |
FixedMemInStreamBuf* bdlsb::FixedMemInStreamBuf::pubsetbuf | ( | const char * | buffer, | |
bsl::streamsize | length | |||
) |
Reinitialize this stream buffer to use the specified character buffer
having the specified length
. Return the address of this modifiable stream buffer. The behavior is undefined unless buffer != 0 && length > 0
or length == 0
. Upon reinitialization for use of the new buffer, neither the content nor the next input position indicator is preserved. Note that buffer
is held but not owned.
const char* bdlsb::FixedMemInStreamBuf::data | ( | ) | const |
Return the address of the non-modifiable character buffer held by this stream buffer.
bsl::size_t bdlsb::FixedMemInStreamBuf::length | ( | ) | const |
Return the number of characters from the current input position to the end of the stream buffer. The function returns the same value as seekoff(0, bsl::ios_base::beg)
. The length is modified by a call to seekpos
, seekoff
or by reading characters from the buffer.