diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-07-29 13:13:03 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-07-29 13:13:03 +0200 |
commit | 53e22b11857fed62e2313d6d84d90f88ed412ffb (patch) | |
tree | c61e56725da7dff0154d566722651e2c39c9d6c6 /source/CommandOutput.h | |
parent | WebAdmin: Removed the duplicate memory usage querying (diff) | |
download | cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.gz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.bz2 cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.lz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.xz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.zst cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.zip |
Diffstat (limited to '')
-rw-r--r-- | source/CommandOutput.h | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/source/CommandOutput.h b/source/CommandOutput.h index 68217dbb4..bdf675238 100644 --- a/source/CommandOutput.h +++ b/source/CommandOutput.h @@ -1,82 +1,82 @@ -
-// CommandOutput.h
-
-// Declares various classes that process command output
-
-
-
-
-
-/** Interface for a callback that receives command output
-The Out() function is called for any output the command has produced.
-Descendants override that function to provide specific processing of the output.
-*/
-class cCommandOutputCallback
-{
-public:
- virtual ~cCommandOutputCallback() {}; // Force a virtual destructor in subclasses
-
- /// Syntax sugar function, calls Out() with Printf()-ed parameters; appends a "\n"
- void Out(const char * a_Fmt, ...);
-
- /// Called when the command wants to output anything; may be called multiple times
- virtual void Out(const AString & a_Text) = 0;
-
- /// Called when the command processing has been finished
- virtual void Finished(void) {};
-} ;
-
-
-
-
-
-/// Class that discards all command output
-class cNullCommandOutputCallback :
- public cCommandOutputCallback
-{
- // cCommandOutputCallback overrides:
- virtual void Out(const AString & a_Text) override
- {
- // Do nothing
- }
-} ;
-
-
-
-
-
-
-/// Sends all command output to a log, line by line, when the command finishes processing
-class cLogCommandOutputCallback :
- public cCommandOutputCallback
-{
-public:
- // cCommandOutputCallback overrides:
- virtual void Out(const AString & a_Text) override;
- virtual void Finished(void) override;
-
-protected:
- /// Output is stored here until the command finishes processing
- AString m_Buffer;
-} ;
-
-
-
-
-
-/// Sends all command output to a log, line by line; deletes self when command finishes processing
-class cLogCommandDeleteSelfOutputCallback :
- public cLogCommandOutputCallback
-{
- typedef cLogCommandOutputCallback super;
-
- virtual void Finished(void) override
- {
- super::Finished();
- delete this;
- }
-} ;
-
-
-
-
+ +// CommandOutput.h + +// Declares various classes that process command output + + + + + +/** Interface for a callback that receives command output +The Out() function is called for any output the command has produced. +Descendants override that function to provide specific processing of the output. +*/ +class cCommandOutputCallback +{ +public: + virtual ~cCommandOutputCallback() {}; // Force a virtual destructor in subclasses + + /// Syntax sugar function, calls Out() with Printf()-ed parameters; appends a "\n" + void Out(const char * a_Fmt, ...); + + /// Called when the command wants to output anything; may be called multiple times + virtual void Out(const AString & a_Text) = 0; + + /// Called when the command processing has been finished + virtual void Finished(void) {}; +} ; + + + + + +/// Class that discards all command output +class cNullCommandOutputCallback : + public cCommandOutputCallback +{ + // cCommandOutputCallback overrides: + virtual void Out(const AString & a_Text) override + { + // Do nothing + } +} ; + + + + + + +/// Sends all command output to a log, line by line, when the command finishes processing +class cLogCommandOutputCallback : + public cCommandOutputCallback +{ +public: + // cCommandOutputCallback overrides: + virtual void Out(const AString & a_Text) override; + virtual void Finished(void) override; + +protected: + /// Output is stored here until the command finishes processing + AString m_Buffer; +} ; + + + + + +/// Sends all command output to a log, line by line; deletes self when command finishes processing +class cLogCommandDeleteSelfOutputCallback : + public cLogCommandOutputCallback +{ + typedef cLogCommandOutputCallback super; + + virtual void Finished(void) override + { + super::Finished(); + delete this; + } +} ; + + + + |