summaryrefslogtreecommitdiff
path: root/Source/cmProcessTools.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmProcessTools.h')
-rw-r--r--Source/cmProcessTools.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h
index e7d9a10eb..21d59c463 100644
--- a/Source/cmProcessTools.h
+++ b/Source/cmProcessTools.h
@@ -3,13 +3,14 @@
#ifndef cmProcessTools_h
#define cmProcessTools_h
-#include "cmConfigure.h"
-#include "cmProcessOutput.h"
+#include "cmConfigure.h" // IWYU pragma: keep
+#include <cstring>
#include <iosfwd>
-#include <string.h>
#include <string>
+#include "cmProcessOutput.h"
+
/** \class cmProcessTools
* \brief Helper classes for process output parsing
*
@@ -17,7 +18,7 @@
class cmProcessTools
{
public:
- typedef cmProcessOutput::Encoding Encoding;
+ using Encoding = cmProcessOutput::Encoding;
/** Abstract interface for process output parsers. */
class OutputParser
{
@@ -34,7 +35,8 @@ public:
return this->Process(data, static_cast<int>(strlen(data)));
}
- virtual ~OutputParser() {}
+ virtual ~OutputParser() = default;
+
protected:
/** Implement in a subclass to process a chunk of data. It should
return true only if it is interested in more data. */
@@ -53,13 +55,13 @@ public:
void SetLog(std::ostream* log, const char* prefix);
protected:
- std::ostream* Log;
- const char* Prefix;
+ std::ostream* Log = nullptr;
+ const char* Prefix = nullptr;
std::string Line;
char Separator;
- char LineEnd;
+ char LineEnd = '\0';
bool IgnoreCR;
- bool ProcessChunk(const char* data, int length) CM_OVERRIDE;
+ bool ProcessChunk(const char* data, int length) override;
/** Implement in a subclass to process one line of input. It
should return true only if it is interested in more data. */
@@ -70,18 +72,18 @@ public:
class OutputLogger : public LineParser
{
public:
- OutputLogger(std::ostream& log, const char* prefix = CM_NULLPTR)
+ OutputLogger(std::ostream& log, const char* prefix = nullptr)
{
this->SetLog(&log, prefix);
}
private:
- bool ProcessLine() CM_OVERRIDE { return true; }
+ bool ProcessLine() override { return true; }
};
/** Run a process and send output to given parsers. */
static void RunProcess(struct cmsysProcess_s* cp, OutputParser* out,
- OutputParser* err = CM_NULLPTR,
+ OutputParser* err = nullptr,
Encoding encoding = cmProcessOutput::Auto);
};