cutelyst  4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
statusmessage.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2016-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELYST_PLUGIN_STATUSMESSAGE
6 #define CUTELYST_PLUGIN_STATUSMESSAGE
7 
8 #include <Cutelyst/Plugins/statusmessage_export.h>
9 #include <Cutelyst/context.h>
10 #include <Cutelyst/plugin.h>
11 
12 namespace Cutelyst {
13 
14 class StatusMessagePrivate;
84 class CUTELYST_PLUGIN_STATUSMESSAGE_EXPORT StatusMessage : public Plugin
85 {
86  Q_OBJECT
87  Q_DECLARE_PRIVATE(StatusMessage)
88 public:
92  StatusMessage(Application *parent);
93 
97  virtual ~StatusMessage() override;
98 
103  [[nodiscard]] QString sessionPrefix() const noexcept;
104 
109  void setSessionPrefix(const QString &sessionPrefix);
110 
115  [[nodiscard]] QString tokenParam() const noexcept;
116 
121  void setTokenParam(const QString &tokenParam);
122 
127  [[nodiscard]] QString statusMsgStashKey() const noexcept;
128 
133  void setStatusMsgStashKey(const QString &statusMsgStashKey);
134 
139  [[nodiscard]] QString errorMgStashKey() const noexcept;
140 
145  void setErrorMgStashKey(const QString &errorMgStashKey);
146 
151  static void load(Context *c);
152 
156  [[nodiscard]] static QString error(Context *c, const QString &msg);
157 
162  [[nodiscard]] static ParamsMultiMap
163  errorQuery(Context *c, const QString &msg, ParamsMultiMap query = {});
164 
168  [[nodiscard]] static QString status(Context *c, const QString &msg);
169 
174  [[nodiscard]] static ParamsMultiMap
175  statusQuery(Context *c, const QString &msg, ParamsMultiMap query = {});
176 
177 protected:
181  virtual bool setup(Application *app) override;
182 
183  StatusMessagePrivate *d_ptr;
184 
185 private:
186  Q_PRIVATE_SLOT(d_func(), void _q_postFork(Application *))
187 };
188 
189 } // namespace Cutelyst
190 
191 #endif // CUTELYST_PLUGIN_STATUSMESSAGE
The Cutelyst application.
Definition: application.h:66
The Cutelyst Context.
Definition: context.h:42
Base class for Cutelyst Plugins.
Definition: plugin.h:25
Manage status messages over multiple requests stored in the Session.
Definition: statusmessage.h:85
The Cutelyst namespace holds all public Cutelyst API.