summaryrefslogtreecommitdiffstats
path: root/src/CommandOutput.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-05-11 10:39:45 +0200
committerMattes D <github@xoft.cz>2015-05-11 10:39:45 +0200
commit7d66162e3c339e82d56e5144d466cab97eca82ab (patch)
tree5f3f1a00f704c7def6fc18b98c296e964f218815 /src/CommandOutput.h
parentMerge pull request #1977 from mc-server/warnings (diff)
parentAPIDump: Added linkification to hook return values. (diff)
downloadcuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.gz
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.bz2
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.lz
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.xz
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.zst
cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.zip
Diffstat (limited to 'src/CommandOutput.h')
-rw-r--r--src/CommandOutput.h30
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;
} ;