|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
段式Trie路由器 更多...
#include <radix_router.hpp>
Public 成员函数 | |
| void | insert (const string &pattern, handler_type handler) |
| 插入路由规则 | |
| handler_type | match (const string &path, bool case_sensitive, vector< pair< string, string > > ¶ms) |
| 匹配路径 | |
| bool | contains_path (const string &path, bool case_sensitive) const |
| 检查路径是否存在 | |
| void | clear () |
| 清除所有路由规则 | |
| size_t | size () const noexcept |
| 获取 trie 节点总数 | |
|
inline |
插入路由规则
| pattern | 路径模式(支持 :param 和 * 通配符) |
| handler | 匹配时的处理器 |
在文件 radix_router.hpp 第 54 行定义.
引用了 neforce::basic_string< CharT, Traits, Alloc >::empty(), neforce::basic_string_view< CharT, Traits >::empty(), neforce::basic_string< CharT, Traits, Alloc >::find(), neforce::basic_string< CharT, Traits, Alloc >::front(), neforce::basic_string< CharT, Traits, Alloc >::length(), neforce::basic_string_view< CharT, Traits >::length(), neforce::numeric_traits< T, Dummy >::max(), neforce::move(), neforce::basic_string< char >::npos, neforce::basic_string< CharT, Traits, Alloc >::size(), neforce::basic_string_view< CharT, Traits >::substr() , 以及 neforce::basic_string< CharT, Traits, Alloc >::view().
|
inlinenodiscard |
匹配路径
| path | 请求路径 |
| case_sensitive | 是否大小写敏感 |
| params | 输出匹配到的参数 |
在文件 radix_router.hpp 第 117 行定义.
引用了 neforce::basic_string< CharT, Traits, Alloc >::append(), neforce::basic_string_view< CharT, Traits >::empty(), neforce::path::empty(), neforce::basic_string_view< CharT, Traits >::length(), neforce::basic_string< CharT, Traits, Alloc >::lowercase(), neforce::numeric_traits< T, Dummy >::max(), neforce::basic_string< char >::npos, neforce::basic_string< CharT, Traits, Alloc >::reserve() , 以及 neforce::path::view().