Cutelyst
2.14.2
Cutelyst
component.h
1
/*
2
* Copyright (C) 2014-2017 Daniel Nicoletti <dantti12@gmail.com>
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
#ifndef CUTELYST_COMPONENT_H
19
#define CUTELYST_COMPONENT_H
20
21
#include <QtCore/qobject.h>
22
23
#include <Cutelyst/cutelyst_global.h>
24
25
namespace
Cutelyst
{
26
27
class
Application;
28
class
Context;
29
class
Controller;
30
class
Dispatcher;
31
class
ComponentPrivate;
32
38
class
CUTELYST_LIBRARY
Component
:
public
QObject
39
{
40
Q_OBJECT
41
Q_DECLARE_PRIVATE(
Component
)
42
Q_FLAGS(Modifiers)
43
public
:
45
enum
Modifier
{
46
None = 0 << 1,
47
OnlyExecute = 1 << 1,
48
BeforeExecute = 2 << 1,
49
AroundExecute = 3 << 1,
50
AfterExecute = 4 << 1,
51
};
52
Q_ENUM(Modifier)
53
Q_DECLARE_FLAGS(Modifiers, Modifier)
54
55
60
explicit
Component
(
QObject
*parent =
nullptr
);
61
virtual
~
Component
()
override
;
62
66
virtual
Modifiers modifiers()
const
;
67
71
QString
name()
const
;
72
76
void
setName(
const
QString
&name);
77
81
QString
reverse()
const
;
82
86
void
setReverse(
const
QString
&reverse);
87
94
virtual
bool
init(
Application
*application,
const
QVariantHash &args);
95
99
bool
execute(
Context
*c);
100
101
protected
:
105
explicit
Component
(ComponentPrivate *d,
QObject
*parent =
nullptr
);
106
110
virtual
bool
beforeExecute(
Context
*c);
111
116
virtual
bool
aroundExecute(
Context
*c,
QStack<Component *>
stack);
117
121
virtual
bool
afterExecute(
Context
*c);
122
126
virtual
bool
doExecute(
Context
*c);
127
131
void
applyRoles(
const
QStack<Component *>
&roles);
132
139
virtual
bool
dispatcherReady(
const
Dispatcher
*dispatch,
Controller
*controller);
140
141
protected
:
142
friend
class
Controller
;
143
ComponentPrivate *d_ptr;
144
};
145
146
}
147
148
#endif // CUTELYST_COMPONENT_H
Cutelyst::Controller
Cutelyst Controller base class
Definition:
controller.h:103
Cutelyst::Application
The Cutelyst Application.
Definition:
application.h:56
Cutelyst::Dispatcher
The Cutelyst Dispatcher.
Definition:
dispatcher.h:41
Cutelyst::Context
The Cutelyst Context.
Definition:
context.h:52
Cutelyst::Component
The Cutelyst Component base class.
Definition:
component.h:39
QStack
Cutelyst::Component::Modifier
Modifier
Definition:
component.h:45
QObject
QString
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition:
Mainpage.dox:8
Generated by
1.8.20