Rosetta
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Attributes | List of all members
ui::task::Functor Class Reference

#include <functor.h>

Inheritance diagram for ui::task::Functor:
Inheritance graph
[legend]

Public Types

enum class  State { _none_ , _running_ , _finished_ }
 

Public Slots

void finish ()
 change state to finished More...
 

Signals

void started ()
 indicate start of this Functor, emitted only once More...
 
void tick ()
 Might be emitted periodically if Functor have loops. At least one tick() event is guaranteed to happened between start and finish. More...
 
void finished ()
 indicate end of this Functor execution, emitted only once More...
 
void final ()
 last emitted singal, before Functor consider fully done, emitted only once More...
 

Public Member Functions

 Functor (QString const &name, QObject *parent=Q_NULLPTR)
 
State state () const
 return current state More...
 
bool is_running () const
 return true if Functor is now executing More...
 
bool is_finished () const
 return true if Functor is finished More...
 
QString name () const
 
void execute ()
 
virtual std::pair< int, int > progress () const
 

Protected Member Functions

void state (State state)
 

Private Slots

virtual void run ()
 

Private Attributes

QString name_
 
State state_ = State::_none_
 

Detailed Description

Something that could be executed and emit done on completion

Member Enumeration Documentation

◆ State

Enumerator
_none_ 
_running_ 

have not run yet

_finished_ 

still running

Constructor & Destructor Documentation

◆ Functor()

ui::task::Functor::Functor ( QString const &  name,
QObject parent = Q_NULLPTR 
)
inline

Member Function Documentation

◆ execute()

void ui::task::Functor::execute ( )

References _running_, name(), run(), and state().

Referenced by ui::task::FunctorSequence::run().

◆ final

void ui::task::Functor::final ( )
signal

◆ finish

void ui::task::Functor::finish ( )
slot

◆ finished

void ui::task::Functor::finished ( )
signal

◆ is_finished()

bool ui::task::Functor::is_finished ( ) const

return true if Functor is finished

References _finished_, and state_.

Referenced by ui::task::FunctorSequence::progress(), and ui::task::FunctorASyncSequence::progress().

◆ is_running()

bool ui::task::Functor::is_running ( ) const

return true if Functor is now executing

References _running_, and state_.

Referenced by progress(), ui::task::FunctorSequence::progress(), and ui::task::FunctorASyncSequence::progress().

◆ name()

QString ui::task::Functor::name ( ) const
inline

◆ progress()

std::pair< int, int > ui::task::Functor::progress ( ) const
virtual

◆ run

void ui::task::Functor::run ( )
privatevirtualslot

References _finished_, and state().

Referenced by execute().

◆ started

void ui::task::Functor::started ( )
signal

◆ state() [1/2]

State ui::task::Functor::state ( ) const
inline

return current state

References state_.

Referenced by execute(), finish(), run(), and state().

◆ state() [2/2]

void ui::task::Functor::state ( State  state)
protected

◆ tick

void ui::task::Functor::tick ( )
signal

Member Data Documentation

◆ name_

QString ui::task::Functor::name_
private

Referenced by name().

◆ state_

State ui::task::Functor::state_ = State::_none_
private

Referenced by is_finished(), is_running(), and state().


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