Crow  1.0
A C++ microframework for the web
crow::DynamicRule Class Reference

A rule that can change its parameters during runtime. More...

Inheritance diagram for crow::DynamicRule:
Collaboration diagram for crow::DynamicRule:

Public Types

using self_t = DynamicRule
 

Public Member Functions

 DynamicRule (std::string rule)
 
void validate () override
 
void handle (request &req, response &res, const routing_params &params) override
 
template<typename Func >
void operator() (Func f)
 
template<typename Func , unsigned... Indices>
std::function< void(request &, response &, const routing_params &)> wrap (Func f, black_magic::seq< Indices... >)
 
template<typename Func >
void operator() (std::string name, Func &&f)
 
std::unique_ptr< BaseRuleupgrade ()
 
virtual void handle_upgrade (const request &, response &res, SocketAdaptor &&)
 
uint32_t get_methods ()
 
template<typename F >
void foreach_method (F f)
 
const std::string & rule ()
 
WebSocketRulewebsocket ()
 
self_tname (std::string name) noexcept
 
self_tmethods (HTTPMethod method)
 
self_tmethods (HTTPMethod method, MethodArgs... args_method)
 

Public Attributes

std::string custom_templates_base
 

Protected Attributes

uint32_t methods_ {1 << static_cast<int>(HTTPMethod::Get)}
 
std::string rule_
 
std::string name_
 
std::unique_ptr< BaseRulerule_to_upgrade_
 

Private Attributes

std::function< void(request &, response &, const routing_params &)> erased_handler_
 

Detailed Description

A rule that can change its parameters during runtime.

Member Typedef Documentation

◆ self_t

Constructor & Destructor Documentation

◆ DynamicRule()

crow::DynamicRule::DynamicRule ( std::string  rule)
inline

Member Function Documentation

◆ validate()

void crow::DynamicRule::validate ( )
inlineoverridevirtual

Implements crow::BaseRule.

◆ handle()

void crow::DynamicRule::handle ( request req,
response res,
const routing_params &  params 
)
inlineoverridevirtual

Implements crow::BaseRule.

Here is the call graph for this function:

◆ operator()() [1/2]

template<typename Func >
void crow::DynamicRule::operator() ( Func  f)
inline
Here is the call graph for this function:

◆ wrap()

template<typename Func , unsigned... Indices>
std::function<void(request&, response&, const routing_params&)> crow::DynamicRule::wrap ( Func  f,
black_magic::seq< Indices... >   
)
inline
Here is the caller graph for this function:

◆ operator()() [2/2]

template<typename Func >
void crow::DynamicRule::operator() ( std::string  name,
Func &&  f 
)
inline
Here is the call graph for this function:

◆ upgrade()

std::unique_ptr<BaseRule> crow::BaseRule::upgrade ( )
inlineinherited

◆ handle_upgrade()

virtual void crow::BaseRule::handle_upgrade ( const request ,
response res,
SocketAdaptor &&   
)
inlinevirtualinherited

Reimplemented in crow::WebSocketRule.

Here is the call graph for this function:

◆ get_methods()

uint32_t crow::BaseRule::get_methods ( )
inlineinherited

◆ foreach_method()

template<typename F >
void crow::BaseRule::foreach_method ( f)
inlineinherited
Here is the caller graph for this function:

◆ rule()

const std::string& crow::BaseRule::rule ( )
inlineinherited

◆ websocket()

WebSocketRule& crow::RuleParameterTraits< DynamicRule >::websocket
inlineinherited

◆ name()

self_t& crow::RuleParameterTraits< DynamicRule >::name ( std::string  name)
inlinenoexceptinherited

◆ methods() [1/2]

self_t& crow::RuleParameterTraits< DynamicRule >::methods ( HTTPMethod  method)
inlineinherited

◆ methods() [2/2]

self_t& crow::RuleParameterTraits< DynamicRule >::methods ( HTTPMethod  method,
MethodArgs...  args_method 
)
inlineinherited

Member Data Documentation

◆ erased_handler_

std::function<void(request&, response&, const routing_params&)> crow::DynamicRule::erased_handler_
private

◆ custom_templates_base

std::string crow::BaseRule::custom_templates_base
inherited

◆ methods_

uint32_t crow::BaseRule::methods_ {1 << static_cast<int>(HTTPMethod::Get)}
protectedinherited

◆ rule_

std::string crow::BaseRule::rule_
protectedinherited

◆ name_

std::string crow::BaseRule::name_
protectedinherited

◆ rule_to_upgrade_

std::unique_ptr<BaseRule> crow::BaseRule::rule_to_upgrade_
protectedinherited

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