5 #include "component_p.h"
12 , d_ptr(new ComponentPrivate)
21 Component::~Component()
28 return Component::None;
66 if (d->proccessRoles) {
67 const auto beforeRoles = d->beforeRoles;
69 if (!code->beforeExecute(c)) {
74 QStack<Component *> stack = d->aroundRoles;
76 stack.push_front(
this);
81 const auto afterRoles = d->afterRoles;
83 if (!code->afterExecute(c)) {
105 int stackSize = stack.size();
106 if (stackSize == 1) {
109 }
else if (stackSize > 1) {
115 qCCritical(CUTELYST_COMPONENT) <<
"Reached end of the stack!" << c->req()->uri();
136 if (code->modifiers() & BeforeExecute) {
137 d->beforeRoles.push(code);
140 if (code->modifiers() & AroundExecute) {
141 d->aroundRoles.push(code);
144 if (code->modifiers() & AfterExecute) {
145 d->afterRoles.push(code);
149 d->proccessRoles =
true;
156 const auto roles = d->roles;
158 code->dispatcherReady(dispatch, controller);
163 #include "moc_component.cpp"
The Cutelyst Application.
The Cutelyst Component base class.
virtual Modifiers modifiers() const
virtual bool doExecute(Context *c)
void setReverse(const QString &reverse)
virtual bool init(Application *application, const QVariantHash &args)
virtual bool beforeExecute(Context *c)
virtual bool dispatcherReady(const Dispatcher *dispatch, Controller *controller)
Component(QObject *parent=nullptr)
virtual bool aroundExecute(Context *c, QStack< Component * > stack)
void applyRoles(const QStack< Component * > &roles)
void setName(const QString &name)
virtual bool afterExecute(Context *c)
Cutelyst Controller base class
The Cutelyst namespace holds all public Cutelyst API.