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

Handles matching requests to existing rules and upgrade requests. More...

Collaboration diagram for crow::Router:

Classes

struct  PerMethod
 

Public Member Functions

 Router ()
 
DynamicRulenew_rule_dynamic (const std::string &rule)
 
template<uint64_t N>
black_magic::arguments< N >::type::template rebind< TaggedRule > & new_rule_tagged (const std::string &rule)
 
CatchallRulecatchall_rule ()
 
void internal_add_rule_object (const std::string &rule, BaseRule *ruleObject, const uint16_t &BP_index, std::vector< Blueprint * > &blueprints)
 
void register_blueprint (Blueprint &blueprint)
 
void get_recursive_child_methods (Blueprint *blueprint, std::vector< HTTPMethod > &methods)
 
void validate_bp (std::vector< Blueprint * > blueprints)
 
void validate ()
 
template<typename Adaptor >
void handle_upgrade (const request &req, response &res, Adaptor &&adaptor)
 
void get_found_bp (std::vector< uint16_t > &bp_i, std::vector< Blueprint * > &blueprints, std::vector< Blueprint * > &found_bps, uint16_t index=0)
 
std::string get_error (unsigned short code, std::tuple< uint16_t, std::vector< uint16_t >, routing_params > &found, const request &req, response &res)
 Is used to handle errors, you insert the error code, found route, request, and response. and it'll either call the appropriate catchall route (considering the blueprint system) and send you a status string (which is mainly used for debug messages), or just set the response code to the proper error code. More...
 
void handle (request &req, response &res)
 
void debug_print ()
 
std::vector< Blueprint * > & blueprints ()
 

Private Attributes

CatchallRule catchall_rule_
 
std::array< PerMethod, static_cast< int >HTTPMethod::InternalMethodCount)> per_methods_
 
std::vector< std::unique_ptr< BaseRule > > all_rules_
 
std::vector< Blueprint * > blueprints_
 

Detailed Description

Handles matching requests to existing rules and upgrade requests.

Constructor & Destructor Documentation

◆ Router()

crow::Router::Router ( )
inline

Member Function Documentation

◆ new_rule_dynamic()

DynamicRule& crow::Router::new_rule_dynamic ( const std::string &  rule)
inline
Here is the caller graph for this function:

◆ new_rule_tagged()

template<uint64_t N>
black_magic::arguments<N>::type::template rebind<TaggedRule>& crow::Router::new_rule_tagged ( const std::string &  rule)
inline
Here is the caller graph for this function:

◆ catchall_rule()

CatchallRule& crow::Router::catchall_rule ( )
inline
Here is the caller graph for this function:

◆ internal_add_rule_object()

void crow::Router::internal_add_rule_object ( const std::string &  rule,
BaseRule ruleObject,
const uint16_t &  BP_index,
std::vector< Blueprint * > &  blueprints 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_blueprint()

void crow::Router::register_blueprint ( Blueprint blueprint)
inline
Here is the caller graph for this function:

◆ get_recursive_child_methods()

void crow::Router::get_recursive_child_methods ( Blueprint blueprint,
std::vector< HTTPMethod > &  methods 
)
inline
Here is the caller graph for this function:

◆ validate_bp()

void crow::Router::validate_bp ( std::vector< Blueprint * >  blueprints)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ validate()

void crow::Router::validate ( )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_upgrade()

template<typename Adaptor >
void crow::Router::handle_upgrade ( const request req,
response res,
Adaptor &&  adaptor 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_found_bp()

void crow::Router::get_found_bp ( std::vector< uint16_t > &  bp_i,
std::vector< Blueprint * > &  blueprints,
std::vector< Blueprint * > &  found_bps,
uint16_t  index = 0 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_error()

std::string crow::Router::get_error ( unsigned short  code,
std::tuple< uint16_t, std::vector< uint16_t >, routing_params > &  found,
const request req,
response res 
)
inline

Is used to handle errors, you insert the error code, found route, request, and response. and it'll either call the appropriate catchall route (considering the blueprint system) and send you a status string (which is mainly used for debug messages), or just set the response code to the proper error code.

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

◆ handle()

void crow::Router::handle ( request req,
response res 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ debug_print()

void crow::Router::debug_print ( )
inline
Here is the caller graph for this function:

◆ blueprints()

std::vector<Blueprint*>& crow::Router::blueprints ( )
inline
Here is the caller graph for this function:

Member Data Documentation

◆ catchall_rule_

CatchallRule crow::Router::catchall_rule_
private

◆ per_methods_

std::array<PerMethod, static_cast<int>HTTPMethod::InternalMethodCount)> crow::Router::per_methods_
private

◆ all_rules_

std::vector<std::unique_ptr<BaseRule> > crow::Router::all_rules_
private

◆ blueprints_

std::vector<Blueprint*> crow::Router::blueprints_
private

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