Set boolalpha for Journal::ScopedStream

This commit is contained in:
Vinnie Falco
2013-11-04 06:58:35 -08:00
parent b560f5a474
commit a2c574fa15
2 changed files with 16 additions and 0 deletions

View File

@@ -110,6 +110,8 @@ public:
} }
private: private:
void init ();
ScopedStream& operator= (ScopedStream const&); // disallowed ScopedStream& operator= (ScopedStream const&); // disallowed
Sink& m_sink; Sink& m_sink;

View File

@@ -65,18 +65,21 @@ Journal::ScopedStream::ScopedStream (Stream const& stream)
: m_sink (stream.sink()) : m_sink (stream.sink())
, m_severity (stream.severity()) , m_severity (stream.severity())
{ {
init ();
} }
Journal::ScopedStream::ScopedStream (ScopedStream const& other) Journal::ScopedStream::ScopedStream (ScopedStream const& other)
: m_sink (other.m_sink) : m_sink (other.m_sink)
, m_severity (other.m_severity) , m_severity (other.m_severity)
{ {
init ();
} }
Journal::ScopedStream::ScopedStream (Stream const& stream, std::ostream& manip (std::ostream&)) Journal::ScopedStream::ScopedStream (Stream const& stream, std::ostream& manip (std::ostream&))
: m_sink (stream.sink()) : m_sink (stream.sink())
, m_severity (stream.severity()) , m_severity (stream.severity())
{ {
init ();
m_ostream << manip; m_ostream << manip;
} }
@@ -89,6 +92,17 @@ Journal::ScopedStream::~ScopedStream ()
} }
} }
void Journal::ScopedStream::init ()
{
// Modifiers applied from all ctors
m_ostream
<< std::boolalpha
<< std::showbase
//<< std::hex
;
}
std::ostream& Journal::ScopedStream::operator<< (std::ostream& manip (std::ostream&)) const std::ostream& Journal::ScopedStream::operator<< (std::ostream& manip (std::ostream&)) const
{ {
return m_ostream << manip; return m_ostream << manip;