Yet Another HTTP Library: YaHTTP::Router Class Reference

Yet Another HTTP Library yahttp

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
YaHTTP::Router Class Reference

`#include <router.hpp>`

Collaboration diagram for YaHTTP::Router:
[legend]

## Public Member Functions
void | map (const std::string &method, const std::string &url, THandlerFunction handler, const std::string &name)
bool | route (Request *req, THandlerFunction &handler)
void | printRoutes (std::ostream &os)
std::pair< std::string, std::string > | urlFor (const std::string &name, const strstr_map_t &arguments)

## Static Public Member Functions
static void | Map (const std::string &method, const std::string &url, THandlerFunction handler, const std::string &name="")
static void | Get (const std::string &url, THandlerFunction handler, const std::string &name="")
static void | Post (const std::string &url, THandlerFunction handler, const std::string &name="")
static void | Put (const std::string &url, THandlerFunction handler, const std::string &name="")
static void | Patch (const std::string &url, THandlerFunction handler, const std::string &name="")
static void | Delete (const std::string &url, THandlerFunction handler, const std::string &name="")
static void | Any (const std::string &url, THandlerFunction handler, const std::string &name="")
static bool | Route (Request *req, THandlerFunction &handler)
static void | PrintRoutes (std::ostream &os)
static std::pair< std::string, std::string > | URLFor (const std::string &name, const strstr_map_t &arguments)
static const TRouteList & | GetRoutes ()

## Public Attributes
TRouteList | routes

## Private Member Functions
| Router ()

## Static Private Attributes
static Router | router

## Detailed Description

Implements simple router.

This class implements a router for masked urls. The URL mask syntax is as of follows

/<masked>/url<number>/<hi>.<format>

You can use <param> to denote that everything will be matched and consumed into the parameter, including slash (/). Use <> to denote that URL is consumed but not stored. Note that only path is matched, scheme, host and url parameters are ignored.

## Constructor & Destructor Documentation

YaHTTP::Router::Router | ( |  | ) |
| inlineprivate

## Member Function Documentation

static void YaHTTP::Router::Any | ( | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name = `""`
| ) |  |
| inlinestatic

static void YaHTTP::Router::Delete | ( | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name = `""`
| ) |  |
| inlinestatic

static void YaHTTP::Router::Get | ( | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name = `""`
| ) |  |
| inlinestatic

static const TRouteList& YaHTTP::Router::GetRoutes | ( |  | ) |
| inlinestatic

void YaHTTP::Router::map | ( | const std::string & | method,
|  | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name
| ) |  |

static void YaHTTP::Router::Map | ( | const std::string & | method,
|  | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name = `""`
| ) |  |
| inlinestatic

Map an URL. If method is left empty, it will match any method. Name is also optional, but needed if you want to find it for making URLs

static void YaHTTP::Router::Patch | ( | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name = `""`
| ) |  |
| inlinestatic

static void YaHTTP::Router::Post | ( | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name = `""`
| ) |  |
| inlinestatic

void YaHTTP::Router::printRoutes | ( | std::ostream & | os | ) |

static void YaHTTP::Router::PrintRoutes | ( | std::ostream & | os | ) |
| inlinestatic

static void YaHTTP::Router::Put | ( | const std::string & | url,
|  | THandlerFunction | handler,
|  | const std::string & | name = `""`
| ) |  |
| inlinestatic

bool YaHTTP::Router::route | ( | Request * | req,
|  | THandlerFunction & | handler
| ) |  |

static bool YaHTTP::Router::Route | ( | Request * | req,
|  | THandlerFunction & | handler
| ) |  |
| inlinestatic

std::pair< std::string, std::string > YaHTTP::Router::urlFor | ( | const std::string & | name,
|  | const strstr_map_t & | arguments
| ) |  |

static std::pair<std::string, std::string> YaHTTP::Router::URLFor | ( | const std::string & | name,
|  | const strstr_map_t & | arguments
| ) |  |
| inlinestatic

## Member Data Documentation

YaHTTP::Router YaHTTP::Router::router
| staticprivate

TRouteList YaHTTP::Router::routes

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

- /home/cmouse/projects/libyahttp/yahttp/router.hpp
- /home/cmouse/projects/libyahttp/yahttp/router.cpp