Cutelyst  1.8.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
[legend]

Public Member Functions

 View (QObject *parent, const QString &name=QString())
 
virtual Modifiers modifiers () const override
 
QString name () const
 
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,
  AfterExecute
}
 
- 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 35 of file view.h.

Constructor & Destructor Documentation

Cutelyst::View::View ( QObject *  parent,
const QString &  name = QString() 
)
explicit

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

Member Function Documentation

virtual Modifiers Cutelyst::View::modifiers ( ) const
overridevirtual

The default implementation returns Component::OnlyExecute

Reimplemented from Cutelyst::Component.

QString Cutelyst::View::name ( ) const

Returns the name of the view

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.