mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Split HTTP::Server to its own module
This commit is contained in:
44
src/ripple/http/impl/ScopedStream.cpp
Normal file
44
src/ripple/http/impl/ScopedStream.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
namespace HTTP {
|
||||
|
||||
ScopedStream::ScopedStream (Session& session)
|
||||
: m_session (session)
|
||||
{
|
||||
}
|
||||
|
||||
ScopedStream::ScopedStream (ScopedStream const& other)
|
||||
: m_session (other.m_session)
|
||||
{
|
||||
}
|
||||
|
||||
ScopedStream::ScopedStream (Session& session,
|
||||
std::ostream& manip (std::ostream&))
|
||||
: m_session (session)
|
||||
{
|
||||
m_ostream << manip;
|
||||
}
|
||||
|
||||
ScopedStream::~ScopedStream ()
|
||||
{
|
||||
if (! m_ostream.str().empty())
|
||||
m_session.write (m_ostream.str());
|
||||
}
|
||||
|
||||
std::ostream& ScopedStream::operator<< (std::ostream& manip (std::ostream&)) const
|
||||
{
|
||||
return m_ostream << manip;
|
||||
}
|
||||
|
||||
std::ostringstream& ScopedStream::ostream () const
|
||||
{
|
||||
return m_ostream;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user