cutelyst  3.7.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-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 <QtCore/qobject.h>
9 #include <QtCore/qstringlist.h>
10 
11 #include <Cutelyst/cutelyst_global.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 {
24  NoMatch = 0,
25  PartialMatch,
26  ExactMatch
27  };
28  Q_ENUM(MatchType)
29 
30 
33  explicit DispatchType(QObject *parent = nullptr);
34  virtual ~DispatchType();
35 
40  virtual QByteArray list() const = 0;
41 
45  virtual MatchType match(Context *c, const QString &path, const QStringList &args) const = 0;
46 
50  virtual QString uriForAction(Action *action, const QStringList &captures) const = 0;
51 
55  virtual Action *expandAction(const Context *c, Action *action) const;
56 
62  virtual bool registerAction(Action *action);
63 
74  virtual bool inUse() = 0;
75 
81  virtual bool isLowPrecedence() const;
82 
83 protected:
84  friend class Dispatcher;
85  friend class Application;
86 
90  void setupMatchedAction(Context *c, Action *action) const;
91 };
92 
93 }
94 
95 #endif // DISPATCHTYPE_H
This class represents a Cutelyst Action.
Definition: action.h:35
The Cutelyst Application.
Definition: application.h:43
The Cutelyst Context.
Definition: context.h:39
virtual MatchType match(Context *c, const QString &path, const QStringList &args) const =0
virtual bool inUse()=0
virtual QByteArray list() const =0
list the registered actions To be implemented by subclasses
The Cutelyst Dispatcher.
Definition: dispatcher.h:28
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8