cutelyst 4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
cuteleeview.h
1/*
2 * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#ifndef CUTELEE_VIEW_H
6#define CUTELEE_VIEW_H
7
8#include <Cutelyst/View>
9
10#include <QLocale>
11#include <QObject>
12#include <QStringList>
13#include <QVector>
14
15class QTranslator;
16
17namespace Cutelee {
18class Engine;
19}
20
21namespace Cutelyst {
22
23class CuteleeViewPrivate;
137class CUTELYST_VIEW_CUTELEE_EXPORT CuteleeView final : public View
138{
139 Q_OBJECT
140 Q_DECLARE_PRIVATE(CuteleeView)
141public:
148 explicit CuteleeView(QObject *parent = nullptr, const QString &name = QString());
149
150 Q_PROPERTY(QStringList includePaths READ includePaths WRITE setIncludePaths NOTIFY changed)
154 QStringList includePaths() const;
155
159 void setIncludePaths(const QStringList &paths);
160
161 Q_PROPERTY(
162 QString templateExtension READ templateExtension WRITE setTemplateExtension NOTIFY changed)
166 QString templateExtension() const;
167
171 void setTemplateExtension(const QString &extension);
172
173 Q_PROPERTY(QString wrapper READ wrapper WRITE setWrapper NOTIFY changed)
174
175
178 [[nodiscard]] QString wrapper() const;
179
184 void setWrapper(const QString &name);
185
186 Q_PROPERTY(bool cache READ isCaching WRITE setCache NOTIFY changed)
190 bool isCaching() const;
191
196 void setCache(bool enable);
197
201 [[nodiscard]] Cutelee::Engine *engine() const;
202
206 void preloadTemplates();
207
208 QByteArray render(Context *c) const override final;
209
244 void addTranslator(const QLocale &locale, QTranslator *translator);
245
258 void addTranslator(const QString &locale, QTranslator *translator);
259
291 void addTranslationCatalog(const QString &path, const QString &catalog);
292
303 void addTranslationCatalogs(const QMultiHash<QString, QString> &catalogs);
304
335 QVector<QLocale> loadTranslationsFromDir(const QString &filename,
336 const QString &directory,
337 const QString &prefix = QStringLiteral("."),
338 const QString &suffix = QStringLiteral(".qm"));
339
340Q_SIGNALS:
341 void changed();
342};
343
344} // namespace Cutelyst
345
346#endif // CUTELEE_VIEW_H
The Cutelyst Context.
Definition context.h:42
A view that renders templates using Cutelee engine.
Abstract View component for Cutelyst.
Definition view.h:25
The Cutelyst namespace holds all public Cutelyst API.