8#ifndef INCLUDED_BSLSTL_OSTRINGSTREAM
9#define INCLUDED_BSLSTL_OSTRINGSTREAM
137#include <bslscm_version.h>
159#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
172template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
175 ,
public std::basic_ostream<CHAR_TYPE, CHAR_TRAITS> {
184 typedef std::basic_ostream<CHAR_TYPE, CHAR_TRAITS> BaseStream;
185 typedef std::ios_base ios_base;
187 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
231 ios_base::openmode modeBitMask,
236 BloombergLP::bslmf::MovableRef<StringType> initialString);
238 BloombergLP::bslmf::MovableRef<StringType> initialString,
241 BloombergLP::bslmf::MovableRef<StringType> initialString,
242 ios_base::openmode modeBitMask);
254 BloombergLP::bslmf::MovableRef<StringType> initialString,
255 ios_base::openmode modeBitMask,
271 template <
class SALLOC>
302 template <
class SALLOC>
306 ios_base::openmode modeBitMask,
312 modeBitMask | ios_base::out,
318#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
333#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
347 void str(BloombergLP::bslmf::MovableRef<StringType> value);
348 template <
class SALLOC>
356#ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
362#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
382 StreamBufType *
rdbuf() const;
384#ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
385 StringType
str() const &;
387 StringType
str()
const;
392#ifndef BSLS_PLATFORM_CMP_SUN
400 template <
class SALLOC>
402 bsl::IsStdAllocator<SALLOC>::value,
406 return this->
rdbuf()->
str(allocator);
416#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY) \
417 && defined(BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE)
422template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
439template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
441 bsl::basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR> >
459template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
468template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
478template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
488template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
492 ios_base::openmode modeBitMask,
499template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
503:
BaseType(MoveUtil::move(initialString), ios_base::out)
508template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
518template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
522 ios_base::openmode modeBitMask)
523:
BaseType(MoveUtil::move(initialString), modeBitMask | ios_base::out)
528template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
532 ios_base::openmode modeBitMask,
534:
BaseType(MoveUtil::move(initialString),
535 modeBitMask | ios_base::out,
541#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
542template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
546: BaseType(
std::move(original))
547, BaseStream(
std::move(original))
552template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
554basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>::
555basic_ostringstream(basic_ostringstream&& original,
556 const allocator_type& allocator)
557: BaseType(
std::move(original), allocator)
558, BaseStream(
std::move(original))
565#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE
566template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
568basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>&
569basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>::
570operator=(basic_ostringstream&& rhs)
572 this->BaseType::operator=(std::move(rhs));
573 this->BaseStream::operator=(std::move(rhs));
579template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
584 this->rdbuf()->str(value);
587template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
590 BloombergLP::bslmf::MovableRef<StringType> value)
592 this->rdbuf()->str(MoveUtil::move(value));
595#ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
596template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
601 return std::move(*this->rdbuf()).str();
605#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY
606template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
614 this->BaseType::swap(other);
615 this->BaseStream::swap(other);
620template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
626 return rdbuf()->get_allocator();
629template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
635 return this->BaseType::rdbuf();
638#ifdef BSLS_COMPILERFEATURES_SUPPORT_REF_QUALIFIERS
639template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
644 return this->rdbuf()->str();
647template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
649typename basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>::StringType
652 return this->rdbuf()->str();
656template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
662 return this->rdbuf()->view();
668#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY) \
669 && defined(BSLS_LIBRARYFEATURES_HAS_CPP11_STREAM_MOVE)
670template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
671void bsl::swap(basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& a,
672 basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& b)
674 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
676 if (a.get_allocator() == b.get_allocator()
681 basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR> aCopy(
684 basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR> bCopy(
Definition bslstl_stringbuf.h:746
StreamBufType * rdbuf() const
Definition bslstl_stringbuf.h:864
Definition bslma_bslallocator.h:580
Definition bslstl_ostringstream.h:175
ALLOCATOR allocator_type
Definition bslstl_ostringstream.h:198
traits_type::pos_type pos_type
Definition bslstl_ostringstream.h:201
CHAR_TYPE char_type
Definition bslstl_ostringstream.h:196
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Return the allocator used by the underlying buffer to supply memory.
Definition bslstl_ostringstream.h:623
StringType str() const
Definition bslstl_ostringstream.h:650
bsl::enable_if< bsl::IsStdAllocator< SALLOC >::value, basic_string< CHAR_TYPE, CHAR_TRAITS, SALLOC > >::type str(const SALLOC &allocator) const
Definition bslstl_ostringstream.h:404
ViewType view() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_ostringstream.h:659
basic_ostringstream(const bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, SALLOC > &initialString, const allocator_type &allocator=allocator_type(), typename bsl::enable_if< !bsl::is_same< ALLOCATOR, SALLOC >::value, void * >::type=0)
Definition bslstl_ostringstream.h:272
traits_type::off_type off_type
Definition bslstl_ostringstream.h:200
void swap(basic_ostringstream &other)
Definition bslstl_ostringstream.h:608
~basic_ostringstream()=default
bsl::enable_if<!bsl::is_same< ALLOCATOR, SALLOC >::value, void >::type str(const basic_string< CHAR_TYPE, CHAR_TRAITS, SALLOC > &value)
Definition bslstl_ostringstream.h:351
StreamBufType * rdbuf() const
Definition bslstl_ostringstream.h:633
traits_type::int_type int_type
Definition bslstl_ostringstream.h:199
basic_ostringstream(const bsl::basic_string< CHAR_TYPE, CHAR_TRAITS, SALLOC > &initialString, ios_base::openmode modeBitMask, const allocator_type &allocator=allocator_type(), typename bsl::enable_if< !bsl::is_same< ALLOCATOR, SALLOC >::value, void * >::type=0)
Definition bslstl_ostringstream.h:303
CHAR_TRAITS traits_type
Definition bslstl_ostringstream.h:197
Definition bslstl_stringview.h:441
Definition bslstl_string.h:1281
Definition bslstl_stringbuf.h:245
void str(const StringType &value)
Definition bslstl_stringbuf.h:1538
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
void swap(OptionValue &a, OptionValue &b)
Definition bdlb_printmethods.h:283
basic_ostringstream< wchar_t, char_traits< wchar_t >, allocator< wchar_t > > wostringstream
Definition bslstl_iosfwd.h:104
T::iterator begin(T &container)
Definition bslstl_iterator.h:1495
T::iterator end(T &container)
Definition bslstl_iterator.h:1523
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
Definition bslstl_iosfwd.h:95
Definition balxml_encoderoptions.h:68
Definition bdldfp_decimal.h:5188
Definition bslma_allocatortraits.h:1061
Definition bslmf_enableif.h:525
Definition bslmf_issame.h:146
Definition bslma_usesbslmaallocator.h:343