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
[legend]

Public Types

enum  Modifier {
  None, OnlyExecute, BeforeExecute, AroundExecute,
  AfterExecute
}
 

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)
 

Friends

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)
explicit

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)
protectedvirtual

Reimplement this if you want to do processing after doExecute

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

Call this to install before, around and after roles

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

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)
protectedvirtual

Reimplement this if you want to do processing before doExecute

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

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)
protectedvirtual

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 
)
virtual

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
virtual

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
inline

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)
inline

Defines the private name of this Component.

Definition at line 146 of file component.h.