cutelyst 5.0.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/Plugins/View/json_export.h>
9#include <Cutelyst/view.h>
10
11namespace Cutelyst {
12
13class ViewJsonPrivate;
25class CUTELYST_VIEW_JSON_EXPORT ViewJson final : public View
26{
28 Q_DECLARE_PRIVATE(ViewJson)
29public:
36 explicit ViewJson(QObject *parent, const QString &name = {});
37
43 Q_ENUM(JsonFormat)
44
45
49 [[nodiscard]] JsonFormat outputFormat() const;
50
54 void setOutputFormat(JsonFormat format);
55
67 Q_ENUM(ExposeMode)
68
69
73 [[nodiscard]] ExposeMode exposeStashMode() const;
74
81 void setExposeStash(const QString &key);
82
89 void setExposeStash(const QStringList &keys);
90
97 void setExposeStash(const QRegularExpression &re);
98
104 void setXJsonHeader(bool enable);
105
109 [[nodiscard]] bool xJsonHeader() const;
110
111 QByteArray render(Context *c) const final;
112};
113
114} // namespace Cutelyst
115
116#endif // VIEWJSON_H
QString name() const noexcept
Definition component.cpp:33
The Cutelyst Context.
Definition context.h:42
ViewJson(QObject *parent, const QString &name={})
Definition viewjson.cpp:16
View(QObject *parent, const QString &name)
Definition view.cpp:18
The Cutelyst namespace holds all public Cutelyst API.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const