cutelyst 4.9.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::DispatchTypePath Class Referencefinal

Describes a path dispatch type. More...

#include <dispatchtypepath.h>

Inheritance diagram for Cutelyst::DispatchTypePath:

Public Member Functions

 DispatchTypePath (QObject *parent=nullptr)
 
 ~DispatchTypePath () override
 
bool inUse () override
 
QByteArray list () const override
 
MatchType match (Context *c, QStringView path, const QStringList &args) const override
 
bool registerAction (Action *action) override
 
QString uriForAction (Action *action, const QStringList &captures) const override
 
- Public Member Functions inherited from Cutelyst::DispatchType
 DispatchType (QObject *parent=nullptr)
 
virtual ~DispatchType ()
 
virtual ActionexpandAction (const Context *c, Action *action) const
 
virtual bool isLowPrecedence () const
 

Additional Inherited Members

- Public Types inherited from Cutelyst::DispatchType
enum  MatchType { NoMatch , PartialMatch , ExactMatch }
 
- Protected Member Functions inherited from Cutelyst::DispatchType
void setupMatchedAction (Context *c, Action *action) const
 

Detailed Description

Describes a path dispatch type.

Definition at line 22 of file dispatchtypepath.h.

Constructor & Destructor Documentation

◆ DispatchTypePath()

DispatchTypePath::DispatchTypePath ( QObject * parent = nullptr)
explicit

Constructs a new DispatchTypePath object with the given parent.

Definition at line 17 of file dispatchtypepath.cpp.

References Cutelyst::DispatchType::DispatchType().

Referenced by inUse(), list(), match(), and registerAction().

◆ ~DispatchTypePath()

DispatchTypePath::~DispatchTypePath ( )
override

Destroys the DispatchTypePath object.

Definition at line 23 of file dispatchtypepath.cpp.

Member Function Documentation

◆ inUse()

bool DispatchTypePath::inUse ( )
overridevirtual

If false the dispatcher will be unregistered for performance reasons. This method can be used to prepare actions for dispatcher as in a Chain of Actions there is no garantee of registering order.

In the common case if the dispatcher has registered any action, or in some special case that it doesn't need actions it will return true.

Implements Cutelyst::DispatchType.

Definition at line 118 of file dispatchtypepath.cpp.

References DispatchTypePath().

◆ list()

QByteArray DispatchTypePath::list ( ) const
overridevirtual

Lists the registered actions. Has to be implemented by subclasses.

Implements Cutelyst::DispatchType.

Definition at line 28 of file dispatchtypepath.cpp.

References DispatchTypePath(), Cutelyst::Action::attribute(), Cutelyst::Action::numberOfArgs(), and Cutelyst::Component::reverse().

◆ match()

Cutelyst::DispatchType::MatchType DispatchTypePath::match ( Context * c,
QStringView path,
const QStringList & args ) const
overridevirtual

◆ registerAction()

bool DispatchTypePath::registerAction ( Action * action)
overridevirtual

Register an action and return true on success. The default implementation does nothing and returns always true.

Reimplemented from Cutelyst::DispatchType.

Definition at line 101 of file dispatchtypepath.cpp.

References DispatchTypePath(), and Cutelyst::Action::attributes().

◆ uriForAction()

QString DispatchTypePath::uriForAction ( Cutelyst::Action * action,
const QStringList & captures ) const
overridevirtual

Get a URI part for an action. Always returns NULL if captures is not empty since Path actions don't have captures.

Implements Cutelyst::DispatchType.

Definition at line 124 of file dispatchtypepath.cpp.

References Cutelyst::Action::attributes().