cutelyst  3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
viewjson.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2015-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef VIEWJSON_H
6 #define VIEWJSON_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 #include <Cutelyst/view.h>
10 
11 namespace Cutelyst {
12 
13 class ViewJsonPrivate;
14 class CUTELYST_VIEW_JSON_EXPORT ViewJson final : public View
15 {
16  Q_OBJECT
17  Q_DECLARE_PRIVATE(ViewJson)
18 public:
22  explicit ViewJson(QObject *parent, const QString &name = QString());
23 
25  enum JsonFormat {
27  Compact
28  };
29  Q_ENUM(JsonFormat)
30 
31 
35  JsonFormat outputFormat() const;
36 
40  void setOutputFormat(JsonFormat format);
41 
43  enum ExposeMode { All, String, StringList, RegularExpression };
44  Q_ENUM(ExposeMode)
45 
46 
50  ExposeMode exposeStashMode() const;
51 
56  void setExposeStash(const QString &key);
57 
62  void setExposeStash(const QStringList &keys);
63 
68  void setExposeStash(const QRegularExpression &re);
69 
75  void setXJsonHeader(bool enable);
76 
80  bool xJsonHeader() const;
81 
82  QByteArray render(Context *c) const final;
83 };
84 
85 } // namespace Cutelyst
86 
87 #endif // VIEWJSON_H
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
JSON view for your data.
Definition: viewjson.h:14
Cutelyst View abstract view component
Definition: view.h:21