pwfengine
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Friends
PAction Class Reference

Implements the command-pattern design technique for asynchronous operations. NOTE: The action is disposable. More...

#include <PAction.h>

Inheritance diagram for PAction:
PActionGroup PAttemptSchema PEvalWrapperRequire PFindSchemaElement

List of all members.

Public Types

enum  StatusType { StatusSuccess, StatusFailure, StatusNone }

Public Slots

virtual void start ()
virtual void stop ()

Signals

void started ()
void finished (PAction *action)
void finished (PAction::StatusType finishedStatus)
void success (PAction *action)
void success (PAction::StatusType successStatus)
void failure (PAction *action)
void failure (PAction::StatusType failureStatus)

Public Member Functions

 PAction (QObject *parent=0)
PAction::StatusType finishedStatus () const
bool hasFinished () const

Protected Slots

void finish (const PAction::StatusType &status, const bool &asyncSignal=false)

Friends

class PActionPrivate

Detailed Description

Implements the command-pattern design technique for asynchronous operations. NOTE: The action is disposable.

The action can be started with the start() method, stopped with stop() that will asynchronously finish with the StatusNone status. Anyway, the finished signals are emitted when the action finishes.

If still active, the action will be automatically stopped at destruction time.

Warning:
If you subclass PAction, remember to call the parent method as the first statement in the overrided start() and stop() methods to assure right behaviour.

Member Enumeration Documentation

Enumerator:
StatusSuccess 

Means that the action has finished succesfully.

StatusFailure 

Means that the action has failed.

StatusNone 

The initial value. The action finishes with this status if it has been stopped by the user or for some other reasons.


Member Function Documentation

void PAction::failure ( PAction::StatusType  failureStatus) [signal]

The signal be connected to a finished slot of another action

void PAction::finish ( const PAction::StatusType status,
const bool &  asyncSignal = false 
) [protected, slot]
Note:
calling this method if the action has already finished has no effect.
Parameters:
asyncSignalif true asynchronously emit the finished signals, allowing listeners to connect even if them are emitted before the object is returned to the handler
void PAction::finished ( PAction::StatusType  finishedStatus) [signal]

The signal be connected to a finish slot of another action

bool PAction::hasFinished ( ) const
Returns:
true if the PAction has finished or is about to finish (the timer is running)
void PAction::start ( ) [virtual, slot]

Start the execution of the action and immediately emit the started signal.

Reimplemented in PAttemptSchema, PEvalWrapperRequire, and PFindSchemaElement.

void PAction::started ( ) [signal]

Set the error from another action Directly set the error

void PAction::stop ( ) [virtual, slot]

Stop the execution of the action, asynchronously finishing with a StatusNone status.

void PAction::success ( PAction::StatusType  successStatus) [signal]

The signal be connected to a finish slot of another action


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Enumerator