8#ifndef INCLUDED_BSLIM_FORMATGUARD
9#define INCLUDED_BSLIM_FORMATGUARD
108#include <bslscm_version.h>
116#include <bsl_ostream.h>
136 bsl::ios_base *
const d_iosBase_p;
138 const bsl::ios_base::fmtflags d_flags;
140 const bsl::streamsize d_precision;
144 const DestructorImpl_p d_destructorImpl_p;
158 template <
class CHAR_TYPE,
class CHAR_TRAITS>
159 void ostreamDestructorImpl();
166 template <
class CHAR_TYPE,
class CHAR_TRAITS>
168 FormatGuard(bsl::basic_ostream<CHAR_TYPE, CHAR_TRAITS> *stream);
180template <
class CHAR_TYPE,
class CHAR_TRAITS>
181void FormatGuard::ostreamDestructorImpl()
189 typedef bsl::basic_ios<CHAR_TYPE, CHAR_TRAITS> BasicIos;
191 BasicIos *basicIos_p =
static_cast<BasicIos *
>(d_iosBase_p);
193 basicIos_p->flags(d_flags);
194 basicIos_p->precision(d_precision);
195 basicIos_p->fill(
static_cast<CHAR_TYPE
>(d_fillChar));
199template <
class CHAR_TYPE,
class CHAR_TRAITS>
201FormatGuard::FormatGuard(bsl::basic_ostream<CHAR_TYPE, CHAR_TRAITS> *stream)
203, d_flags(stream->flags())
204, d_precision(stream->precision())
205, d_fillChar(stream->fill())
207 &
FormatGuard::ostreamDestructorImpl<CHAR_TYPE, CHAR_TRAITS>)
217 (this->*d_destructorImpl_p)();
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:609
Definition bslim_formatguard.h:120
Definition bslmf_isintegral.h:130
long long Int64
Definition bsls_types.h:132