[#BloombergLP-bdlsb-MemOutStreamBuf] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlsb.adoc[bdlsb]::MemOutStreamBuf :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class MemOutStreamBuf : public std::streambuf ---- == Base Classes [cols="1,4"] |=== | Name| Description | `std::streambuf` | |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlsb/MemOutStreamBuf/2constructor-00.adoc[`MemOutStreamBuf`] [.small]#[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. | xref:BloombergLP/bdlsb/MemOutStreamBuf/2constructor-07.adoc[`MemOutStreamBuf`] [.small]#[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. | xref:BloombergLP/bdlsb/MemOutStreamBuf/2destructor.adoc[`~MemOutStreamBuf`] [.small]#[destructor]# [.small]#[virtual]# | Destroy this stream buffer. | xref:BloombergLP/bdlsb/MemOutStreamBuf/capacity.adoc[`capacity`] | Return the current capacity of the buffer managed by this stream buffer. | xref:BloombergLP/bdlsb/MemOutStreamBuf/data.adoc[`data`] | Return the address of the non‐modifiable character buffer managed by this stream buffer. | xref:BloombergLP/bdlsb/MemOutStreamBuf/length.adoc[`length`] | Return the number of valid characters in this stream buffer. | xref:BloombergLP/bdlsb/MemOutStreamBuf/reserveCapacity.adoc[`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. | xref:BloombergLP/bdlsb/MemOutStreamBuf/reset.adoc[`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. | xref:BloombergLP/bdlsb/MemOutStreamBuf/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<MemOutStreamBuf, UsesBslmaAllocator>`] | Declare `MemOutStreamBuf` as using a `bslma` allocator. |=== == Protected Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlsb/MemOutStreamBuf/overflow.adoc[`overflow`] [.small]#[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. | xref:BloombergLP/bdlsb/MemOutStreamBuf/seekoff.adoc[`seekoff`] [.small]#[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()`. | xref:BloombergLP/bdlsb/MemOutStreamBuf/seekpos.adoc[`seekpos`] [.small]#[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()`. | xref:BloombergLP/bdlsb/MemOutStreamBuf/xsputn.adoc[`xsputn`] [.small]#[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'. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#