cutelyst 4.0.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;
17class CUTELYST_LIBRARY DispatchType : public QObject
18{
19 Q_OBJECT
20public:
22 enum MatchType {
23 NoMatch = 0,
24 PartialMatch,
25 ExactMatch,
26 };
27 Q_ENUM(MatchType)
28
29
32 explicit DispatchType(QObject *parent = nullptr);
33 virtual ~DispatchType();
34
39 virtual QByteArray list() const = 0;
40
44 [[nodiscard]] virtual MatchType
45 match(Context *c, QStringView path, const QStringList &args) const = 0;
46
50 [[nodiscard]] virtual QString uriForAction(Action *action,
51 const QStringList &captures) const = 0;
52
56 [[nodiscard]] virtual Action *expandAction(const Context *c, Action *action) const;
57
63 virtual bool registerAction(Action *action);
64
75 virtual bool inUse() = 0;
76
82 virtual bool isLowPrecedence() const;
83
84protected:
85 friend class Dispatcher;
86 friend class Application;
87
91 void setupMatchedAction(Context *c, Action *action) const;
92};
93
94} // namespace Cutelyst
This class represents a Cutelyst Action.
Definition: action.h:35
The Cutelyst Application.
Definition: application.h:43
The Cutelyst Context.
Definition: context.h:38
virtual bool inUse()=0
virtual QByteArray list() const =0
list the registered actions To be implemented by subclasses
virtual MatchType match(Context *c, QStringView path, const QStringList &args) const =0
The Cutelyst Dispatcher.
Definition: dispatcher.h:27
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8