TreeFrogFramework  2.8
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
TAbstractController Class Referenceabstract

#include <tabstractcontroller.h>

Inheritance diagram for TAbstractController:
Inheritance graph
[legend]
Collaboration diagram for TAbstractController:
Collaboration graph
[legend]

Public Member Functions

 TAbstractController ()
 
virtual ~TAbstractController ()
 
virtual QString className () const
 
virtual QString name () const =0
 
virtual QString activeAction () const =0
 
virtual QStringList arguments () const
 
virtual const THttpRequesthttpRequest () const
 
virtual const THttpRequestrequest () const
 
virtual const TSessionsession () const
 
virtual QString getRenderingData (const QString &templateName, const QVariantMap &vars=QVariantMap())
 
virtual QByteArray authenticityToken () const
 
virtual void setFlash (const QString &name, const QVariant &value)
 
void exportVariant (const QString &name, const QVariant &value, bool overwrite=true)
 
virtual bool isUserLoggedIn () const
 
const TActionContext * context () const
 
TActionContext * context ()
 
void setContext (TActionContext *context)
 

Static Public Member Functions

static QThread * currentThread ()
 

Protected Member Functions

virtual TSessionsession ()
 
virtual bool addCookie (const TCookie &cookie)
 
virtual bool addCookie (const QByteArray &name, const QByteArray &value, const QDateTime &expire=QDateTime(), const QString &path=QString(), const QString &domain=QString(), bool secure=false, bool httpOnly=false, const QByteArray &sameSite="Lax")
 
virtual bool addCookie (const QByteArray &name, const QByteArray &value, int64_t maxAge, const QString &path=QString(), const QString &domain=QString(), bool secure=false, bool httpOnly=false, const QByteArray &sameSite="Lax")
 
virtual void reset ()
 
QVariant variant (const QString &name) const
 
void exportVariants (const QVariantMap &map)
 
void exportValidationErrors (const TFormValidator &validator, const QString &prefix=QString("err_"))
 
bool hasVariant (const QString &name) const
 
const QVariantMap & allVariants () const
 
QString viewClassName (const QString &action=QString()) const
 
QString viewClassName (const QString &contoller, const QString &action) const
 

Friends

class TDirectView
 

Detailed Description

The TAbstractController class is the abstract base class of controllers, providing functionality common to controllers.

Constructor & Destructor Documentation

◆ TAbstractController()

TAbstractController::TAbstractController ( )

Constructor.

◆ ~TAbstractController()

virtual TAbstractController::~TAbstractController ( )
inlinevirtual

Member Function Documentation

◆ activeAction()

QString TAbstractController::activeAction ( ) const
pure virtual

This function is reimplemented in subclasses to return a active action name.

Implemented in TActionController, and TActionMailer.

◆ addCookie() [1/3]

bool TAbstractController::addCookie ( const QByteArray &  name,
const QByteArray &  value,
const QDateTime &  expire = QDateTime(),
const QString &  path = QString(),
const QString &  domain = QString(),
bool  secure = false,
bool  httpOnly = false,
const QByteArray &  sameSite = "Lax" 
)
protectedvirtual

Reimplemented in TActionController.

◆ addCookie() [2/3]

bool TAbstractController::addCookie ( const QByteArray &  name,
const QByteArray &  value,
int64_t  maxAge,
const QString &  path = QString(),
const QString &  domain = QString(),
bool  secure = false,
bool  httpOnly = false,
const QByteArray &  sameSite = "Lax" 
)
protectedvirtual

Reimplemented in TActionController.

◆ addCookie() [3/3]

bool TAbstractController::addCookie ( const TCookie cookie)
protectedvirtual

Reimplemented in TActionController.

◆ allVariants()

const QVariantMap & TAbstractController::allVariants ( ) const
inlineprotected

Returns all the exported variables.

Internal use only.

◆ arguments()

virtual QStringList TAbstractController::arguments ( ) const
inlinevirtual

Reimplemented in TActionController.

◆ authenticityToken()

virtual QByteArray TAbstractController::authenticityToken ( ) const
inlinevirtual

Reimplemented in TActionController.

◆ className()

QString TAbstractController::className ( ) const
inlinevirtual

Returns the class name.

◆ context() [1/2]

TActionContext* TAbstractController::context ( )
inline

◆ context() [2/2]

const TActionContext* TAbstractController::context ( ) const
inline

◆ currentThread()

static QThread* TAbstractController::currentThread ( )
inlinestatic

◆ exportValidationErrors()

void TAbstractController::exportValidationErrors ( const TFormValidator validator,
const QString &  prefix = QString("err_") 
)
protected

Exports validation error messages with the prefix prefix each.

◆ exportVariant()

void TAbstractController::exportVariant ( const QString &  name,
const QVariant &  value,
bool  overwrite = true 
)

Exports a new variable with the name name and a value of value for views.

Internal use only.

◆ exportVariants()

void TAbstractController::exportVariants ( const QVariantMap &  map)
protected

Exports the map.

Internal use only.

◆ getRenderingData()

QString TAbstractController::getRenderingData ( const QString &  templateName,
const QVariantMap &  vars = QVariantMap() 
)
virtual

Reimplemented in TActionController.

◆ hasVariant()

bool TAbstractController::hasVariant ( const QString &  name) const
inlineprotected

Returns true if a variable with the name is exported for views; otherwise returns false.

Internal use only.

◆ httpRequest()

const THttpRequest & TAbstractController::httpRequest ( ) const
virtual

Reimplemented in TActionController.

◆ isUserLoggedIn()

bool TAbstractController::isUserLoggedIn ( ) const
virtual

Returns true if a user is logged in to the system; otherwise returns false.

This is a virtual function.

See also
userLogin()

Reimplemented in TActionController.

◆ name()

QString TAbstractController::name ( ) const
pure virtual

This function is reimplemented in subclasses to return a controller name.

Implemented in TActionController, and TActionMailer.

◆ request()

const THttpRequest & TAbstractController::request ( ) const
virtual

Reimplemented in TActionController.

◆ reset()

virtual void TAbstractController::reset ( )
inlineprotectedvirtual

Reimplemented in TActionController.

◆ session() [1/2]

TSession & TAbstractController::session ( )
protectedvirtual

Reimplemented in TActionController.

◆ session() [2/2]

const TSession & TAbstractController::session ( ) const
virtual

Reimplemented in TActionController.

◆ setContext()

void TAbstractController::setContext ( TActionContext *  context)
inline

◆ setFlash()

void TAbstractController::setFlash ( const QString &  name,
const QVariant &  value 
)
virtual

Reimplemented in TActionController.

◆ variant()

QVariant TAbstractController::variant ( const QString &  name) const
inlineprotected

Returns the exported variable with the value associated with the name.

◆ viewClassName() [1/2]

QString TAbstractController::viewClassName ( const QString &  action = QString()) const
protected

Returns a class name of a view for the action action of the active controller.

Internal use only.

◆ viewClassName() [2/2]

QString TAbstractController::viewClassName ( const QString &  contoller,
const QString &  action 
) const
protected

Returns a class name of a view for the action action of the controller controller.

Internal use only.

Friends And Related Function Documentation

◆ TDirectView

friend class TDirectView
friend

The documentation for this class was generated from the following files: