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.h | |
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.h')
-rw-r--r-- | src/CommandOutput.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/CommandOutput.h b/src/CommandOutput.h index daa9430c0..6265b74ea 100644 --- a/src/CommandOutput.h +++ b/src/CommandOutput.h @@ -47,18 +47,36 @@ class cNullCommandOutputCallback : -/// Sends all command output to a log, line by line, when the command finishes processing -class cLogCommandOutputCallback : +/** Accumulates all command output into a string. */ +class cStringAccumCommandOutputCallback: public cCommandOutputCallback { + typedef cCommandOutputCallback super; + public: // cCommandOutputCallback overrides: virtual void Out(const AString & a_Text) override; - virtual void Finished(void) override; - + virtual void Finished(void) override {} + + /** Returns the accumulated command output in a string. */ + const AString & GetAccum(void) const { return m_Accum; } + protected: - /// Output is stored here until the command finishes processing - AString m_Buffer; + /** Output is stored here until the command finishes processing */ + AString m_Accum; +} ; + + + + + +/// Sends all command output to a log, line by line, when the command finishes processing +class cLogCommandOutputCallback : + public cStringAccumCommandOutputCallback +{ +public: + // cStringAccumCommandOutputCallback overrides: + virtual void Finished(void) override; } ; |