cutelyst  4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
view.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2013-2023 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #pragma once
6 
7 #include <Cutelyst/component.h>
8 #include <Cutelyst/cutelyst_export.h>
9 
10 #include <QObject>
11 
12 namespace Cutelyst {
13 
14 class Context;
15 class ViewPrivate;
16 
24 class CUTELYST_EXPORT View : public Component
25 {
26  Q_OBJECT
27  Q_DECLARE_PRIVATE(View)
28 public:
33  explicit View(QObject *parent, const QString &name);
34 
38  virtual ~View() override = default;
39 
43  Modifiers modifiers() const override;
44 
51  [[nodiscard]] virtual QByteArray render(Context *c) const = 0;
52 
59  void setMinimalSizeToDeflate(qint32 minSize = -1);
60 
61 private:
66  bool doExecute(Context *c) final;
67 
68 protected:
73  explicit View(ViewPrivate *d, QObject *parent, const QString &name);
74 };
75 
76 } // namespace Cutelyst
The Cutelyst Component base class.
Definition: component.h:30
The Cutelyst Context.
Definition: context.h:42
Abstract View component for Cutelyst.
Definition: view.h:25
virtual QByteArray render(Context *c) const =0
virtual ~View() override=default
The Cutelyst namespace holds all public Cutelyst API.