cutelyst  3.9.1
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-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef DISPATCHTYPE_H
6 #define DISPATCHTYPE_H
7 
8 #include <Cutelyst/cutelyst_global.h>
9 
10 #include <QtCore/qobject.h>
11 #include <QtCore/qstringlist.h>
12 
13 namespace Cutelyst {
14 
15 class Context;
16 class Action;
17 class Request;
18 class CUTELYST_LIBRARY DispatchType : public QObject
19 {
20  Q_OBJECT
21 public:
23  enum MatchType { NoMatch = 0, PartialMatch, ExactMatch };
24  Q_ENUM(MatchType)
25 
26 
29  explicit DispatchType(QObject *parent = nullptr);
30  virtual ~DispatchType();
31 
36  virtual QByteArray list() const = 0;
37 
41  virtual MatchType match(Context *c, const QString &path, const QStringList &args) const = 0;
42 
46  virtual QString uriForAction(Action *action, const QStringList &captures) const = 0;
47 
51  virtual Action *expandAction(const Context *c, Action *action) const;
52 
58  virtual bool registerAction(Action *action);
59 
70  virtual bool inUse() = 0;
71 
77  virtual bool isLowPrecedence() const;
78 
79 protected:
80  friend class Dispatcher;
81  friend class Application;
82 
86  void setupMatchedAction(Context *c, Action *action) const;
87 };
88 
89 } // namespace Cutelyst
90 
91 #endif // DISPATCHTYPE_H
This class represents a Cutelyst Action.
Definition: action.h:34
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
The Cutelyst Application.
Definition: application.h:42
The Cutelyst Dispatcher.
Definition: dispatcher.h:27