mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-16 12:11:04 -06:00
OutputCallback: Accept std::string argument
This commit is contained in:
@@ -123,11 +123,8 @@ public:
|
|||||||
s += "\n";
|
s += "\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
cmSystemTools::SetStdoutCallback(
|
cmSystemTools::SetStdoutCallback([&s](std::string const& m) { s += m; });
|
||||||
[&s](const char* m, size_t len) { s.append(m, len); });
|
cmSystemTools::SetStderrCallback([&s](std::string const& m) { s += m; });
|
||||||
|
|
||||||
cmSystemTools::SetStderrCallback(
|
|
||||||
[&s](const char* m, size_t len) { s.append(m, len); });
|
|
||||||
|
|
||||||
this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) {
|
this->CM.SetProgressCallback([&s](const char* msg, float /*unused*/) {
|
||||||
s += msg;
|
s += msg;
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ QCMake::QCMake(QObject* p)
|
|||||||
this->messageCallback(msg, title);
|
this->messageCallback(msg, title);
|
||||||
});
|
});
|
||||||
cmSystemTools::SetStdoutCallback(
|
cmSystemTools::SetStdoutCallback(
|
||||||
[this](const char* msg, size_t len) { this->stdoutCallback(msg, len); });
|
[this](std::string const& msg) { this->stdoutCallback(msg); });
|
||||||
cmSystemTools::SetStderrCallback(
|
cmSystemTools::SetStderrCallback(
|
||||||
[this](const char* msg, size_t len) { this->stderrCallback(msg, len); });
|
[this](std::string const& msg) { this->stderrCallback(msg); });
|
||||||
|
|
||||||
this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project);
|
this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project);
|
||||||
this->CMakeInstance->SetCMakeEditCommand(
|
this->CMakeInstance->SetCMakeEditCommand(
|
||||||
@@ -365,15 +365,15 @@ void QCMake::messageCallback(const char* msg, const char* /*title*/)
|
|||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCMake::stdoutCallback(const char* msg, size_t len)
|
void QCMake::stdoutCallback(std::string const& msg)
|
||||||
{
|
{
|
||||||
emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
|
emit this->outputMessage(QString::fromStdString(msg));
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCMake::stderrCallback(const char* msg, size_t len)
|
void QCMake::stderrCallback(std::string const& msg)
|
||||||
{
|
{
|
||||||
emit this->outputMessage(QString::fromLocal8Bit(msg, int(len)));
|
emit this->outputMessage(QString::fromStdString(msg));
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,8 +170,8 @@ protected:
|
|||||||
bool interruptCallback();
|
bool interruptCallback();
|
||||||
void progressCallback(const char* msg, float percent);
|
void progressCallback(const char* msg, float percent);
|
||||||
void messageCallback(const char* msg, const char* title);
|
void messageCallback(const char* msg, const char* title);
|
||||||
void stdoutCallback(const char* msg, size_t len);
|
void stdoutCallback(std::string const& msg);
|
||||||
void stderrCallback(const char* msg, size_t len);
|
void stderrCallback(std::string const& msg);
|
||||||
|
|
||||||
bool WarnUninitializedMode;
|
bool WarnUninitializedMode;
|
||||||
bool WarnUnusedMode;
|
bool WarnUnusedMode;
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ void cmSystemTools::SetStderrCallback(OutputCallback f)
|
|||||||
void cmSystemTools::Stderr(const std::string& s)
|
void cmSystemTools::Stderr(const std::string& s)
|
||||||
{
|
{
|
||||||
if (s_StderrCallback) {
|
if (s_StderrCallback) {
|
||||||
s_StderrCallback(s.c_str(), s.length());
|
s_StderrCallback(s);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << s << std::flush;
|
std::cerr << s << std::flush;
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ void cmSystemTools::Stderr(const std::string& s)
|
|||||||
void cmSystemTools::Stdout(const std::string& s)
|
void cmSystemTools::Stdout(const std::string& s)
|
||||||
{
|
{
|
||||||
if (s_StdoutCallback) {
|
if (s_StdoutCallback) {
|
||||||
s_StdoutCallback(s.c_str(), s.length());
|
s_StdoutCallback(s);
|
||||||
} else {
|
} else {
|
||||||
std::cout << s << std::flush;
|
std::cout << s << std::flush;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
Message(m.c_str(), title);
|
Message(m.c_str(), title);
|
||||||
}
|
}
|
||||||
|
|
||||||
using OutputCallback = std::function<void(const char*, size_t)>;
|
using OutputCallback = std::function<void(std::string const&)>;
|
||||||
|
|
||||||
///! Send a string to stdout
|
///! Send a string to stdout
|
||||||
static void Stdout(const std::string& s);
|
static void Stdout(const std::string& s);
|
||||||
|
|||||||
Reference in New Issue
Block a user