Cutelyst  2.13.0
statusmessage.h
1 /*
2  * Copyright (C) 2016-2019 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_PLUGIN_STATUSMESSAGE
19 #define CUTELYST_PLUGIN_STATUSMESSAGE
20 
21 #include <Cutelyst/plugin.h>
22 #include <Cutelyst/cutelyst_global.h>
23 #include <Cutelyst/context.h>
24 
25 namespace Cutelyst {
26 
27 class StatusMessagePrivate;
28 class CUTELYST_PLUGIN_STATUSMESSAGE_EXPORT StatusMessage : public Plugin
29 {
30  Q_OBJECT
31  Q_DECLARE_PRIVATE(StatusMessage)
32 public:
36  StatusMessage(Application *parent);
37  virtual ~StatusMessage() override;
38 
42  QString sessionPrefix() const;
43 
47  void setSessionPrefix(const QString &sessionPrefix);
48 
52  QString tokenParam() const;
53 
57  void setTokenParam(const QString &tokenParam);
58 
62  QString statusMsgStashKey() const;
63 
67  void setStatusMsgStashKey(const QString &statusMsgStashKey);
68 
72  QString errorMgStashKey() const;
73 
77  void setErrorMgStashKey(const QString &errorMgStashKey);
78 
82  static void load(Context *c);
83 
87  static QString error(Context *c, const QString &msg);
88 
92  static ParamsMultiMap errorQuery(Context *c, const QString &msg, ParamsMultiMap query = ParamsMultiMap());
93 
97  static QString status(Context *c, const QString &msg);
98 
102  static ParamsMultiMap statusQuery(Context *c, const QString &msg, ParamsMultiMap query = ParamsMultiMap());
103 
104 protected:
108  virtual bool setup(Application *app) override;
109 
110  StatusMessagePrivate *d_ptr;
111 
112 private:
113  Q_PRIVATE_SLOT(d_func(), void _q_postFork(Application*))
114 };
115 
116 }
117 
118 #endif // CUTELYST_PLUGIN_STATUSMESSAGE
Cutelyst::Plugin
Definition: plugin.h:30
Cutelyst::ParamsMultiMap
QMap< QString, QString > ParamsMultiMap
Definition: paramsmultimap.h:36
Cutelyst::StatusMessagePrivate
Definition: statusmessage.cpp:34
Cutelyst::Application
The Cutelyst Application.
Definition: application.h:55
Cutelyst::Context
The Cutelyst Context.
Definition: context.h:50
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
Cutelyst::StatusMessage
Definition: statusmessage.h:28