diff options
author | Mattes D <github@xoft.cz> | 2015-05-10 22:51:16 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-05-10 22:51:16 +0200 |
commit | 693ffb689c1b970e97cca1bb7d3982695e277eca (patch) | |
tree | 968b0c8e92948d3c2fbd63fceade8ae5c13b53df /src/CommandOutput.cpp | |
parent | Call HOOK_EXECUTE_COMMAND even for unknown console commands. (diff) | |
download | cuberite-693ffb689c1b970e97cca1bb7d3982695e277eca.tar cuberite-693ffb689c1b970e97cca1bb7d3982695e277eca.tar.gz cuberite-693ffb689c1b970e97cca1bb7d3982695e277eca.tar.bz2 cuberite-693ffb689c1b970e97cca1bb7d3982695e277eca.tar.lz cuberite-693ffb689c1b970e97cca1bb7d3982695e277eca.tar.xz cuberite-693ffb689c1b970e97cca1bb7d3982695e277eca.tar.zst cuberite-693ffb689c1b970e97cca1bb7d3982695e277eca.zip |
Diffstat (limited to 'src/CommandOutput.cpp')
-rw-r--r-- | src/CommandOutput.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
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(); } |