swift
Loading...
Searching...
No Matches
swift::misc::CEventLoop Class Reference

Utility class which blocks until a signal is emitted or timeout reached. More...

#include <eventloop.h>

Public Member Functions

 CEventLoop ()
 Constructor.
 CEventLoop (QObject *guard)
 Constructor. Guard object must exist, and will be checked again when the loop quits.
template<typename T, typename F>
void stopWhen (const T *sender, F signal)
 Event loop will stop if the given signal is received.
template<typename T, typename F1, typename F2>
void stopWhen (const T *sender, F1 signal, F2 &&condition)
 Event loop will stop if the given signal is received and condition returns true.
bool exec (int timeoutMs)
 Begin processing events until the timeout or stop condition occurs.
bool isGuardAlive () const
 True if the guard object still exists.

Detailed Description

Utility class which blocks until a signal is emitted or timeout reached.

Definition at line 19 of file eventloop.h.

Constructor & Destructor Documentation

◆ CEventLoop() [1/2]

swift::misc::CEventLoop::CEventLoop ( )
inline

Constructor.

Definition at line 23 of file eventloop.h.

◆ CEventLoop() [2/2]

swift::misc::CEventLoop::CEventLoop ( QObject * guard)
inline

Constructor. Guard object must exist, and will be checked again when the loop quits.

Definition at line 26 of file eventloop.h.

Member Function Documentation

◆ exec()

bool swift::misc::CEventLoop::exec ( int timeoutMs)
inline

Begin processing events until the timeout or stop condition occurs.

Returns
True if the signal was received, false if it timed out or the guard object died.

Definition at line 54 of file eventloop.h.

◆ isGuardAlive()

bool swift::misc::CEventLoop::isGuardAlive ( ) const
inline

True if the guard object still exists.

Definition at line 64 of file eventloop.h.

◆ stopWhen() [1/2]

template<typename T, typename F>
void swift::misc::CEventLoop::stopWhen ( const T * sender,
F signal )
inline

Event loop will stop if the given signal is received.

Definition at line 34 of file eventloop.h.

◆ stopWhen() [2/2]

template<typename T, typename F1, typename F2>
void swift::misc::CEventLoop::stopWhen ( const T * sender,
F1 signal,
F2 && condition )
inline

Event loop will stop if the given signal is received and condition returns true.

Definition at line 41 of file eventloop.h.


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