From 693ffb689c1b970e97cca1bb7d3982695e277eca Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 10 May 2015 22:51:16 +0200 Subject: Exported cPluginManager:ExecuteConsoleCommand() to Lua API. Fixes #1999. --- src/CommandOutput.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/CommandOutput.cpp') diff --git a/src/CommandOutput.cpp b/src/CommandOutput.cpp index 510461d81..255ec3e9b 100644 --- a/src/CommandOutput.cpp +++ b/src/CommandOutput.cpp @@ -29,29 +29,32 @@ void cCommandOutputCallback::Out(const char * a_Fmt, ...) //////////////////////////////////////////////////////////////////////////////// -// cLogCommandOutputCallback: +// cStringAccumCommandOutputCallback: -void cLogCommandOutputCallback::Out(const AString & a_Text) +void cStringAccumCommandOutputCallback::Out(const AString & a_Text) { - m_Buffer.append(a_Text); + m_Accum.append(a_Text); } +//////////////////////////////////////////////////////////////////////////////// +// cLogCommandOutputCallback: + void cLogCommandOutputCallback::Finished(void) { // Log each line separately: - size_t len = m_Buffer.length(); + size_t len = m_Accum.length(); size_t last = 0; for (size_t i = 0; i < len; i++) { - switch (m_Buffer[i]) + switch (m_Accum[i]) { case '\n': { - LOG("%s", m_Buffer.substr(last, i - last).c_str()); + LOG("%s", m_Accum.substr(last, i - last).c_str()); last = i + 1; break; } @@ -59,11 +62,11 @@ void cLogCommandOutputCallback::Finished(void) } // for i - m_Buffer[] if (last < len) { - LOG("%s", m_Buffer.substr(last).c_str()); + LOG("%s", m_Accum.substr(last).c_str()); } // Clear the buffer for the next command output: - m_Buffer.clear(); + m_Accum.clear(); } -- cgit v1.2.3