SNode.C
Loading...
Searching...
No Matches
express::Route Class Reference

#include <Route.h>

Inheritance diagram for express::Route:
Collaboration diagram for express::Route:

Public Member Functions

 Route (const std::string &method, const std::string &relativeMountPath, const std::shared_ptr< Dispatcher > &dispatcher)
 
Routeuse (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routeuse (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routeuse (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routeuse (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routeall (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routeall (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routeall (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routeall (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routeget (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routeget (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routeget (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routeget (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routeput (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routeput (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routeput (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routeput (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routepost (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routepost (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routepost (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routepost (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routedel (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routedel (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routedel (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routedel (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routeconnect (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routeconnect (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routeconnect (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routeconnect (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routeoptions (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routeoptions (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routeoptions (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routeoptions (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routetrace (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routetrace (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routetrace (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routetrace (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routepatch (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routepatch (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routepatch (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routepatch (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 
Routehead (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda) const
 
Routehead (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda) const
 
template<typename... Lambdas>
Routehead (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &lambda, Lambdas... lambdas) const
 
template<typename... Lambdas>
Routehead (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> &lambda, Lambdas... lambdas) const
 

Protected Member Functions

 Route ()
 
bool dispatch (Controller &controller)
 
bool dispatch (Controller &controller, const std::string &parentMountPath)
 
bool dispatchNext (Controller &controller, const std::string &parentMountPath)
 

Private Attributes

MountPoint mountPoint
 
std::shared_ptr< Dispatcherdispatcher
 

Friends

class dispatcher::RouterDispatcher
 
class Dispatcher
 
class RootRoute
 
class Controller
 

Detailed Description

Definition at line 58 of file Route.h.

Constructor & Destructor Documentation

◆ Route() [1/2]

express::Route::Route ( const std::string & method,
const std::string & relativeMountPath,
const std::shared_ptr< Dispatcher > & dispatcher )

Definition at line 53 of file Route.cpp.

54 : mountPoint(method, relativeMountPath)
56 }
std::shared_ptr< Dispatcher > dispatcher
Definition Route.h:71
MountPoint mountPoint
Definition Route.h:70

References Route().

Referenced by Route().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Route() [2/2]

express::Route::Route ( )
protected

Definition at line 48 of file Route.cpp.

49 : mountPoint("use", "")
50 , dispatcher(std::make_shared<dispatcher::RouterDispatcher>()) {
51 }

References Route().

Referenced by Route().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ all() [1/4]

Route & express::Route::all ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 79 of file Route.cpp.

◆ all() [2/4]

template<typename... Lambdas>
Route & express::Route::all ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 54 of file Route.hpp.

◆ all() [3/4]

Route & express::Route::all ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 79 of file Route.cpp.

◆ all() [4/4]

template<typename... Lambdas>
Route & express::Route::all ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 54 of file Route.hpp.

◆ connect() [1/4]

Route & express::Route::connect ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 84 of file Route.cpp.

◆ connect() [2/4]

template<typename... Lambdas>
Route & express::Route::connect ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 59 of file Route.hpp.

◆ connect() [3/4]

Route & express::Route::connect ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 84 of file Route.cpp.

◆ connect() [4/4]

template<typename... Lambdas>
Route & express::Route::connect ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 59 of file Route.hpp.

◆ del() [1/4]

Route & express::Route::del ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 83 of file Route.cpp.

◆ del() [2/4]

template<typename... Lambdas>
Route & express::Route::del ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 58 of file Route.hpp.

◆ del() [3/4]

Route & express::Route::del ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 83 of file Route.cpp.

◆ del() [4/4]

template<typename... Lambdas>
Route & express::Route::del ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 58 of file Route.hpp.

◆ dispatch() [1/2]

bool express::Route::dispatch ( Controller & controller)
protected

Definition at line 58 of file Route.cpp.

58 {
59 return dispatch(controller, "");
60 }
bool dispatch(Controller &controller)
Definition Route.cpp:58

◆ dispatch() [2/2]

bool express::Route::dispatch ( Controller & controller,
const std::string & parentMountPath )
protected

Definition at line 62 of file Route.cpp.

62 {
63 controller.setCurrentRoute(this);
64
65 bool dispatched = dispatcher->dispatch(controller, parentMountPath, mountPoint);
66
67 if (!dispatched) { // TODO: only call if parent route matched
68 dispatched = controller.dispatchNext(parentMountPath);
69 }
70
71 return dispatched;
72 }

◆ dispatchNext()

bool express::Route::dispatchNext ( Controller & controller,
const std::string & parentMountPath )
protected

Definition at line 74 of file Route.cpp.

74 {
75 return dispatcher->dispatchNext(controller, parentMountPath);
76 }

◆ get() [1/4]

Route & express::Route::get ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 80 of file Route.cpp.

◆ get() [2/4]

template<typename... Lambdas>
Route & express::Route::get ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 55 of file Route.hpp.

◆ get() [3/4]

Route & express::Route::get ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 80 of file Route.cpp.

◆ get() [4/4]

template<typename... Lambdas>
Route & express::Route::get ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 55 of file Route.hpp.

◆ head() [1/4]

Route & express::Route::head ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 88 of file Route.cpp.

◆ head() [2/4]

template<typename... Lambdas>
Route & express::Route::head ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 63 of file Route.hpp.

◆ head() [3/4]

Route & express::Route::head ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 88 of file Route.cpp.

◆ head() [4/4]

template<typename... Lambdas>
Route & express::Route::head ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 63 of file Route.hpp.

◆ options() [1/4]

Route & express::Route::options ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 85 of file Route.cpp.

◆ options() [2/4]

template<typename... Lambdas>
Route & express::Route::options ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 60 of file Route.hpp.

◆ options() [3/4]

Route & express::Route::options ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 85 of file Route.cpp.

◆ options() [4/4]

template<typename... Lambdas>
Route & express::Route::options ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 60 of file Route.hpp.

◆ patch() [1/4]

Route & express::Route::patch ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 87 of file Route.cpp.

◆ patch() [2/4]

template<typename... Lambdas>
Route & express::Route::patch ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 62 of file Route.hpp.

◆ patch() [3/4]

Route & express::Route::patch ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 87 of file Route.cpp.

◆ patch() [4/4]

template<typename... Lambdas>
Route & express::Route::patch ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 62 of file Route.hpp.

◆ post() [1/4]

Route & express::Route::post ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 82 of file Route.cpp.

◆ post() [2/4]

template<typename... Lambdas>
Route & express::Route::post ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 57 of file Route.hpp.

◆ post() [3/4]

Route & express::Route::post ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 82 of file Route.cpp.

◆ post() [4/4]

template<typename... Lambdas>
Route & express::Route::post ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 57 of file Route.hpp.

◆ put() [1/4]

Route & express::Route::put ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 81 of file Route.cpp.

◆ put() [2/4]

template<typename... Lambdas>
Route & express::Route::put ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 56 of file Route.hpp.

◆ put() [3/4]

Route & express::Route::put ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 81 of file Route.cpp.

◆ put() [4/4]

template<typename... Lambdas>
Route & express::Route::put ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 56 of file Route.hpp.

◆ trace() [1/4]

Route & express::Route::trace ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 86 of file Route.cpp.

◆ trace() [2/4]

template<typename... Lambdas>
Route & express::Route::trace ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 61 of file Route.hpp.

◆ trace() [3/4]

Route & express::Route::trace ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 86 of file Route.cpp.

◆ trace() [4/4]

template<typename... Lambdas>
Route & express::Route::trace ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 61 of file Route.hpp.

◆ use() [1/4]

Route & express::Route::use ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda) const

Definition at line 78 of file Route.cpp.

◆ use() [2/4]

template<typename... Lambdas>
Route & express::Route::use ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & lambda,
Lambdas... lambdas ) const

Definition at line 53 of file Route.hpp.

◆ use() [3/4]

Route & express::Route::use ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda) const

Definition at line 78 of file Route.cpp.

◆ use() [4/4]

template<typename... Lambdas>
Route & express::Route::use ( const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, Next &)> & lambda,
Lambdas... lambdas ) const

Definition at line 53 of file Route.hpp.

Friends And Related Symbol Documentation

◆ Controller

friend class Controller
friend

Definition at line 89 of file Route.h.

◆ Dispatcher

friend class Dispatcher
friend

Definition at line 87 of file Route.h.

◆ dispatcher::RouterDispatcher

friend class dispatcher::RouterDispatcher
friend

Definition at line 86 of file Route.h.

◆ RootRoute

friend class RootRoute
friend

Definition at line 88 of file Route.h.

Member Data Documentation

◆ dispatcher

std::shared_ptr<Dispatcher> express::Route::dispatcher
private

Definition at line 71 of file Route.h.

◆ mountPoint

MountPoint express::Route::mountPoint
private

Definition at line 70 of file Route.h.


The documentation for this class was generated from the following files: