#include <bdlsb_memoutstreambuf.h>
This class implements the output functionality of the basic_streambuf protocol, using a user-supplied or default bslma allocator to supply memory.
See bdlsb_memoutstreambuf
◆ MemOutStreamBuf() [1/2]
| bdlsb::MemOutStreamBuf::MemOutStreamBuf |
( |
bslma::Allocator * |
basicAllocator = 0 | ) |
|
|
inlineexplicit |
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() [2/2]
| bdlsb::MemOutStreamBuf::MemOutStreamBuf |
( |
bsl::size_t |
numElements, |
|
|
bslma::Allocator * |
basicAllocator = 0 |
|
) |
| |
|
inlineexplicit |
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()
| bdlsb::MemOutStreamBuf::~MemOutStreamBuf |
( |
| ) |
|
|
inline |
Destroy this stream buffer.
◆ BSLMF_NESTED_TRAIT_DECLARATION()
◆ capacity()
| bsl::size_t bdlsb::MemOutStreamBuf::capacity |
( |
| ) |
const |
|
inline |
Return the current capacity of the buffer managed by this stream buffer.
◆ data()
| const char * bdlsb::MemOutStreamBuf::data |
( |
| ) |
const |
|
inline |
Return the address of the non-modifiable character buffer managed by this stream buffer.
◆ length()
| bsl::size_t bdlsb::MemOutStreamBuf::length |
( |
| ) |
const |
|
inline |
Return the number of valid characters in this stream buffer.
◆ overflow()
| int_type bdlsb::MemOutStreamBuf::overflow |
( |
int_type |
insertionChar = bsl::streambuf::traits_type::eof() | ) |
|
|
protected |
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.
◆ reserveCapacity()
| void bdlsb::MemOutStreamBuf::reserveCapacity |
( |
bsl::size_t |
numCharacters | ) |
|
Reserve sufficient internal capacity to store at least the specified numCharacters characters without reallocation.
- Note
- Note that if the storage size specified is less than the number of characters already in the buffer, this method has no effect.
◆ reset()
| void bdlsb::MemOutStreamBuf::reset |
( |
| ) |
|
|
inline |
Destroy the contents of this stream buffer, return all allocated memory to the allocator, and reset the buffer to the default constructed state.
- Note
- Note that
length() == 0 holds following a call to this method.
◆ seekoff()
| pos_type bdlsb::MemOutStreamBuf::seekoff |
( |
off_type |
offset, |
|
|
bsl::ios_base::seekdir |
way, |
|
|
bsl::ios_base::openmode |
which = bsl::ios_base::in|bsl::ios_base::out |
|
) |
| |
|
protected |
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()
| pos_type bdlsb::MemOutStreamBuf::seekpos |
( |
pos_type |
position, |
|
|
bsl::ios_base::openmode |
which = bsl::ios_base::in|bsl::ios_base::out |
|
) |
| |
|
protected |
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()
| bsl::streamsize bdlsb::MemOutStreamBuf::xsputn |
( |
const char_type * |
source, |
|
|
bsl::streamsize |
numChars |
|
) |
| |
|
protected |
Write the specified numChars characters from the specified source to the stream buffer. Return the number of characters successfully written.
- Precondition
- The behavior is undefined unless '(source && 0 < numChars) || 0 == numChars'.
The documentation for this class was generated from the following file: