5 #ifndef CUTELYST_CONTEXT_H 6 #define CUTELYST_CONTEXT_H 8 #include <QtCore/QObject> 9 #include <QtCore/QVariant> 10 #include <QtCore/QUrl> 11 #include <QtCore/QStringList> 12 #include <QtCore/QStack> 14 #include <Cutelyst/async.h> 15 #include <Cutelyst/request.h> 16 #include <Cutelyst/cutelyst_global.h> 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;
167 View *customView()
const noexcept;
180 bool setCustomView(
const QString &name);
203 void stash(
const QVariantHash &unite);
216 QVariantHash &stash();
239 bool stashRemove(
const QString &key);
344 bool detached()
const noexcept;
351 void detach(
Action *action =
nullptr);
368 void detachAsync() noexcept;
417 bool forward(
const QString &action);
437 template <
typename T>
440 const auto pluginsConst = plugins();
441 for (
Plugin *plugin : pluginsConst) {
442 auto p = qobject_cast<T>(plugin);
462 QLocale locale() const noexcept;
478 void setLocale(const
QLocale &locale);
488 QVariantMap config() const noexcept;
503 QString translate(const
char *context, const
char *sourceText, const
char *disambiguation =
nullptr,
int n = -1) const;
516 Context(ContextPrivate *priv);
518 friend class Application;
520 friend class ActionChain;
521 friend class DispatchType;
524 friend class Controller;
526 ContextPrivate *d_ptr;
529 Q_DECLARE_PRIVATE(Context)
533 {
return uriFor(path,
QStringList(), queryValues); }
545 #endif // CUTELYST_CONTEXT_H QUrl uriFor(const QString &path=QString(), const QStringList &args=QStringList(), const ParamsMultiMap &queryValues=ParamsMultiMap()) const
QMultiMap< QString, QString > ParamsMultiMap
The Cutelyst Component base class.
This class represents a Cutelyst Action.
QUrl uriForAction(const QString &path, const QStringList &captures=QStringList(), const QStringList &args=QStringList(), const ParamsMultiMap &queryValues=ParamsMultiMap()) const
Cutelyst Controller base class
T plugin()
Returns the registered plugin that casts to the template type T.
The Cutelyst namespace holds all public Cutelyst API.
Cutelyst View abstract view component
The Cutelyst Application.