cutelyst
4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst
action.h
1
/*
2
* SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3
* SPDX-License-Identifier: BSD-3-Clause
4
*/
5
#ifndef CUTELYST_ACTION_H
6
#define CUTELYST_ACTION_H
7
8
#include <Cutelyst/component.h>
9
#include <Cutelyst/context.h>
10
#include <Cutelyst/cutelyst_global.h>
11
12
#include <QtCore/QMetaMethod>
13
#include <QtCore/QStringList>
14
15
namespace
Cutelyst
{
16
17
class
Controller;
18
class
Dispatcher;
19
class
ActionPrivate;
35
class
CUTELYST_LIBRARY
Action
:
public
Component
36
{
37
Q_OBJECT
38
public
:
42
explicit
Action
(
QObject
*parent =
nullptr
);
43
47
virtual
~
Action
()
override
=
default
;
48
52
virtual
Modifiers modifiers()
const override
;
53
59
[[nodiscard]]
ParamsMultiMap
attributes()
const
noexcept;
60
68
[[nodiscard]]
QString
attribute(
const
QString
&name,
const
QString
&defaultValue = {})
const
;
69
74
void
setAttributes(
const
ParamsMultiMap
&attributes);
75
79
[[nodiscard]]
QString
className()
const
noexcept;
80
84
[[nodiscard]]
Controller
*controller()
const
noexcept;
85
89
inline
bool
dispatch
(
Context
*c) {
return
c->
execute
(
this
); }
90
95
[[nodiscard]]
virtual
bool
match(
int
numberOfArgs)
const
noexcept;
96
107
[[nodiscard]]
virtual
bool
matchCaptures(
int
numberOfCaptures)
const
noexcept;
108
112
[[nodiscard]]
QString
ns() const noexcept;
113
119
[[nodiscard]] virtual qint8 numberOfArgs() const;
120
125
[[nodiscard]] virtual qint8 numberOfCaptures() const;
126
127
protected:
128
friend class
Dispatcher
;
129
friend class ControllerPrivate;
130
135
explicit
Action
(ActionPrivate *ptr,
QObject
*parent =
nullptr
);
136
140
bool
doExecute(
Context
*c) override;
141
145
void
setMethod(const
QMetaMethod
&method);
146
150
void
setController(
Controller
*controller);
151
155
void
setupAction(const QVariantHash &args,
Application
*app);
156
157
private:
158
Q_DECLARE_PRIVATE(
Action
)
159
};
160
162
typedef
QVector
<
Action
*>
ActionList
;
163
164
}
// namespace Cutelyst
165
166
#endif // CUTELYST_ACTION_H
Cutelyst::Action::dispatch
bool dispatch(Context *c)
Definition:
action.h:89
Cutelyst::Component
The Cutelyst Component base class.
Definition:
component.h:30
Cutelyst::Action
This class represents a Cutelyst Action.
Definition:
action.h:35
Cutelyst::Context
The Cutelyst Context.
Definition:
context.h:42
Cutelyst::Controller
Cutelyst Controller base class.
Definition:
controller.h:55
QObject
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition:
group-core-actions.dox:1
QString
Cutelyst::Context::execute
bool execute(Component *code)
Definition:
context.cpp:423
QVector
Cutelyst::Application
The Cutelyst application.
Definition:
application.h:72
QMultiMap
Cutelyst::Dispatcher
The Cutelyst Dispatcher.
Definition:
dispatcher.h:28
QMetaMethod
Generated by
1.8.14