cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::StatusMessage Class Reference
Inheritance diagram for Cutelyst::StatusMessage:

Public Member Functions

 StatusMessage (Application *parent)
 
QString errorMgStashKey () const
 
QString sessionPrefix () const
 
void setErrorMgStashKey (const QString &errorMgStashKey)
 
void setSessionPrefix (const QString &sessionPrefix)
 
void setStatusMsgStashKey (const QString &statusMsgStashKey)
 
void setTokenParam (const QString &tokenParam)
 
QString statusMsgStashKey () const
 
QString tokenParam () const
 
- Public Member Functions inherited from Cutelyst::Plugin
 Plugin (Application *parent)
 

Static Public Member Functions

static QString error (Context *c, const QString &msg)
 
static ParamsMultiMap errorQuery (Context *c, const QString &msg, ParamsMultiMap query=ParamsMultiMap())
 
static void load (Context *c)
 
static QString status (Context *c, const QString &msg)
 
static ParamsMultiMap statusQuery (Context *c, const QString &msg, ParamsMultiMap query=ParamsMultiMap())
 

Protected Member Functions

virtual bool setup (Application *app) override
 

Detailed Description

Definition at line 15 of file statusmessage.h.

Constructor & Destructor Documentation

◆ StatusMessage()

StatusMessage::StatusMessage ( Application * parent)

Constructs a new status message object with the given Application parent.

Definition at line 40 of file statusmessage.cpp.

References Cutelyst::Plugin::Plugin().

Referenced by errorMgStashKey(), sessionPrefix(), setErrorMgStashKey(), setSessionPrefix(), setStatusMsgStashKey(), setTokenParam(), statusMsgStashKey(), and tokenParam().

◆ ~StatusMessage()

StatusMessage::~StatusMessage ( )
overridevirtual

Definition at line 47 of file statusmessage.cpp.

Member Function Documentation

◆ error()

QString StatusMessage::error ( Context * c,
const QString & msg )
static

Saves an error message returning the generated message id (mid)

Definition at line 139 of file statusmessage.cpp.

References Cutelyst::Session::setValue().

◆ errorMgStashKey()

QString StatusMessage::errorMgStashKey ( ) const

Returns the name of the stash key where error messages are loaded when load() is called.

Definition at line 88 of file statusmessage.cpp.

References StatusMessage().

Referenced by setErrorMgStashKey().

◆ errorQuery()

ParamsMultiMap StatusMessage::errorQuery ( Context * c,
const QString & msg,
ParamsMultiMap query = ParamsMultiMap() )
static

Saves an error message returning query parameters with the generated message id (mid) and it's token

Definition at line 152 of file statusmessage.cpp.

References Cutelyst::Session::setValue().

◆ load()

void StatusMessage::load ( Context * c)
static

Load both messages that match the token param (mid=###) into the stash for display by the view.

Definition at line 100 of file statusmessage.cpp.

References Cutelyst::Session::deleteValues(), Cutelyst::Request::queryParam(), Cutelyst::Context::setStash(), and Cutelyst::Session::value().

◆ sessionPrefix()

QString StatusMessage::sessionPrefix ( ) const

Returns the key prefix inside Session where messages will be stored.

Definition at line 52 of file statusmessage.cpp.

References StatusMessage().

Referenced by setSessionPrefix().

◆ setErrorMgStashKey()

void StatusMessage::setErrorMgStashKey ( const QString & errorMgStashKey)

Sets the name of the stash key where error messages are loaded when load() is called. Defaults to error_msg.

Definition at line 94 of file statusmessage.cpp.

References StatusMessage(), and errorMgStashKey().

◆ setSessionPrefix()

void StatusMessage::setSessionPrefix ( const QString & sessionPrefix)

Sets the key prefix inside Session where messages will be stored. Defaults to "status_msg".

Definition at line 58 of file statusmessage.cpp.

References StatusMessage(), and sessionPrefix().

◆ setStatusMsgStashKey()

void StatusMessage::setStatusMsgStashKey ( const QString & statusMsgStashKey)

Sets the name of the stash key where "success" status messages are loaded when load() is called. Defaults to status_msg.

Definition at line 82 of file statusmessage.cpp.

References StatusMessage(), and statusMsgStashKey().

◆ setTokenParam()

void StatusMessage::setTokenParam ( const QString & tokenParam)

Sets the name of the URL param that holds the token on the page where you want to retrieve/display the status message. Defaults to "mid".

Definition at line 70 of file statusmessage.cpp.

References StatusMessage(), and tokenParam().

◆ setup()

bool StatusMessage::setup ( Application * app)
overrideprotectedvirtual

Reimplemented from Plugin::setup().

Reimplemented from Cutelyst::Plugin.

Definition at line 195 of file statusmessage.cpp.

References Cutelyst::Application::postForked().

◆ status()

QString StatusMessage::status ( Context * c,
const QString & msg )
static

Saves a status message returning the generated message id (mid)

Definition at line 167 of file statusmessage.cpp.

References Cutelyst::Session::setValue().

◆ statusMsgStashKey()

QString StatusMessage::statusMsgStashKey ( ) const

Returns the name of the stash key where "success" status messages are loaded when load() is called. Defaults to status_msg.

Definition at line 76 of file statusmessage.cpp.

References StatusMessage().

Referenced by setStatusMsgStashKey().

◆ statusQuery()

ParamsMultiMap StatusMessage::statusQuery ( Context * c,
const QString & msg,
ParamsMultiMap query = ParamsMultiMap() )
static

Saves an status message returning query parameters with the generated message id (mid) and it's token

Definition at line 180 of file statusmessage.cpp.

References Cutelyst::Session::setValue().

◆ tokenParam()

QString StatusMessage::tokenParam ( ) const

Returns the name of the URL param that holds the token on the page where you want to retrieve/display the status message.

Definition at line 64 of file statusmessage.cpp.

References StatusMessage().

Referenced by setTokenParam().