![]() |
boost::taar::matcher::context — Scratch space passed to every matcher invocation on a request.
// In header: <boost/taar/matcher/context.hpp> struct context { // public data members std::unordered_map< std::string, std::string > path_args; // Path-argument values extracted by the target matcher. mutable request_attributes attributes; // Values attached to the request by interceptors and guards. };
The session creates one context per request and threads it through each matcher in the registered route. Matchers may write to its members when they extract information from the request that subsequent handler code needs. The most common use is the target matcher populating path_args with the values it extracted from a path template.
Handlers can read the context through the taar::handler::path_arg argument provider or by accepting a taar::matcher::context const& directly.
context
public
public data membersstd::unordered_map< std::string, std::string > path_args;
Keys are the placeholder names from the path template (/users/{id} populates path_args["id"]). The greedy {*name} placeholder stores the captured suffix under the same name; the bare {*} form stores it under the key "*".
mutable request_attributes attributes;
Filled by session interceptors (basic_http::add_interceptor) and handler::guard checks, read by handlers directly or through handler::attribute_arg<T>(). Routing only resets path_args between candidate routes; attributes survive it.