|
cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|

Signals | |
| void | processRequestAsync (Cutelyst::EngineRequest *request) |
Public Member Functions | |
| Engine (Application *app, int workerCore, const QVariantMap &opts) | |
| Application * | app () const |
| application | |
| QVariantMap | config (const QString &entity) const |
| user configuration for the application | |
| bool | isZeroWorker () const |
| QVariantMap | opts () const |
| void | processRequest (EngineRequest *request) |
| void | setConfig (const QVariantMap &config) |
| virtual quint64 | time () |
| int | workerCore () const |
| Each worker process migth have a number of worker cores (threads), a single process with two worker threads will return 0 and 1 for each of the thread respectively. | |
| virtual int | workerId () const =0 |
| The id is the number of the spawned engine process, a single process workerId = 0, two process 0 for the first 1 for the second. | |
| Public Member Functions inherited from QObject | |
| QObject (QObject *parent) | |
| bool | blockSignals (bool block) |
| const QObjectList & | children () const const |
| QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
| void | deleteLater () |
| void | destroyed (QObject *obj) |
| bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
| bool | disconnect (const QObject *receiver, const char *method) const const |
| void | dumpObjectInfo () |
| void | dumpObjectInfo () const const |
| void | dumpObjectTree () |
| void | dumpObjectTree () const const |
| QList< QByteArray > | dynamicPropertyNames () const const |
| virtual bool | event (QEvent *e) |
| virtual bool | eventFilter (QObject *watched, QEvent *event) |
| T | findChild (const QString &name, Qt::FindChildOptions options) const const |
| QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
| QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
| QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
| bool | inherits (const char *className) const const |
| void | installEventFilter (QObject *filterObj) |
| bool | isWidgetType () const const |
| bool | isWindowType () const const |
| void | killTimer (int id) |
| virtual const QMetaObject * | metaObject () const const |
| void | moveToThread (QThread *targetThread) |
| QString | objectName () const const |
| void | objectNameChanged (const QString &objectName, QPrivateSignal) |
| QObject * | parent () const const |
| QVariant | property (const char *name) const const |
| Q_CLASSINFO (Name, Value) | |
| Q_DISABLE_COPY (Class) | |
| Q_DISABLE_COPY_MOVE (Class) | |
| Q_DISABLE_MOVE (Class) | |
| Q_EMIT Q_EMIT | |
| Q_ENUM (...) | |
| Q_ENUM_NS (...) | |
| Q_ENUMS (...) | |
| Q_FLAG (...) | |
| Q_FLAG_NS (...) | |
| Q_FLAGS (...) | |
| Q_GADGET Q_GADGET | |
| Q_INTERFACES (...) | |
| Q_INVOKABLE Q_INVOKABLE | |
| Q_NAMESPACE Q_NAMESPACE | |
| Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
| Q_OBJECT Q_OBJECT | |
| Q_PROPERTY (...) | |
| Q_REVISION Q_REVISION | |
| Q_SET_OBJECT_NAME (Object) | |
| Q_SIGNAL Q_SIGNAL | |
| Q_SIGNALS Q_SIGNALS | |
| Q_SLOT Q_SLOT | |
| Q_SLOTS Q_SLOTS | |
| T | qFindChild (const QObject *obj, const QString &name) |
| QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
| QList< T > | qFindChildren (const QObject *obj, const QString &name) |
| T | qobject_cast (const QObject *object) |
| T | qobject_cast (QObject *object) |
| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
| void | removeEventFilter (QObject *obj) |
| void | setObjectName (const QString &name) |
| void | setParent (QObject *parent) |
| bool | setProperty (const char *name, const QVariant &value) |
| bool | signalsBlocked () const const |
| int | startTimer (int interval, Qt::TimerType timerType) |
| int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
| QThread * | thread () const const |
Static Public Member Functions | |
| static void | camelCaseByteArrayHeader (QByteArray &key) |
| static QString | camelCaseHeader (const QString &headerKey) |
| static const char * | httpStatusMessage (quint16 status, int *len=nullptr) |
| static QVariantMap | loadIniConfig (const QString &filename) |
| static QVariantMap | loadJsonConfig (const QString &filename) |
| Static Public Member Functions inherited from QObject | |
| QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
| QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
| QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
| QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
| QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
| bool | disconnect (const QMetaObject::Connection &connection) |
| bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
| bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
| bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
| QString | tr (const char *sourceText, const char *disambiguation, int n) |
| QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions | |
| Headers & | defaultHeaders () |
| bool | initApplication () |
| initApplication | |
| bool | postForkApplication () |
| postForkApplication | |
| Protected Member Functions inherited from QObject | |
| virtual void | childEvent (QChildEvent *event) |
| virtual void | connectNotify (const QMetaMethod &signal) |
| virtual void | customEvent (QEvent *event) |
| virtual void | disconnectNotify (const QMetaMethod &signal) |
| bool | isSignalConnected (const QMetaMethod &signal) const const |
| int | receivers (const char *signal) const const |
| QObject * | sender () const const |
| int | senderSignalIndex () const const |
| virtual void | timerEvent (QTimerEvent *event) |
Friends | |
| class | Application |
| class | Response |
Additional Inherited Members | |
| Public Attributes inherited from QObject | |
| typedef | QObjectList |
| Properties inherited from QObject | |
| objectName | |
This class is responsible receiving the request and sending the response. It must be reimplemented by real HTTP engines due some pure virtual methods.
The subclass must create an Engine per thread (worker core), if the Application passed to the constructor has a worker core greater than 0 it will issue a new Application instance, failing to do so a fatal error is generated (usually indicating that the Application does not have a Q_INVOKABLE constructor).
|
explicit |
Constructs an Engine object, where app is the application that might be used to create new instances if workerCore is greater than 1, opts is the options loaded by the engine subclass.
| app | The application loaded |
| workerCore | The thread number |
| opts | The configuation options |
Definition at line 41 of file engine.cpp.
References Engine(), app(), QObject::connect(), opts(), processRequest(), processRequestAsync(), Qt::QueuedConnection, and workerCore().
Referenced by Engine(), app(), config(), defaultHeaders(), initApplication(), isZeroWorker(), opts(), postForkApplication(), processRequest(), processRequestAsync(), setConfig(), and workerCore().
|
virtual |
Definition at line 54 of file engine.cpp.
| Application * Engine::app | ( | ) | const |
Returns the application associated with this engine.
Definition at line 63 of file engine.cpp.
References Engine().
Referenced by Engine().
|
inlinestatic |
Convert Header key to camel case
Definition at line 127 of file engine.h.
References QChar::isLetter(), QByteArray::size(), and QChar::toLower().
Returns the header key in camel case form
Definition at line 103 of file engine.h.
References QChar::isLetter(), QString::size(), and QChar::toLower().
| QVariantMap Engine::config | ( | const QString & | entity | ) | const |
| entity | the entity you are interested in |
Definition at line 290 of file engine.cpp.
References Engine().
Referenced by Cutelyst::MemcachedSessionStore::MemcachedSessionStore(), setConfig(), Cutelyst::CSRFProtection::setup(), Cutelyst::Memcached::setup(), Cutelyst::Session::setup(), Cutelyst::StaticCompressed::setup(), and workerId().
|
protected |
This is the HTTP default response headers that each request gets
Definition at line 272 of file engine.cpp.
References Engine().
Referenced by processRequestAsync().
|
static |
Returns the HTTP status message for the given status.
Definition at line 131 of file engine.cpp.
|
protected |
This method inits the application and calls init on the engine. It must be called on the engine's thread
Definition at line 95 of file engine.cpp.
References Engine(), QThread::currentThread(), and QObject::thread().
Referenced by processRequestAsync().
|
inline |
Returns true if this is the Zero worker, ie if workerId() == 0 and workerCore() == 0
Definition at line 207 of file engine.h.
References Engine(), isZeroWorker(), workerCore(), and workerId().
Referenced by isZeroWorker(), and workerId().
|
static |
Returns a QVariantMap with the INI parsed from filename.
Definition at line 302 of file engine.cpp.
References QSettings::beginGroup(), QSettings::childGroups(), QSettings::childKeys(), QSettings::endGroup(), QSettings::IniFormat, QSettings::NoError, QSettings::status(), and QSettings::value().
Referenced by workerId().
|
static |
Returns a QVariantMap with the JSON parsed from filename.
Definition at line 326 of file engine.cpp.
References QJsonDocument::fromJson(), QFile::open(), QIODevice::readAll(), QIODevice::ReadOnly, QVariant::toMap(), and QJsonDocument::toVariant().
Referenced by workerId().
| QVariantMap Engine::opts | ( | ) | const |
Engine options
Definition at line 284 of file engine.cpp.
References Engine().
Referenced by Engine(), and workerId().
|
protected |
Subclasses must be call after the engine forks by the worker thread, if no forking is involved it must be called once the worker thread has started.
For convenience QThread::currentThread() has it's object name set with the worker core number.
Definition at line 112 of file engine.cpp.
References Engine(), QThread::currentThread(), QString::number(), and QObject::setObjectName().
Referenced by processRequestAsync().
| void Engine::processRequest | ( | EngineRequest * | request | ) |
Process the EngineRequest req, the caller must delete the context when the request is finished.
This method allows for engines to keep the Context alive while processing websocket data.
Definition at line 278 of file engine.cpp.
References Engine().
Referenced by Engine(), and workerId().
|
signal |
Process the EngineRequest req Async, the caller must delete the context when the request is finished.
This method allows for engines to keep the Context alive while processing websocket data.
References Engine(), defaultHeaders(), initApplication(), postForkApplication(), and processRequestAsync().
Referenced by Engine(), and processRequestAsync().
| void Engine::setConfig | ( | const QVariantMap & | config | ) |
Sets the configuration to be used by Application
Definition at line 296 of file engine.cpp.
References Engine(), and config().
Referenced by workerId().
|
virtual |
Definition at line 126 of file engine.cpp.
References QDateTime::currentMSecsSinceEpoch().
Referenced by workerId().
| int Engine::workerCore | ( | ) | const |
Returns the worker core set when constructing the engine
Definition at line 89 of file engine.cpp.
References Engine().
Referenced by Engine(), isZeroWorker(), and workerId().
|
pure virtual |
Reimplement this to get the workerId of the engine subclass, this is the same as processes id.
References config(), isZeroWorker(), loadIniConfig(), loadJsonConfig(), opts(), processRequest(), setConfig(), time(), and workerCore().
Referenced by isZeroWorker().