cutelyst 4.3.0
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
11namespace Cutelyst {
12
13class ViewJsonPrivate;
25class CUTELYST_VIEW_JSON_EXPORT ViewJson final : public View
26{
27 Q_OBJECT
28 Q_DECLARE_PRIVATE(ViewJson)
29public:
36 explicit ViewJson(QObject *parent, const QString &name = QString());
37
41 Compact
42 };
43 Q_ENUM(JsonFormat)
44
45
49 [[nodiscard]] JsonFormat outputFormat() const;
50
54 void setOutputFormat(JsonFormat format);
55
58 All,
60 String,
62 StringList,
64 RegularExpression
66 };
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
The Cutelyst Context.
Definition context.h:42
A view that returns stash data in JSON format.
Definition viewjson.h:26
Abstract View component for Cutelyst.
Definition view.h:25
The Cutelyst namespace holds all public Cutelyst API.