summaryrefslogtreecommitdiffstats
path: root/src/CommandOutput.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2023-05-11 22:05:17 +0200
committerMattes D <github@xoft.cz>2023-05-16 23:50:37 +0200
commitc9522fb740200ccef6230cec452c48efb31e5394 (patch)
tree7e74d70699e13dd0a92444a1a0add7a3059ac7ca /src/CommandOutput.h
parentTry a timeout for jobs. (diff)
downloadcuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.gz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.bz2
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.lz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.xz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.zst
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.zip
Diffstat (limited to '')
-rw-r--r--src/CommandOutput.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/CommandOutput.h b/src/CommandOutput.h
index 91d3f61d7..6ee859970 100644
--- a/src/CommandOutput.h
+++ b/src/CommandOutput.h
@@ -17,20 +17,18 @@ class cCommandOutputCallback
public:
virtual ~cCommandOutputCallback() {} // Force a virtual destructor in subclasses
- void vOut(const char * a_Fmt, fmt::printf_args);
+ /** Called when the command wants to output anything; may be called multiple times */
+ virtual void Out(const AString & a_Text) = 0;
- /** Syntax sugar function, calls Out() with Printf()-ed parameters; appends a newline" */
- template <typename... Args>
- void Out(const char * a_Format, const Args & ... a_Args)
+ /** Outputs the specified text, plus a newline. */
+ void OutLn(const AString & aText)
{
- vOut(a_Format, fmt::make_printf_args(a_Args...));
+ Out(aText);
+ Out("\n");
}
- /** 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) {}
+ virtual void Finished() {}
} ;
@@ -63,10 +61,10 @@ public:
// cCommandOutputCallback overrides:
virtual void Out(const AString & a_Text) override;
- virtual void Finished(void) override {}
+ virtual void Finished() override {}
/** Returns the accumulated command output in a string. */
- const AString & GetAccum(void) const { return m_Accum; }
+ const AString & GetAccum() const { return m_Accum; }
protected:
/** Output is stored here until the command finishes processing */
@@ -83,7 +81,7 @@ class cLogCommandOutputCallback :
{
public:
// cStringAccumCommandOutputCallback overrides:
- virtual void Finished(void) override;
+ virtual void Finished() override;
} ;
@@ -96,7 +94,7 @@ class cLogCommandDeleteSelfOutputCallback:
{
using Super = cLogCommandOutputCallback;
- virtual void Finished(void) override
+ virtual void Finished() override
{
Super::Finished();
delete this;