forked from cutelyst/cutelyst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontext_p.h
87 lines (73 loc) · 2.34 KB
/
context_p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* Copyright (C) 2013-2017 Daniel Nicoletti <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CUTELYST_P_H
#define CUTELYST_P_H
#include "context.h"
#include "plugin.h"
#include "response.h"
#include "request_p.h"
#include "enginerequest.h"
#include <QVariantHash>
#include <QStack>
class QEventLoop;
namespace Cutelyst {
class Stats;
class ContextPrivate
{
public:
inline ContextPrivate(Application *_app, Engine *_ngine, Dispatcher *_dispatcher, const QVector<Plugin *> &_plugins)
: plugins(_plugins)
, app(_app)
, engine(_ngine)
, dispatcher(_dispatcher)
{ }
QString statsStartExecute(Component *code);
void statsFinishExecute(const QString &statsInfo);
QStringList error;
QVariantHash stash;
QLocale locale;
QStack<Component *> stack;
QVector<Plugin *> plugins;
QVector<Component *> pendingAsync;
Application *app;
Engine *engine;
Dispatcher *dispatcher;
// Pointer to Engine data
EngineRequest *engineRequest = nullptr;
Request *request = nullptr;
Response *response = nullptr;
Action *action = nullptr;
View *view = nullptr;
Stats *stats = nullptr;
bool asyncDetached = false;
bool detached = false;
bool state = false;
};
class DummyRequest : public QObject, public EngineRequest
{
Q_OBJECT
public:
DummyRequest(QObject *parent) : QObject(parent) {}
virtual qint64 doWrite(const char *, qint64) override { return -1; }
/*!
* Reimplement this to write the headers back to the client
*/
virtual bool writeHeaders(quint16 , const Headers &) override { return false; }
};
}
#endif // CUTELYST_P_H