Cutelyst  2.5.0
Public Member Functions | List of all members
Cutelyst::View Class Referenceabstract

Cutelyst View abstract view component More...

#include <Cutelyst/View>

Inheritance diagram for Cutelyst::View:
Inheritance graph

Public Member Functions

 View (QObject *parent, const QString &name)
virtual Modifiers modifiers () const override
virtual QByteArray render (Context *c) const =0
- Public Member Functions inherited from Cutelyst::Component
 Component (QObject *parent=nullptr)
bool execute (Context *c)
virtual bool init (Application *application, const QVariantHash &args)
QString name () const
QString reverse () const
void setName (const QString &name)
void setReverse (const QString &reverse)

Additional Inherited Members

- Public Types inherited from Cutelyst::Component
enum  Modifier {
  None, OnlyExecute, BeforeExecute, AroundExecute,
- Protected Member Functions inherited from Cutelyst::Component
virtual bool afterExecute (Context *c)
void applyRoles (const QStack< Component *> &roles)
virtual bool aroundExecute (Context *c, QStack< Component *> stack)
virtual bool beforeExecute (Context *c)
virtual bool dispatcherReady (const Dispatcher *dispatch, Controller *controller)

Detailed Description

Definition at line 33 of file view.h.

Constructor & Destructor Documentation

◆ View()

View::View ( QObject *  parent,
const QString &  name 

The base implementation for a View class, a name for the view should be set to be found by Context->view()

Definition at line 31 of file view.cpp.

References Cutelyst::Component::setName().

Member Function Documentation

◆ modifiers()

Component::Modifiers View::modifiers ( ) const

The default implementation returns Component::OnlyExecute

Reimplemented from Cutelyst::Component.

Definition at line 40 of file view.cpp.

References Cutelyst::Context::error(), Cutelyst::Context::errors(), Cutelyst::Response::hasBody(), render(), Cutelyst::Context::response(), and Cutelyst::Response::setBody().

◆ render()

virtual QByteArray Cutelyst::View::render ( Context c) const
pure virtual

All subclasses must reimplement this when doing it's rendering. If an error (c->error()) is not set c->response()->body() is defined with the returned value, this is useful if the view is not meant to be used as a body.

Implemented in Cutelyst::ViewEmail, Cutelyst::GrantleeView, Cutelyst::ViewJson, Cutelyst::ClearSilver, and Cutelyst::ViewEmailTemplate.

Referenced by modifiers(), and Cutelyst::ViewEmailTemplate::setDefaultView().