BDE 4.14.0 Production release
|
#include <bslstl_syncbuf.h>
Public Types | |
typedef CHAR_TYPE | char_type |
typedef CHAR_TRAITS::int_type | int_type |
typedef CHAR_TRAITS::pos_type | pos_type |
typedef CHAR_TRAITS::off_type | off_type |
typedef CHAR_TRAITS | traits_type |
typedef ALLOCATOR | allocator_type |
typedef std::basic_streambuf< CHAR_TYPE, CHAR_TRAITS > | streambuf_type |
Public Member Functions | |
basic_syncbuf (const ALLOCATOR &allocator=ALLOCATOR()) | |
basic_syncbuf (streambuf_type *wrapped, const ALLOCATOR &allocator=ALLOCATOR()) | |
~basic_syncbuf () BSLS_KEYWORD_OVERRIDE | |
Call emit . Any exceptions thrown by emit are ignored. | |
bool | emit () |
void | set_emit_on_sync (bool value) BSLS_KEYWORD_NOEXCEPT |
allocator_type | get_allocator () const BSLS_KEYWORD_NOEXCEPT |
Return the allocator used to supply memory. | |
streambuf_type * | get_wrapped () const BSLS_KEYWORD_NOEXCEPT |
Return the wrapped buffer supplied at construction. | |
Protected Member Functions | |
int_type | overflow (int_type character=traits_type::eof()) BSLS_KEYWORD_OVERRIDE |
int | sync () BSLS_KEYWORD_OVERRIDE |
std::streamsize | xsputn (const char_type *inputString, std::streamsize count) BSLS_KEYWORD_OVERRIDE |
This class implements a standard stream buffer providing an internal buffer to accumulate the written data in order to atomically transmit its entire contents to the wrapped buffer on destruction (or emit
call).
typedef ALLOCATOR bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::allocator_type |
typedef CHAR_TYPE bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::char_type |
typedef CHAR_TRAITS::int_type bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::int_type |
typedef CHAR_TRAITS::off_type bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::off_type |
typedef CHAR_TRAITS::pos_type bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::pos_type |
typedef std::basic_streambuf<CHAR_TYPE, CHAR_TRAITS> bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::streambuf_type |
typedef CHAR_TRAITS bsl::basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR >::traits_type |
|
explicit |
Create a basic_syncbuf object without a wrapped buffer. Optionally specify an allocator
used to supply memory.
|
explicit |
Create a basic_syncbuf object. Set the specified wrapped
as a wrapped buffer. Optionally specify an allocator
used to supply memory.
bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::~basic_syncbuf | ( | ) |
bool bsl::basic_syncbuf< CHAR, TRAITS, ALLOCATOR >::emit | ( | ) |
Atomically transfer any characters buffered by this object to the wrapped stream buffer, so that it appears in the output stream as a contiguous sequence of characters. The wrapped stream buffer is flushed if and only if a call was made to sync
since the most recent call to emit
or construction. Return true
if get_wrapped() != nullptr
, and all of the characters in the associated output were successfully transferred, and the flush (if any) succeeded; return false
otherwise.
|
inline |
|
inline |
|
protected |
|
inline |
Call the emit
function by each sync
call if the specified value
is true
.
|
protected |
Request the wrapped streambuf flush on the next emit
call, then call emit
if the "emit-on-sync" flag is true
. Return 0 on success and -1 if the emit
call has failed.
|
protected |
Write the specified inputString
array of the specified count
characters to the internal buffer. Return the number of characters successfully written.