Quick Links:

bal | bbl | bdl | bsl

Public Member Functions | Protected Member Functions

bdlsb::FixedMemOutStreamBuf Class Reference

#include <bdlsb_fixedmemoutstreambuf.h>

List of all members.

Public Member Functions

 FixedMemOutStreamBuf (char *buffer, bsl::streamsize length)
 ~FixedMemOutStreamBuf ()
char * data ()
bsl::streamsize capacity () const
const char * data () const
bsl::streamsize length () const

Protected Member Functions

virtual pos_type seekoff (off_type offset, bsl::ios_base::seekdir fixedPosition, bsl::ios_base::openmode which=bsl::ios_base::out)
virtual pos_type seekpos (pos_type position, bsl::ios_base::openmode which=bsl::ios_base::out)
virtual FixedMemOutStreamBufsetbuf (char_type *buffer, bsl::streamsize length)

Detailed Description

This class implements the output functionality of the basic_streambuf protocol for client-supplied memory.

See Component bdlsb_fixedmemoutstreambuf


Constructor & Destructor Documentation

bdlsb::FixedMemOutStreamBuf::FixedMemOutStreamBuf ( char *  buffer,
bsl::streamsize  length 
)

Create an empty stream buffer that uses the specified character buffer of the specified length. The behavior is undefined unless length == 0 or length > 0 && buffer != 0. Note that buffer is held but not owned.

bdlsb::FixedMemOutStreamBuf::~FixedMemOutStreamBuf (  ) 

Destroy this stream buffer.


Member Function Documentation

virtual pos_type bdlsb::FixedMemOutStreamBuf::seekoff ( off_type  offset,
bsl::ios_base::seekdir  fixedPosition,
bsl::ios_base::openmode  which = bsl::ios_base::out 
) [protected, virtual]

Set the position indicator to the relative specified offset from the base position indicated by the specified fixedPosition 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::out or if the resulting absolute position is less than zero or greater than the value returned by length.

virtual pos_type bdlsb::FixedMemOutStreamBuf::seekpos ( pos_type  position,
bsl::ios_base::openmode  which = bsl::ios_base::out 
) [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::out or if position is less then zero or greater than the value returned by length.

virtual FixedMemOutStreamBuf* bdlsb::FixedMemOutStreamBuf::setbuf ( char_type *  buffer,
bsl::streamsize  length 
) [protected, virtual]

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 length == 0 or length > 0 && buffer != 0. Upon re-initialization for use of the new buffer, the length and next output location are reset to zero. Note that buffer is held but not owned.

char* bdlsb::FixedMemOutStreamBuf::data (  ) 

Return a pointer providing modifiable access to the character buffer held by this stream buffer (supplied at construction).

bsl::streamsize bdlsb::FixedMemOutStreamBuf::capacity (  )  const

Return the number of characters in the buffer held by this stream buffer. See length, below, for the span of bytes actually written.

const char* bdlsb::FixedMemOutStreamBuf::data (  )  const

Return a pointer providing non-modifiable access to the character buffer held by this stream buffer (supplied at construction).

bsl::streamsize bdlsb::FixedMemOutStreamBuf::length (  )  const

Return the number of characters from the beginning of the buffer to the current write position. This function returns the same value as seekoff(0, bsl::ios_base::end). The length is modified by a call to seekpos or seekoff and reset to zero by a call to pubsetbuf.


The documentation for this class was generated from the following file: