Cutelyst  1.8.0
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
Cutelyst::Component Class Reference

The Cutelyst Component base class. More...

#include <Cutelyst/Component>

Inheritance diagram for Cutelyst::Component:
Inheritance graph

Public Types

enum  Modifier {
  None, OnlyExecute, BeforeExecute, AroundExecute,

Public Member Functions

 Component (QObject *parent=nullptr)
bool execute (Context *c)
virtual bool init (Application *application, const QVariantHash &args)
virtual Modifiers modifiers () const
QString name () const
QString reverse () const
void setName (const QString &name)
void setReverse (const QString &reverse)

Protected Member Functions

virtual bool afterExecute (Context *c)
void applyRoles (const QStack< Component * > &roles)
virtual bool aroundExecute (Context *c, QStack< Component * > stack)
virtual bool beforeExecute (Context *c)
virtual bool dispatcherReady (const Dispatcher *dispatch, Controller *controller)
virtual bool doExecute (Context *c)


class Controller

Detailed Description

This is the base class of a Cutelyst component

Definition at line 40 of file component.h.

Member Enumeration Documentation

This value defines which kind of modifiers should be executed

Definition at line 47 of file component.h.

Constructor & Destructor Documentation

Cutelyst::Component::Component ( QObject *  parent = nullptr)

This is the base class for many Cutelyst objects, prividing access to name and reverse for actions, and modifiers to customize execution.

Member Function Documentation

virtual bool Cutelyst::Component::afterExecute ( Context c)

Reimplement this if you want to do processing after doExecute

void Cutelyst::Component::applyRoles ( const QStack< Component * > &  roles)

Call this to install before, around and after roles

virtual bool Cutelyst::Component::aroundExecute ( Context c,
QStack< Component * >  stack 

Reimplement this if you want to do processing around doExecute, you must call doExecute yourself then

Reimplemented in Cutelyst::RoleACL.

virtual bool Cutelyst::Component::beforeExecute ( Context c)

Reimplement this if you want to do processing before doExecute

virtual bool Cutelyst::Component::dispatcherReady ( const Dispatcher dispatch,
Controller controller 

Called by dispatcher once it's done preparing actions

Subclasses might want to implement this to cache special actions, such as special methods for REST actions

Reimplemented in Cutelyst::RoleACL.

virtual bool Cutelyst::Component::doExecute ( Context c)

Reimplement this for the main processing

Reimplemented in Cutelyst::Action, Cutelyst::RenderView, Cutelyst::ActionChain, and Cutelyst::ActionREST.

bool Cutelyst::Component::execute ( Context c)

Executes this component agains the Context

virtual bool Cutelyst::Component::init ( Application application,
const QVariantHash &  args 

A Does class is always attached to an action, if this method returns false the application will fail to start. Often useful if the user misconfigured the settings

Reimplemented in Cutelyst::RenderView, and Cutelyst::RoleACL.

virtual Modifiers Cutelyst::Component::modifiers ( ) const

Reimplement to return custom Modifiers, default is None

Reimplemented in Cutelyst::Action, Cutelyst::View, and Cutelyst::RoleACL.

QString Cutelyst::Component::name ( ) const

Returns the sub name of this Component.

QString Cutelyst::Component::reverse ( ) const

Returns the private name of this component.

Definition at line 143 of file component.h.

void Cutelyst::Component::setName ( const QString &  name)

Defines the sub name of this Component.

void Cutelyst::Component::setReverse ( const QString &  reverse)

Defines the private name of this Component.

Definition at line 146 of file component.h.