cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
dispatcher.h
1/*
2 * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#ifndef CUTELYST_DISPATCHER_H
6#define CUTELYST_DISPATCHER_H
7
8#include <Cutelyst/action.h>
9#include <Cutelyst/cutelyst_global.h>
10
11#include <QtCore/qhash.h>
12#include <QtCore/qobject.h>
13#include <QtCore/qstringlist.h>
14
15namespace Cutelyst {
16
17class Context;
18class Controller;
19class DispatchType;
20class DispatcherPrivate;
21
27class CUTELYST_LIBRARY Dispatcher : public QObject
28{
30public:
34 Dispatcher(QObject *parent = nullptr);
36
40 Action *getAction(const QString &name, const QString &nameSpace = QString()) const;
41
45 Action *getActionByPath(const QString &path) const;
46
51 ActionList getActions(const QString &name, const QString &nameSpace) const;
52
57
66 QString uriForAction(Action *action, const QStringList &captures) const;
67
73 Action *expandAction(const Context *c, Action *action) const;
74
80
81protected:
87 bool printActions);
88
93 bool dispatch(Context *c);
94
98 bool forward(Context *c, Component *component);
99
103 bool forward(Context *c, const QString &opname);
104
108 void prepareAction(Context *c);
109
110protected:
111 friend class Application;
112 friend class Context;
113 friend class Controller;
114 DispatcherPrivate *d_ptr;
115
116private:
117 Q_DECLARE_PRIVATE(Dispatcher)
118};
119
120} // namespace Cutelyst
121
122#endif // CUTELYST_DISPATCHER_H
This class represents a Cutelyst Action.
Definition action.h:35
The Cutelyst Component base class.
Definition component.h:26
The Cutelyst Context.
Definition context.h:39
Cutelyst Controller base class
Definition controller.h:88
QMap< QString, Controller * > controllers() const
void setupActions(const QVector< Controller * > &controllers, const QVector< DispatchType * > &dispatchers, bool printActions)
Action * getAction(const QString &name, const QString &nameSpace=QString()) const
QVector< DispatchType * > dispatchers() const
Action * getActionByPath(const QString &path) const
QString uriForAction(Action *action, const QStringList &captures) const
bool forward(Context *c, Component *component)
Dispatcher(QObject *parent=nullptr)
ActionList getActions(const QString &name, const QString &nameSpace) const
void prepareAction(Context *c)
bool dispatch(Context *c)
Action * expandAction(const Context *c, Action *action) const
The Cutelyst namespace holds all public Cutelyst API.
Definition Mainpage.dox:8
QVector< Action * > ActionList
Definition action.h:154
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const