|
| std::string | resolve (const std::string &route) const |
| |
| void | set_backtrack (bool enabled) |
| |
| void | set_default (T def) |
| |
|
std::vector< std::string > | routes () const |
| |
|
bool | has (const std::string &route) const |
| |
|
void | add (const std::string &route, T val) |
| |
|
void | set (const std::string &route, T val) |
| |
| std::pair< T, Parameters > | get (const std::string &route) const |
| |
|
void | set_unsafe (const std::string &key, T val) |
| |
|
std::pair< T, Parameters > | get_unsafe (const std::string &key) const |
| |
template<typename T>
class oak::Muxer< T >
The Muxer is an advanced map that takes HTTP endpoints as input and returns a unique value.
The kind of value that is returned is configurable, since Muxer doesn't need to know. This allows for easy testing as well as the ability to return complex web handlers.
Usage
Muxer<bool> mux;
mux.set_default(false);
mux.set_backtrack(true);
mux.add("/index.html", true);
Safety
As the muxer is almost always used in multi-threaded contexts, it contains a read-write mutex that allows routes to be added dynamically.