Extending Qt Creator Manual | AbstractProcessStep

Extending Qt Creator Manual 4.3.0

# 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>
Inherits: | ProjectExplorer::BuildStep

- List of all members, including inherited members

## Public Functions

void | appendOutputParser(IOutputParser *parser)
void | emitFaultyConfigurationMessage()
bool | ignoreReturnValue()
IOutputParser * | outputParser() const
ProcessParameters * | processParameters()
void | setIgnoreReturnValue(bool b)
void | setOutputParser(IOutputParser *parser)

## Reimplemented Public Functions

virtual bool | runInGuiThread() const final

- 13 public functions inherited from ProjectExplorer::BuildStep
- 11 public functions inherited from ProjectExplorer::ProjectConfiguration

## Protected Functions

| AbstractProcessStep(BuildStepList *bsl, Core::Id id)
| AbstractProcessStep(BuildStepList *bsl, AbstractProcessStep *bs)
QFutureInterface<bool> * | futureInterface() const
virtual void | processFinished(int exitCode, QProcess::ExitStatus status)
virtual void | processStarted()
virtual void | processStartupFailed()
virtual bool | processSucceeded(int exitCode, QProcess::ExitStatus status)
virtual void | stdError(const QString &line)
virtual void | stdOutput(const QString &line)

### Additional Inherited Members

- 3 signals inherited from ProjectExplorer::BuildStep
- 2 signals inherited from ProjectExplorer::ProjectConfiguration
- 1 static public member inherited from ProjectExplorer::BuildStep

## Detailed Description

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

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

### `[protected]` AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, Core::Id id)

Default constructs an instance of AbstractProcessStep.

### `[protected]` AbstractProcessStep::AbstractProcessStep(BuildStepList *bsl, AbstractProcessStep *bs)

Default constructs an instance of AbstractProcessStep.

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

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

### void AbstractProcessStep::emitFaultyConfigurationMessage()

### `[protected]` QFutureInterface<bool> *AbstractProcessStep::futureInterface() const

### bool AbstractProcessStep::ignoreReturnValue()

See also setIgnoreReturnValue().

### IOutputParser *AbstractProcessStep::outputParser() const

See also setOutputParser().

### `[virtual protected]` void AbstractProcessStep::processFinished(int exitCode, QProcess::ExitStatus status)

Called after the process is finished.

The default implementation adds a line to the output window.

### 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, QProcess::ExitStatus status)

Called to test whether a process succeeded or not.

### `[final virtual]` bool AbstractProcessStep::runInGuiThread() const

### 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.

See also ignoreReturnValue().

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

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

Derived classes need to call this function.

See also outputParser().

### `[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.