cmSystemTools: Rename ErrorCallback to MessageCallback

Clarify that it is the callback for the cmSystemTools::Message API.
Rename callback clients too.
This commit is contained in:
Brad King 2014-05-15 09:38:30 -04:00
parent 7577a542df
commit 73b13f5641
7 changed files with 25 additions and 25 deletions

View File

@ -169,7 +169,7 @@ class cmCTestBuildAndTestCaptureRAII
public:
cmCTestBuildAndTestCaptureRAII(cmake& cm, std::string& s): CM(cm)
{
cmSystemTools::SetErrorCallback(CMakeMessageCallback, &s);
cmSystemTools::SetMessageCallback(CMakeMessageCallback, &s);
cmSystemTools::SetStdoutCallback(CMakeStdoutCallback, &s);
this->CM.SetProgressCallback(CMakeProgressCallback, &s);
}
@ -177,7 +177,7 @@ public:
{
this->CM.SetProgressCallback(0, 0);
cmSystemTools::SetStdoutCallback(0, 0);
cmSystemTools::SetErrorCallback(0, 0);
cmSystemTools::SetMessageCallback(0, 0);
}
};

View File

@ -73,7 +73,8 @@ void onsig(int)
}
void CMakeErrorHandler(const char* message, const char* title, bool&, void* clientData)
void CMakeMessageHandler(const char* message, const char* title, bool&,
void* clientData)
{
cmCursesForm* self = static_cast<cmCursesForm*>( clientData );
self->AddError(message, title);
@ -171,7 +172,7 @@ int main(int argc, char const* const* argv)
return 1;
}
cmSystemTools::SetErrorCallback(CMakeErrorHandler, myform);
cmSystemTools::SetMessageCallback(CMakeMessageHandler, myform);
cmCursesForm::CurrentForm = myform;

View File

@ -35,7 +35,7 @@ QCMake::QCMake(QObject* p)
cmSystemTools::DisableRunCommandOutput();
cmSystemTools::SetRunCommandHideConsole(true);
cmSystemTools::SetErrorCallback(QCMake::errorCallback, this);
cmSystemTools::SetMessageCallback(QCMake::messageCallback, this);
this->CMakeInstance = new cmake;
this->CMakeInstance->SetCMakeEditCommand(
@ -348,7 +348,7 @@ void QCMake::progressCallback(const char* msg, float percent, void* cd)
QCoreApplication::processEvents();
}
void QCMake::errorCallback(const char* msg, const char* /*title*/,
void QCMake::messageCallback(const char* msg, const char* /*title*/,
bool& /*stop*/, void* cd)
{
QCMake* self = reinterpret_cast<QCMake*>(cd);

View File

@ -136,7 +136,7 @@ protected:
static bool interruptCallback(void*);
static void progressCallback(const char* msg, float percent, void* cd);
static void errorCallback(const char* msg, const char* title,
static void messageCallback(const char* msg, const char* title,
bool&, void* cd);
bool SuppressDevWarnings;
bool WarnUninitializedMode;

View File

@ -121,10 +121,9 @@ bool cmSystemTools::s_FatalErrorOccured = false;
bool cmSystemTools::s_DisableMessages = false;
bool cmSystemTools::s_ForceUnixPaths = false;
void (*cmSystemTools::s_ErrorCallback)(const char*, const char*,
bool&, void*);
cmSystemTools::MessageCallback cmSystemTools::s_MessageCallback;
void (*cmSystemTools::s_StdoutCallback)(const char*, int len, void*);
void* cmSystemTools::s_ErrorCallbackClientData = 0;
void* cmSystemTools::s_MessageCallbackClientData;
void* cmSystemTools::s_StdoutCallbackClientData = 0;
bool (*cmSystemTools::s_InterruptCallback)(void*);
void* cmSystemTools::s_InterruptCallbackClientData = 0;
@ -254,10 +253,10 @@ bool cmSystemTools::GetInterruptFlag()
return false;
}
void cmSystemTools::SetErrorCallback(ErrorCallback f, void* clientData)
void cmSystemTools::SetMessageCallback(MessageCallback f, void* clientData)
{
s_ErrorCallback = f;
s_ErrorCallbackClientData = clientData;
s_MessageCallback = f;
s_MessageCallbackClientData = clientData;
}
void cmSystemTools::SetStdoutCallback(StdoutCallback f, void* clientData)
@ -305,10 +304,10 @@ void cmSystemTools::Message(const char* m1, const char *title)
{
return;
}
if(s_ErrorCallback)
if(s_MessageCallback)
{
(*s_ErrorCallback)(m1, title, s_DisableMessages,
s_ErrorCallbackClientData);
(*s_MessageCallback)(m1, title, s_DisableMessages,
s_MessageCallbackClientData);
return;
}
else

View File

@ -57,14 +57,14 @@ public:
*/
static std::string TrimWhitespace(const std::string& s);
typedef void (*ErrorCallback)(const char*, const char*, bool&, void*);
typedef void (*MessageCallback)(const char*, const char*, bool&, void*);
/**
* Set the function used by GUIs to display error messages
* Function gets passed: message as a const char*,
* title as a const char*, and a reference to bool that when
* set to false, will disable furthur messages (cancel).
*/
static void SetErrorCallback(ErrorCallback f, void* clientData=0);
static void SetMessageCallback(MessageCallback f, void* clientData=0);
/**
* Display an error message.
@ -470,10 +470,10 @@ private:
static bool s_FatalErrorOccured;
static bool s_DisableMessages;
static bool s_DisableRunCommandOutput;
static ErrorCallback s_ErrorCallback;
static MessageCallback s_MessageCallback;
static StdoutCallback s_StdoutCallback;
static InterruptCallback s_InterruptCallback;
static void* s_ErrorCallbackClientData;
static void* s_MessageCallbackClientData;
static void* s_StdoutCallbackClientData;
static void* s_InterruptCallbackClientData;
};

View File

@ -129,7 +129,7 @@ static std::string cmakemainGetStack(void *clientdata)
return msg;
}
static void cmakemainErrorCallback(const char* m, const char*, bool&,
static void cmakemainMessageCallback(const char* m, const char*, bool&,
void *clientdata)
{
std::cerr << m << cmakemainGetStack(clientdata) << std::endl << std::flush;
@ -310,7 +310,7 @@ int do_cmake(int ac, char const* const* av)
return ret;
}
cmake cm;
cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm);
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void *)&cm);
cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm);
cm.SetWorkingMode(workingMode);