1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
//-----------------------------------------------------------------------------
/** @file libboardgame_gtp/Response.cpp
@author Markus Enzenberger
@copyright GNU General Public License version 3 or later */
//-----------------------------------------------------------------------------
#include "Response.h"
namespace libboardgame_gtp {
//-----------------------------------------------------------------------------
void Response::clear()
{
m_stream.str(string());
m_stream.copyfmt(m_dummy);
}
void Response::write(ostream& out, string& buffer) const
{
buffer = m_stream.str();
bool was_newline = false;
for (auto c : buffer)
{
bool is_newline = (c == '\n');
if (is_newline && was_newline)
out << ' ';
out << c;
was_newline = is_newline;
}
if (! was_newline)
out << '\n';
out << '\n';
}
//-----------------------------------------------------------------------------
} // namespace libboardgame_gtp
|