5#ifndef CUTELYST_APPLICATION_H
6#define CUTELYST_APPLICATION_H
8#include <Cutelyst/cutelyst_export.h>
10#include <QtCore/QLocale>
11#include <QtCore/QObject>
12#include <QtCore/QVariant>
13#include <QtCore/QVector>
19#define CUTELYST_APPLICATION(x) \
20 Q_PLUGIN_METADATA(x) \
21 Q_INTERFACES(Cutelyst::Application)
35class ApplicationPrivate;
136 template <
typename T>
139 const auto pluginsConst =
plugins();
140 for (
Plugin *pluginPtr : pluginsConst) {
159 QVariantMap config() const noexcept;
181 bool inited() const noexcept;
186 Engine *engine() const noexcept;
197 static const
char *cutelystVersion() noexcept;
279 const
char *sourceText,
280 const
char *disambiguation =
nullptr,
315 void loadTranslations(const
QString &filename,
318 const QString &suffix = {});
353 QVector<QLocale> loadTranslationsFromDir(
const QString &filename,
354 const QString &directory = {},
355 const QString &prefix = QStringLiteral(
"."),
356 const QString &suffix = QStringLiteral(
".qm"));
384 QVector<QLocale> loadTranslationsFromDirs(
const QString &directory,
const QString &filename);
394 [[nodiscard]] QLocale defaultLocale() const noexcept;
404 void setDefaultLocale(const QLocale &locale);
441 virtual
bool postFork();
448 Headers &defaultHeaders() noexcept;
453 void addXCutelystVersionHeader();
462 bool registerPlugin(Plugin *plugin);
474 bool registerController(Controller *controller);
483 bool registerView(View *view);
489 bool registerDispatcher(DispatchType *dispatcher);
547 friend class Context;
564 ApplicationPrivate *d_ptr;
569#define CutelystApplicationInterface_iid "org.cutelyst.CutelystApplicationInterface"
The Cutelyst application.
Engine * engine() const noexcept
void shuttingDown(Cutelyst::Application *app)
QVector< Controller * > controllers() const noexcept
void afterDispatch(Cutelyst::Context *c)
bool setup(Engine *engine)
void handleRequest(Cutelyst::EngineRequest *request)
void beforePrepareAction(Cutelyst::Context *c, bool *skipMethod)
Application(QObject *parent=nullptr)
void setConfig(const QString &key, const QVariant &value)
Dispatcher * dispatcher() const noexcept
View * view(QStringView name={}) const
void beforeDispatch(Cutelyst::Context *c)
void preForked(Cutelyst::Application *app)
QVector< Plugin * > plugins() const noexcept
QVector< DispatchType * > dispatchers() const noexcept
QVariant config(const QString &key, const QVariant &defaultValue={}) const
void postForked(Cutelyst::Application *app)
The Cutelyst Component base class.
Cutelyst Controller base class.
Abstract class to described a dispatch type.
Base class for Cutelyst Plugins.
Abstract View component for Cutelyst.
The Cutelyst namespace holds all public Cutelyst API.
QObject * parent() const const
T qobject_cast(QObject *object)