Crow  1.0
A C++ microframework for the web
crow::BaseRule Class Referenceabstract

A base class for all rules. More...

Inheritance diagram for crow::BaseRule:
Collaboration diagram for crow::BaseRule:

Public Member Functions

 BaseRule (std::string rule)
 
virtual ~BaseRule ()
 
virtual void validate ()=0
 
std::unique_ptr< BaseRuleupgrade ()
 
virtual void handle (request &, response &, const routing_params &)=0
 
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 ()
 

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_
 

Friends

class Router
 
class Blueprint
 
template<typename T >
struct RuleParameterTraits
 

Detailed Description

A base class for all rules.

Used to provide a common interface for code dealing with different types of rules.
A Rule provides a URL, allowed HTTP methods, and handlers.

Constructor & Destructor Documentation

◆ BaseRule()

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

◆ ~BaseRule()

virtual crow::BaseRule::~BaseRule ( )
inlinevirtual

Member Function Documentation

◆ validate()

virtual void crow::BaseRule::validate ( )
pure virtual

◆ upgrade()

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

◆ handle()

virtual void crow::BaseRule::handle ( request ,
response ,
const routing_params &   
)
pure virtual

◆ handle_upgrade()

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

Reimplemented in crow::WebSocketRule.

Here is the call graph for this function:

◆ get_methods()

uint32_t crow::BaseRule::get_methods ( )
inline

◆ foreach_method()

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

◆ rule()

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

Friends And Related Function Documentation

◆ Router

friend class Router
friend

◆ Blueprint

friend class Blueprint
friend

◆ RuleParameterTraits

template<typename T >
friend struct RuleParameterTraits
friend

Member Data Documentation

◆ custom_templates_base

std::string crow::BaseRule::custom_templates_base

◆ methods_

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

◆ rule_

std::string crow::BaseRule::rule_
protected

◆ name_

std::string crow::BaseRule::name_
protected

◆ rule_to_upgrade_

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

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