5#ifndef CUTELYST_CONTEXT_H
6#define CUTELYST_CONTEXT_H
8#include <Cutelyst/async.h>
9#include <Cutelyst/cutelyst_global.h>
10#include <Cutelyst/request.h>
12#include <QtCore/QObject>
13#include <QtCore/QStack>
14#include <QtCore/QStringList>
16#include <QtCore/QVariant>
41 Q_PROPERTY(
Action *action READ action CONSTANT)
42 Q_PROPERTY(
QString actionName READ actionName CONSTANT)
43 Q_PROPERTY(
QString ns READ ns CONSTANT)
44 Q_PROPERTY(
QString namespace READ ns CONSTANT)
45 Q_PROPERTY(
Request *req READ request CONSTANT)
46 Q_PROPERTY(
Request *request READ request CONSTANT)
47 Q_PROPERTY(
Controller *controller READ controller CONSTANT)
48 Q_PROPERTY(
QString controllerName READ controllerName CONSTANT)
49 Q_PROPERTY(QVariantMap config READ config CONSTANT)
50 Q_PROPERTY(
bool state READ state CONSTANT)
63 bool error()
const noexcept;
68 void error(
const QString &error);
78 bool state()
const noexcept;
84 void setState(
bool state)
noexcept;
89 Engine *engine()
const noexcept;
109 Action *action()
const noexcept;
114 QString actionName()
const noexcept;
129 Request *request()
const noexcept;
144 QString controllerName()
const;
172 View *customView()
const noexcept;
185 bool setCustomView(
const QString &name);
208 void stash(
const QVariantHash &unite);
221 QVariantHash &stash();
244 bool stashRemove(
const QString &key);
346 bool detached()
const noexcept;
353 void detach(
Action *action =
nullptr);
370 void detachAsync()
noexcept;
419 bool forward(
const QString &action);
439 template <
typename T>
442 const auto pluginsConst = plugins();
443 for (
Plugin *plugin : pluginsConst) {
444 auto p = qobject_cast<T>(plugin);
464 QLocale locale() const noexcept;
480 void setLocale(const
QLocale &locale);
490 QVariantMap config() const noexcept;
505 QString translate(const
char *context,
506 const
char *sourceText,
507 const
char *disambiguation =
nullptr,
544 inline
QString qtTrId(const
char *
id,
int n = -1) const;
557 Context(ContextPrivate *priv);
559 friend class Application;
561 friend class ActionChain;
562 friend class DispatchType;
565 friend class Controller;
567 ContextPrivate *d_ptr;
570 Q_DECLARE_PRIVATE(Context)
588inline QString Context::qtTrId(
const char *
id,
int n)
const
590 return translate(
nullptr,
id,
nullptr, n);
This class represents a Cutelyst Action.
The Cutelyst Application.
The Cutelyst Component base class.
T plugin()
Returns the registered plugin that casts to the template type T.
Cutelyst Controller base class
Cutelyst View abstract view component
The Cutelyst namespace holds all public Cutelyst API.