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
 

Private 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 80 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 75 of file Route.cpp.

76 : mountPoint(method, relativeMountPath)
78 }
std::shared_ptr< Dispatcher > dispatcher
Definition Route.h:93
MountPoint mountPoint
Definition Route.h:92

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 ( )
private

Definition at line 70 of file Route.cpp.

71 : mountPoint("use", "")
72 , dispatcher(std::make_shared<dispatcher::RouterDispatcher>()) {
73 }

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 101 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 76 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 101 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 76 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 106 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 81 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 106 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 81 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 105 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 80 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 105 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 80 of file Route.hpp.

◆ dispatch() [1/2]

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

Definition at line 80 of file Route.cpp.

80 {
81 return dispatch(controller, "");
82 }
bool dispatch(Controller &controller)
Definition Route.cpp:80

◆ dispatch() [2/2]

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

Definition at line 84 of file Route.cpp.

84 {
85 controller.setCurrentRoute(this);
86
87 bool dispatched = dispatcher->dispatch(controller, parentMountPath, mountPoint);
88
89 if (!dispatched) { // TODO: only call if parent route matched
90 dispatched = controller.dispatchNext(parentMountPath);
91 }
92
93 return dispatched;
94 }

◆ dispatchNext()

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

Definition at line 96 of file Route.cpp.

96 {
97 return dispatcher->dispatchNext(controller, parentMountPath);
98 }

◆ 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 102 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 77 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 102 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 77 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 110 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 85 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 110 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 85 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 107 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 82 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 107 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 82 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 109 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 84 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 109 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 84 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 104 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 79 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 104 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 79 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 103 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 78 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 103 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 78 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 108 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 83 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 108 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 83 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 100 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 75 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 100 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 75 of file Route.hpp.

Friends And Related Symbol Documentation

◆ Controller

friend class Controller
friend

Definition at line 111 of file Route.h.

◆ Dispatcher

friend class Dispatcher
friend

Definition at line 109 of file Route.h.

◆ dispatcher::RouterDispatcher

friend class dispatcher::RouterDispatcher
friend

Definition at line 108 of file Route.h.

◆ RootRoute

friend class RootRoute
friend

Definition at line 110 of file Route.h.

Member Data Documentation

◆ dispatcher

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

Definition at line 93 of file Route.h.

◆ mountPoint

MountPoint express::Route::mountPoint
private

Definition at line 92 of file Route.h.


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