BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlsb::FixedMemOutput Class Reference

#include <bdlsb_fixedmemoutput.h>

Public Types

typedef char char_type
 
typedef bsl::char_traits< char >::int_type int_type
 
typedef bsl::char_traits< char >::pos_type pos_type
 
typedef bsl::char_traits< char >::off_type off_type
 
typedef bsl::char_traits< char > traits_type
 

Public Member Functions

 FixedMemOutput (char *buffer, bsl::streamsize length)
 
 ~FixedMemOutput ()=default
 Destroy this object.
 
char * data ()
 
bsl::locale pubimbue (const bsl::locale &loc)
 
FixedMemOutputpubsetbuf (char *buffer, bsl::streamsize length)
 
pos_type pubseekoff (off_type offset, bsl::ios_base::seekdir fixedPosition, bsl::ios_base::openmode which=bsl::ios_base::in|bsl::ios_base::out)
 
pos_type pubseekpos (pos_type position, bsl::ios_base::openmode which=bsl::ios_base::in|bsl::ios_base::out)
 
int pubsync ()
 
int_type sputc (char c)
 
bsl::streamsize sputn (const char *s, bsl::streamsize length)
 
bsl::streamsize capacity () const
 Return the size in bytes of the buffer held by this stream buffer.
 
const char * data () const
 
bsl::streamsize length () const
 
bsl::locale getloc () const
 

Detailed Description

This class, like bdlsb::FixedMemOutStreamBuf, implements the output functionality of the basic_streambuf interface, using client-supplied char * memory. It has an identical interface to bdlsb::FixedMemOutStreamBuf but does not inherit from bsl::streambuf. Thus, it is suitable for use as template parameter to bslx::GenericOutStream (but not to bslx::StreambufOutStream). Note that this class is not designed to be derived from.

See bdlsb_fixedmemoutput

Member Typedef Documentation

◆ char_type

◆ int_type

typedef bsl::char_traits<char>::int_type bdlsb::FixedMemOutput::int_type

◆ off_type

typedef bsl::char_traits<char>::off_type bdlsb::FixedMemOutput::off_type

◆ pos_type

typedef bsl::char_traits<char>::pos_type bdlsb::FixedMemOutput::pos_type

◆ traits_type

typedef bsl::char_traits<char> bdlsb::FixedMemOutput::traits_type

Constructor & Destructor Documentation

◆ FixedMemOutput()

bdlsb::FixedMemOutput::FixedMemOutput ( char *  buffer,
bsl::streamsize  length 
)
inline

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.

◆ ~FixedMemOutput()

bdlsb::FixedMemOutput::~FixedMemOutput ( )
default

Member Function Documentation

◆ capacity()

bsl::streamsize bdlsb::FixedMemOutput::capacity ( ) const
inline

◆ data() [1/2]

char * bdlsb::FixedMemOutput::data ( )
inline

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

◆ data() [2/2]

const char * bdlsb::FixedMemOutput::data ( ) const
inline

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

◆ getloc()

bsl::locale bdlsb::FixedMemOutput::getloc ( ) const
inline

Return the current default locale. Operation has no effect, because locales are not supported by this component. Return default constructed bsl::locale object.

◆ length()

bsl::streamsize bdlsb::FixedMemOutput::length ( ) const
inline

Return the number of characters from the beginning of the buffer to the current write position.

◆ pubimbue()

bsl::locale bdlsb::FixedMemOutput::pubimbue ( const bsl::locale &  loc)
inline

Associate the specified locale loc to this stream buffer. Operation has no effect, because locales are not supported by this component. Return default constructed bsl::locale object.

◆ pubseekoff()

pos_type bdlsb::FixedMemOutput::pubseekoff ( off_type  offset,
bsl::ios_base::seekdir  fixedPosition,
bsl::ios_base::openmode  which = bsl::ios_base::in|bsl::ios_base::out 
)

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.

◆ pubseekpos()

pos_type bdlsb::FixedMemOutput::pubseekpos ( pos_type  position,
bsl::ios_base::openmode  which = bsl::ios_base::in|bsl::ios_base::out 
)

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.

◆ pubsetbuf()

FixedMemOutput * bdlsb::FixedMemOutput::pubsetbuf ( char *  buffer,
bsl::streamsize  length 
)
inline

Reset the internal buffer of this stream to the specified buffer of the specified length. Note that the next write operation will start at the beginning of buffer.

◆ pubsync()

int bdlsb::FixedMemOutput::pubsync ( )
inline

Synchronizes the controlled character sequence (the buffers) with the associated character sequence. Operation has no effect, because the stream is always kept in sync (no buffered output). Return 0.

◆ sputc()

FixedMemOutput::int_type bdlsb::FixedMemOutput::sputc ( char  c)
inline

Write the specified character c to this buffer. Return c, or traits_type::eof() if the end of the write buffer is reached.

◆ sputn()

bsl::streamsize bdlsb::FixedMemOutput::sputn ( const char *  s,
bsl::streamsize  length 
)
inline

Write the specified length characters at the specified address s to this buffer. Return the number of characters written, which is either length or the distance from the current write position to the end of the write buffer, whichever is smaller, and move the write cursor position by this amount.


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