cutelyst 3.9.1
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;
35class CUTELYST_VIEW_CUTELEE_EXPORT CuteleeView final : public View
36{
38 Q_DECLARE_PRIVATE(CuteleeView)
39public:
43 explicit CuteleeView(QObject *parent = nullptr, const QString &name = QString());
44
45 Q_PROPERTY(QStringList includePaths READ includePaths WRITE setIncludePaths NOTIFY changed)
49 QStringList includePaths() const;
50
54 void setIncludePaths(const QStringList &paths);
55
57 QString templateExtension READ templateExtension WRITE setTemplateExtension NOTIFY changed)
61 QString templateExtension() const;
62
66 void setTemplateExtension(const QString &extension);
67
68 Q_PROPERTY(QString wrapper READ wrapper WRITE setWrapper NOTIFY changed)
69
70
73 QString wrapper() const;
74
79 void setWrapper(const QString &name);
80
81 Q_PROPERTY(bool cache READ isCaching WRITE setCache NOTIFY changed)
85 bool isCaching() const;
86
91 void setCache(bool enable);
92
96 Cutelee::Engine *engine() const;
97
101 void preloadTemplates();
102
103 QByteArray render(Context *c) const final;
104
134 void addTranslator(const QLocale &locale, QTranslator *translator);
135
147 void addTranslator(const QString &locale, QTranslator *translator);
148
178 void addTranslationCatalog(const QString &path, const QString &catalog);
179
189
219 const QString &directory,
220 const QString &prefix = QStringLiteral("."),
221 const QString &suffix = QStringLiteral(".qm"));
222
224 void changed();
225};
226
227} // namespace Cutelyst
228
229#endif // CUTELEE_VIEW_H
QString name() const
Definition component.cpp:33
The Cutelyst Context.
Definition context.h:39
void setWrapper(const QString &name)
Sets the template wrapper name, the template will be rendered into content variable in which the wrap...
CuteleeView(QObject *parent=nullptr, const QString &name=QString())
Constructs a CuteleeView object with the given parent and name.
void addTranslator(const QLocale &locale, QTranslator *translator)
QByteArray render(Context *c) const final
void setTemplateExtension(const QString &extension)
Sets the template extension, defaults to ".html".
void addTranslationCatalogs(const QMultiHash< QString, QString > &catalogs)
QVector< QLocale > loadTranslationsFromDir(const QString &filename, const QString &directory, const QString &prefix=QStringLiteral("."), const QString &suffix=QStringLiteral(".qm"))
bool isCaching() const
Returns true if caching is enabled.
Cutelee::Engine * engine() const
void addTranslationCatalog(const QString &path, const QString &catalog)
void setCache(bool enable)
Sets if template caching should be done, this increases performance at the cost of higher memory usag...
void setIncludePaths(const QStringList &paths)
Sets the list of include paths which will be looked for when resolving templates files.
View(QObject *parent, const QString &name)
Definition view.cpp:18
The Cutelyst namespace holds all public Cutelyst API.
Definition Mainpage.dox:8
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const