mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove HTTP::ScopedStream:
This class was used to allow stream style operator<< to write to the HTTP::Session. This is being superceded by a more robust object-based model that supports coroutines.
This commit is contained in:
@@ -2575,9 +2575,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\http\impl\Port.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\http\impl\ScopedStream.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\http\impl\Server.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
||||
@@ -3660,9 +3660,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\http\impl\Port.cpp">
|
||||
<Filter>ripple\http\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\http\impl\ScopedStream.cpp">
|
||||
<Filter>ripple\http\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\http\impl\Server.cpp">
|
||||
<Filter>ripple\http\impl</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -33,44 +33,6 @@ namespace HTTP {
|
||||
|
||||
class Session;
|
||||
|
||||
/** Scoped ostream-based RAII container for building the HTTP response. */
|
||||
// VFALCO TODO Use abstract_ostream
|
||||
class ScopedStream
|
||||
{
|
||||
public:
|
||||
explicit ScopedStream (Session& session);
|
||||
ScopedStream (ScopedStream const& other);
|
||||
|
||||
template <typename T>
|
||||
ScopedStream (Session& session, T const& t)
|
||||
: m_session (session)
|
||||
{
|
||||
m_ostream << t;
|
||||
}
|
||||
|
||||
ScopedStream (Session& session, std::ostream& manip (std::ostream&));
|
||||
|
||||
~ScopedStream ();
|
||||
|
||||
std::ostringstream& ostream () const;
|
||||
|
||||
std::ostream& operator<< (std::ostream& manip (std::ostream&)) const;
|
||||
|
||||
template <typename T>
|
||||
std::ostream& operator<< (T const& t) const
|
||||
{
|
||||
return m_ostream << t;
|
||||
}
|
||||
|
||||
private:
|
||||
ScopedStream& operator= (ScopedStream const&); // disallowed
|
||||
|
||||
Session& m_session;
|
||||
std::ostringstream mutable m_ostream;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Persistent state information for a connection session.
|
||||
These values are preserved between calls for efficiency.
|
||||
Some fields are input parameters, some are output parameters,
|
||||
@@ -131,22 +93,6 @@ public:
|
||||
write (void const* buffer, std::size_t bytes) = 0;
|
||||
/** @} */
|
||||
|
||||
/** Output support using ostream. */
|
||||
/** @{ */
|
||||
ScopedStream
|
||||
operator<< (std::ostream& manip (std::ostream&))
|
||||
{
|
||||
return ScopedStream (*this, manip);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ScopedStream
|
||||
operator<< (T const& t)
|
||||
{
|
||||
return ScopedStream (*this, t);
|
||||
}
|
||||
/** @} */
|
||||
|
||||
/** Detach the session.
|
||||
This holds the session open so that the response can be sent
|
||||
asynchronously. Calls to io_service::run made by the server
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
void
|
||||
onRequest (Session& session) override
|
||||
{
|
||||
session << "Hello, world!\n";
|
||||
session.write (std::string ("Hello, world!\n"));
|
||||
if (session.message().keep_alive())
|
||||
session.complete();
|
||||
else
|
||||
@@ -145,6 +145,10 @@ public:
|
||||
{
|
||||
fail(e.what());
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
fail(e.what());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include <ripple/http/impl/Door.cpp>
|
||||
#include <ripple/http/impl/Port.cpp>
|
||||
#include <ripple/http/impl/ScopedStream.cpp>
|
||||
#include <ripple/http/impl/ServerImpl.cpp>
|
||||
#include <ripple/http/impl/Server.cpp>
|
||||
#include <ripple/http/tests/Server.test.cpp>
|
||||
|
||||
Reference in New Issue
Block a user