AbstractProcessStep Class

(ProjectExplorer::AbstractProcessStep)

The AbstractProcessStep class is a convenience class that can be used as a base class instead of BuildStep. More...

Header: #include <AbstractProcessStep>

Public Functions

void appendOutputParser(ProjectExplorer::IOutputParser *parser)
ProjectExplorer::ProcessParameters *processParameters()
void setIgnoreReturnValue(bool b)
void setOutputParser(ProjectExplorer::IOutputParser *parser)

Protected Functions

void doRun()
bool init()
virtual void processFinished(int exitCode, int status)
virtual void processStarted()
virtual void processStartupFailed()
virtual bool processSucceeded(int exitCode, int status)
virtual void stdError(const QString &line)
virtual void stdOutput(const QString &line)

Detailed Description

It should be used as a base class if your buildstep just needs to run a process.

Usage:

  • Use processParameters() to configure the process you want to run (you need to do that before calling AbstractProcessStep::init()).
  • Inside YourBuildStep::init() call AbstractProcessStep::init().
  • Inside YourBuildStep::run() call AbstractProcessStep::run(), which automatically starts the process and by default adds the output on stdOut and stdErr to the OutputWindow.
  • If you need to process the process output override stdOut() and/or stdErr.

The two functions processStarted() and processFinished() are called after starting/finishing the process. By default they add a message to the output window.

Use setEnabled() to control whether the BuildStep needs to run. (A disabled BuildStep immediately returns true, from the run function.)

See also ProjectExplorer::ProcessParameters.

Member Function Documentation

void AbstractProcessStep::appendOutputParser(ProjectExplorer::IOutputParser *parser)

Appends the given output parser to the existing chain of parsers.

[protected] void AbstractProcessStep::doRun()

Reimplemented from BuildStep::init(). You need to call this from YourBuildStep::run().

[protected] bool AbstractProcessStep::init()

Reimplemented from BuildStep::init(). You need to call this from YourBuildStep::init().

[virtual protected] void AbstractProcessStep::processFinished(int exitCode, int status)

Called after the process is finished.

The default implementation adds a line to the output window.

ProjectExplorer::ProcessParameters *AbstractProcessStep::processParameters()

Obtains a reference to the parameters for the actual process to run.

Should be used in init().

[virtual protected] void AbstractProcessStep::processStarted()

Called after the process is started.

The default implementation adds a process-started message to the output message.

[virtual protected] void AbstractProcessStep::processStartupFailed()

Called if the process could not be started.

By default, adds a message to the output window.

[virtual protected] bool AbstractProcessStep::processSucceeded(int exitCode, int status)

Called to test whether a process succeeded or not.

void AbstractProcessStep::setIgnoreReturnValue(bool b)

If ignoreReturnValue is set to true, then the abstractprocess step will return success even if the return value indicates otherwise.

Should be called from init.

void AbstractProcessStep::setOutputParser(ProjectExplorer::IOutputParser *parser)

Deletes all existing output parsers and starts a new chain with the given parser.

Derived classes need to call this function.

[virtual protected] void AbstractProcessStep::stdError(const QString &line)

Called for each line of output on StdErrror().

The default implementation adds the line to the application output window.

[virtual protected] void AbstractProcessStep::stdOutput(const QString &line)

Called for each line of output on stdOut().

The default implementation adds the line to the application output window.