Add 'ostream' method to class StreamBuffer, and use it.

This commit is contained in:
2021-11-03 12:31:13 -04:00
parent 17a1155906
commit 7cbf40e3d6
5 changed files with 71 additions and 25 deletions

View File

@@ -6,7 +6,6 @@
#include "invocation.hpp"
#include "util.hpp"
#include <memory>
#include <iostream>
class LpxClient : public DrivenEngine {
public:
@@ -36,15 +35,15 @@ public:
}
void do_lua(const std::string &lua) {
std::cerr << "Lua: " << lua << std::endl;
stdostream() << "Lua: " << lua << std::endl;
}
void do_command(const util::StringVec &words) {
std::cerr << "Command: ";
stdostream() << "Command: ";
for (const std::string &word : words) {
std::cerr << word << " ";
stdostream() << word << " ";
}
std::cerr << std::endl;
stdostream() << std::endl;
}
void console_process(const std::string &line) {
@@ -57,7 +56,7 @@ public:
do_command(console_.words());
console_.clear();
} else if (action == LuaConsole::DO_SYNTAX) {
std::cerr << console_.syntax() << std::endl;
stdostream() << console_.syntax() << std::endl;
console_.clear();
}
}
@@ -74,7 +73,7 @@ public:
// Check for communication from server..
if (channel_ != nullptr) {
if (channel_->closed()) {
std::cerr << "Server closed connection " << channel_->error() << std::endl;
stdostream() << "Server closed connection " << channel_->error() << std::endl;
channel_.reset();
// stop_driver();
} else {