路由模式匹配器
更多...
#include <rmvl/io/netapp.hpp>
|
| | RoutePattern (std::string_view pattern_str) |
| | 构造路由模式
|
| bool | match (std::string_view path, std::unordered_map< std::string, std::string > ¶ms) const |
| | 匹配路径,并提取参数
|
| const std::string & | pattern () const noexcept |
| | 获取原始路由模式字符串
|
◆ RoutePattern()
| rm::Router::RoutePattern::RoutePattern |
( |
std::string_view | pattern_str | ) |
|
|
explicit |
构造路由模式
- 参数
-
| [in] | pattern_str | 路由模式字符串,如 "/api/:name" |
◆ match()
| bool rm::Router::RoutePattern::match |
( |
std::string_view | path, |
|
|
std::unordered_map< std::string, std::string > & | params ) const |
匹配路径,并提取参数
- 参数
-
| [in] | path | 请求路径 |
| [out] | params | 输出参数,提取的路径参数 |
- 返回
- 是否匹配成功
◆ pattern()
| const std::string & rm::Router::RoutePattern::pattern |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
该类的文档由以下文件生成: