KTutorial  0.5.1
Signals | Public Member Functions | Protected Member Functions
ktutorial::WaitFor Class Reference

Abstract base class for conditions to be waited for. More...

#include <WaitFor.h>

Inheritance diagram for ktutorial::WaitFor:
Inheritance graph
[legend]

List of all members.

Signals

void waitEnded (WaitFor *waitFor)
 This signal is emitted when the condition being waited for is met, and this WaitFor is active.

Public Member Functions

virtual ~WaitFor ()
 Destroys this WaitFor.
virtual bool conditionMet () const =0
 Returns true if the condition being waited for is met, false otherwise.
bool isActive () const
 Returns true if this WaitFor is active, false otherwise.
virtual void setActive (bool active)
 Sets this WaitFor as active or inactive.

Protected Member Functions

 WaitFor ()
 Creates a new WaitFor.

Detailed Description

Abstract base class for conditions to be waited for.

Classes derived from this one model a condition to be waited for. WaitFor objects are added to Step objects specifying some slot to be called when the wait ends.

WaitFor objects can be active or inactive. If the condition is met when they are inactive, wait isn't ended. That is, only active WaitFor objects end their wait (emitting the waitEnded(WaitFor*) signal).

WaitFor hierarchy uses a Composite design pattern. You can compose several WaitFor objects with subclasses of WaitForComposed, each having some specific behaviour (like behaving as an "AND" or an "OR" of their child conditions).

When subclassing WaitFor, conditionMet() must be implemented. This method is used to know in WaitForComposed subclasses whether a WaitFor object met their condition or not. Also, when subclassing, waitEnded(WaitFor*) must be emitted when needed.

Definition at line 48 of file WaitFor.h.


Constructor & Destructor Documentation

ktutorial::WaitFor::WaitFor ( ) [protected]

Creates a new WaitFor.

WaitFor are initially inactive.

Protected to avoid classes other than subclasses to create them.

Definition at line 41 of file WaitFor.cpp.

References ktutorial::WaitForPrivate::mActive.


Member Function Documentation

virtual bool ktutorial::WaitFor::conditionMet ( ) const [pure virtual]

Returns true if the condition being waited for is met, false otherwise.

This method must be defined in subclasses of WaitFor.

Returns:
True if the condition being waited for is met, false otherwise.

Implemented in ktutorial::WaitForProperty, ktutorial::WaitForEvent, ktutorial::WaitForStepActivation, ktutorial::WaitForNot, ktutorial::WaitForWindow, ktutorial::WaitForSignal, ktutorial::WaitForOr, and ktutorial::WaitForAnd.

Referenced by ktutorial::WaitForComposed::childWaitEnd(), and ktutorial::WaitForNot::conditionMet().

Returns true if this WaitFor is active, false otherwise.

Returns:
True if this WaitFor is active, false otherwise.

Definition at line 31 of file WaitFor.cpp.

References ktutorial::WaitForPrivate::mActive.

Referenced by ktutorial::WaitForComposed::childWaitEnd(), ktutorial::WaitForEvent::eventFilter(), and ktutorial::WaitForSignal::signalWaitEnd().

void ktutorial::WaitFor::setActive ( bool  active) [virtual]

Sets this WaitFor as active or inactive.

This method is used internally. Do not call this method yourself.

WaitFor subclasses can redefine this method if some special action has to be taken when activating or deactivating it.

Parameters:
activeTrue to set it active, false otherwise.

Reimplemented in ktutorial::WaitForEvent, ktutorial::WaitForNot, ktutorial::WaitForWindow, ktutorial::WaitForSignal, and ktutorial::WaitForComposed.

Definition at line 35 of file WaitFor.cpp.

References ktutorial::WaitForPrivate::mActive.

Referenced by ktutorial::Step::removeWaitFor(), and ktutorial::WaitForNot::setActive().

void ktutorial::WaitFor::waitEnded ( WaitFor waitFor) [signal]

This signal is emitted when the condition being waited for is met, and this WaitFor is active.

This WaitFor is passed in the signal so the sender can be identified.

Parameters:
waitForThis WaitFor.

Referenced by ktutorial::WaitForComposed::add(), ktutorial::WaitForComposed::childWaitEnd(), ktutorial::WaitForEvent::handleEvent(), and ktutorial::WaitForSignal::signalWaitEnd().


The documentation for this class was generated from the following files: