8#ifndef INCLUDED_BSLSTL_OSYNCSTREAM
9#define INCLUDED_BSLSTL_OSYNCSTREAM
130#include <bslscm_version.h>
139#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
155template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
159 typedef std::basic_ostream<CHAR_TYPE, CHAR_TRAITS> Base;
190 const ALLOCATOR&
allocator = ALLOCATOR());
202 std::basic_ostream<CHAR_TYPE, CHAR_TRAITS>& stream,
203 const ALLOCATOR&
allocator = ALLOCATOR());
208#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
221#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
259template <class CHAR, class TRAITS, class ALLOCATOR>
264#ifndef BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD
273#ifdef BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD
274 this->init(&d_syncbuf);
278template <
class CHAR,
class TRAITS,
class ALLOCATOR>
280 std::basic_ostream<CHAR,TRAITS>& stream,
283#ifndef BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD
288#ifdef BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD
289 this->init(&d_syncbuf);
293#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
294template <
class CHAR,
class TRAITS,
class ALLOCATOR>
297: Base(std::move(original))
298, d_syncbuf(std::move(original.d_syncbuf))
300 this->set_rdbuf(&d_syncbuf);
303template <
class CHAR,
class TRAITS,
class ALLOCATOR>
305 basic_osyncstream&& original,
307: Base(std::move(original))
308, d_syncbuf(std::move(original.d_syncbuf), allocator)
310 this->set_rdbuf(&d_syncbuf);
315template <
class CHAR,
class TRAITS,
class ALLOCATOR>
318 typename Base::sentry ok(*
this);
320 this->setstate(ios_base::badbit);
323 if (!d_syncbuf.emit()) {
324 this->setstate(ios_base::badbit);
330template <
class CHAR,
class TRAITS,
class ALLOCATOR>
335 return d_syncbuf.get_allocator();
338template <
class CHAR,
class TRAITS,
class ALLOCATOR>
344 return d_syncbuf.get_wrapped();
347template <
class CHAR,
class TRAITS,
class ALLOCATOR>
Definition bslma_bslallocator.h:588
Definition bslstl_osyncstream.h:156
basic_syncbuf< CHAR_TYPE, CHAR_TRAITS, ALLOCATOR > syncbuf_type
Definition bslstl_osyncstream.h:171
ALLOCATOR allocator_type
Definition bslstl_osyncstream.h:168
void emit()
Definition bslstl_osyncstream.h:316
basic_osyncstream(streambuf_type *wrapped, const ALLOCATOR &allocator=ALLOCATOR())
Definition bslstl_osyncstream.h:260
streambuf_type * get_wrapped() const BSLS_KEYWORD_NOEXCEPT
Return the wrapped buffer.
Definition bslstl_osyncstream.h:341
CHAR_TRAITS::off_type off_type
Definition bslstl_osyncstream.h:166
syncbuf_type * rdbuf() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_osyncstream.h:350
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Return the allocator used to supply memory.
Definition bslstl_osyncstream.h:332
CHAR_TRAITS::int_type int_type
Definition bslstl_osyncstream.h:164
CHAR_TRAITS traits_type
Definition bslstl_osyncstream.h:167
basic_osyncstream(std::basic_ostream< CHAR_TYPE, CHAR_TRAITS > &stream, const ALLOCATOR &allocator=ALLOCATOR())
~basic_osyncstream()=default
CHAR_TYPE char_type
Definition bslstl_osyncstream.h:163
std::basic_streambuf< CHAR_TYPE, CHAR_TRAITS > streambuf_type
Definition bslstl_osyncstream.h:170
CHAR_TRAITS::pos_type pos_type
Definition bslstl_osyncstream.h:165
Definition bslstl_syncbuf.h:154
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
Definition bdlat_valuetypefunctions.h:939
basic_osyncstream< char > osyncstream
Definition bslstl_iosfwd.h:121
CHAR_TRAITS
Definition bslstl_string.h:3917
basic_osyncstream< wchar_t > wosyncstream
Definition bslstl_iosfwd.h:122