18 #include "component_p.h"
22 using namespace Cutelyst;
25 , d_ptr(new ComponentPrivate)
34 Component::~Component()
41 return Component::None;
79 if (d->proccessRoles) {
80 const auto beforeRoles = d->beforeRoles;
82 if (!code->beforeExecute(c)) {
94 const auto afterRoles = d->afterRoles;
96 if (!code->afterExecute(c)) {
118 int stackSize = stack.
size();
119 if (stackSize == 1) {
122 }
else if (stackSize > 1) {
128 qCCritical(CUTELYST_COMPONENT) <<
"Reached end of the stack!" << c->req()->uri();
149 if (code->modifiers() & BeforeExecute) {
150 d->beforeRoles.push(code);
153 if (code->modifiers() & AroundExecute) {
154 d->aroundRoles.push(code);
157 if (code->modifiers() & AfterExecute) {
158 d->afterRoles.push(code);
162 d->proccessRoles =
true;
169 const auto roles = d->roles;
171 code->dispatcherReady(dispatch, controller);
176 #include "moc_component.cpp"
void setName(const QString &name)
virtual bool afterExecute(Context *c)
void setReverse(const QString &reverse)
virtual bool doExecute(Context *c)
The Cutelyst Component base class.
Cutelyst Controller base class
virtual Modifiers modifiers() const
virtual bool init(Application *application, const QVariantHash &args)
void applyRoles(const QStack< Component * > &roles)
Component(QObject *parent=nullptr)
virtual bool dispatcherReady(const Dispatcher *dispatch, Controller *controller)
void push_front(const T &value)
virtual bool aroundExecute(Context *c, QStack< Component * > stack)
The Cutelyst Application.
virtual bool beforeExecute(Context *c)