cutelyst 4.3.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
dispatchtype.h
1/*
2 * SPDX-FileCopyrightText: (C) 2013-2023 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#pragma once
6
7#include <Cutelyst/cutelyst_global.h>
8
9#include <QtCore/qobject.h>
10#include <QtCore/qstringlist.h>
11
12namespace Cutelyst {
13
14class Context;
15class Action;
16class Request;
24class CUTELYST_LIBRARY DispatchType : public QObject
25{
26 Q_OBJECT
27public:
29 enum MatchType {
30 NoMatch = 0,
31 PartialMatch,
32 ExactMatch,
33 };
34 Q_ENUM(MatchType)
35
36
39 explicit DispatchType(QObject *parent = nullptr);
40
44 virtual ~DispatchType();
45
50 virtual QByteArray list() const = 0;
51
56 [[nodiscard]] virtual MatchType
57 match(Context *c, QStringView path, const QStringList &args) const = 0;
58
63 [[nodiscard]] virtual QString uriForAction(Action *action,
64 const QStringList &captures) const = 0;
65
70 [[nodiscard]] virtual Action *expandAction(const Context *c, Action *action) const;
71
76 virtual bool registerAction(Action *action);
77
88 virtual bool inUse() = 0;
89
97 virtual bool isLowPrecedence() const;
98
99protected:
100 friend class Dispatcher;
101 friend class Application;
102
106 void setupMatchedAction(Context *c, Action *action) const;
107};
108
109} // namespace Cutelyst
This class represents a Cutelyst Action.
Definition action.h:36
The Cutelyst application.
Definition application.h:66
The Cutelyst Context.
Definition context.h:42
Abstract class to described a dispatch type.
virtual bool inUse()=0
virtual QByteArray list() const =0
virtual MatchType match(Context *c, QStringView path, const QStringList &args) const =0
The Cutelyst Dispatcher.
Definition dispatcher.h:29
The Cutelyst namespace holds all public Cutelyst API.