BloombergLP::bdlsb::MemOutStreamBuf

This class implements the output functionality of the basic_streambuf protocol, using a user-supplied or default bslma allocator to supply memory.

Synopsis

Declared in <bdlsb_memoutstreambuf.h>

class MemOutStreamBuf
    : public std::streambuf

Base Classes

NameDescription
std::streambuf

Member Functions

NameDescription
MemOutStreamBuf [constructor]Create an empty stream buffer. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.
MemOutStreamBuf [constructor]Create an empty stream buffer with sufficient initial capacity to accommodate up to the specified numElements characters without subsequent reallocation. If numElements == 0, an implementation-defined initial capacity is used. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.
~MemOutStreamBuf [destructor] [virtual]Destroy this stream buffer.
capacity Return the current capacity of the buffer managed by this stream buffer.
data Return the address of the non-modifiable character buffer managed by this stream buffer.
length Return the number of valid characters in this stream buffer.
reserveCapacity Reserve sufficient internal capacity to store at least the specified numCharacters characters without reallocation. Note that if the storage size specified is less than the number of characters already in the buffer, this method has no effect.
reset Destroy the contents of this stream buffer, return all allocated memory to the allocator, and reset the buffer to the default constructed state. Note that length() == 0 holds following a call to this method.
operator BloombergLP::bslmf::NestedTraitDeclaration<MemOutStreamBuf, UsesBslmaAllocator> Declare MemOutStreamBuf as using a bslma allocator.

Protected Member Functions

NameDescription
overflow [virtual]Append the optionally specified insertionChar to this stream buffer's character buffer and return insertionChar. If insertionChar is not specified, traits_type::eof() is appended instead.
seekoff [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::out or if the resulting absolute position is less than zero or greater then length().
seekpos [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 length().
xsputn [virtual]Write the specified numChars characters from the specified source to the stream buffer. Return the number of characters successfully written. The behavior is undefined unless '(source && 0 < numChars) || 0 == numChars'.