RESTinio
Loading...
Searching...
No Matches
restinio::path2regex::impl Namespace Reference

Classes

class  parameter_token_t
 Token for paramater (named/indexed). More...
class  plain_string_token_t
 Plain str token. More...
struct  route_regex_matcher_data_t
 Resulting regex and param extraction for a specific route. More...
class  string_view_buffer_storage_appender_t
 Appender for names to a given buffered string. More...
class  token_t
 Base class for token variants. More...

Typedefs

using names_buffer_appender_t = string_view_buffer_storage_appender_t< std::string >
template<typename Route_Param_Appender>
using token_unique_ptr_t = std::unique_ptr< token_t< Route_Param_Appender > >
template<typename Route_Param_Appender>
using token_list_t = std::vector< token_unique_ptr_t< Route_Param_Appender > >

Enumerations

enum class  token_type_t : std::uint8_t { plain_string , capturing_token }

Functions

auto escape_group (const std::string &group)
 Escapes not allowed symbols in a sub-match group assigned to a parameter.
auto escape_string (const std::string &group)
 Excape regex control chars.
template<typename Route_Param_Appender>
token_unique_ptr_t< Route_Param_Appender > create_token (std::string path)
template<typename Route_Param_Appender, typename Name>
token_unique_ptr_t< Route_Param_Appender > create_token (Name name, std::string prefix, std::string delimiter, bool optional, bool repeat, bool partial, std::string pattern)
 Creates tokent for specific parameter.
std::string check_no_unescaped_brackets (string_view_t strv, std::size_t base_pos)
 Checks that string doesn't contain non-excaped brackets.
template<typename Route_Param_Appender, typename MATCH>
void handle_param_token (const options_t &options, const MATCH &match, std::string &path, bool &path_escaped, token_list_t< Route_Param_Appender > &result)
 Handling of a parameterized token.
template<typename Route_Param_Appender>
token_list_t< Route_Param_Appender > parse (string_view_t route_sv, const options_t &options)
 Parse a string for the raw tokens.
template<typename Route_Param_Appender, typename Regex_Engine>
auto tokens2regexp (string_view_t path, const token_list_t< Route_Param_Appender > &tokens, const options_t &options)
 Makes route regex matcher out of path tokens.

Variables

constexpr auto path_regex_str
 The main path matching expression.
constexpr std::size_t group_escaped_idx = 1
 Indexes for different groups in matched result (used when extracting tokens from initial route).
constexpr std::size_t group_name_idx = 2
constexpr std::size_t group_capture_idx = 3
constexpr std::size_t group_group_idx = 4
constexpr std::size_t group_modifier_idx = 5

Typedef Documentation

◆ names_buffer_appender_t

◆ token_list_t

template<typename Route_Param_Appender>
using restinio::path2regex::impl::token_list_t = std::vector< token_unique_ptr_t< Route_Param_Appender > >

Definition at line 396 of file path2regex.hpp.

◆ token_unique_ptr_t

template<typename Route_Param_Appender>
using restinio::path2regex::impl::token_unique_ptr_t = std::unique_ptr< token_t< Route_Param_Appender > >

Definition at line 393 of file path2regex.hpp.

Enumeration Type Documentation

◆ token_type_t

enum class restinio::path2regex::impl::token_type_t : std::uint8_t
strong
Enumerator
plain_string 
capturing_token 

Definition at line 359 of file path2regex.hpp.

Function Documentation

◆ check_no_unescaped_brackets()

std::string restinio::path2regex::impl::check_no_unescaped_brackets ( string_view_t strv,
std::size_t base_pos )
inline

Checks that string doesn't contain non-excaped brackets.

Definition at line 562 of file path2regex.hpp.

◆ create_token() [1/2]

template<typename Route_Param_Appender, typename Name>
token_unique_ptr_t< Route_Param_Appender > restinio::path2regex::impl::create_token ( Name name,
std::string prefix,
std::string delimiter,
bool optional,
bool repeat,
bool partial,
std::string pattern )
inline

Creates tokent for specific parameter.

Definition at line 531 of file path2regex.hpp.

◆ create_token() [2/2]

template<typename Route_Param_Appender>
token_unique_ptr_t< Route_Param_Appender > restinio::path2regex::impl::create_token ( std::string path)

Definition at line 437 of file path2regex.hpp.

◆ escape_group()

auto restinio::path2regex::impl::escape_group ( const std::string & group)
inline

Escapes not allowed symbols in a sub-match group assigned to a parameter.

Definition at line 40 of file path2regex.hpp.

◆ escape_string()

auto restinio::path2regex::impl::escape_string ( const std::string & group)
inline

Excape regex control chars.

Definition at line 63 of file path2regex.hpp.

◆ handle_param_token()

template<typename Route_Param_Appender, typename MATCH>
void restinio::path2regex::impl::handle_param_token ( const options_t & options,
const MATCH & match,
std::string & path,
bool & path_escaped,
token_list_t< Route_Param_Appender > & result )
inline

Handling of a parameterized token.

Definition at line 594 of file path2regex.hpp.

◆ parse()

template<typename Route_Param_Appender>
token_list_t< Route_Param_Appender > restinio::path2regex::impl::parse ( string_view_t route_sv,
const options_t & options )

Parse a string for the raw tokens.

Definition at line 678 of file path2regex.hpp.

◆ tokens2regexp()

template<typename Route_Param_Appender, typename Regex_Engine>
auto restinio::path2regex::impl::tokens2regexp ( string_view_t path,
const token_list_t< Route_Param_Appender > & tokens,
const options_t & options )

Makes route regex matcher out of path tokens.

Definition at line 782 of file path2regex.hpp.

Variable Documentation

◆ group_capture_idx

std::size_t restinio::path2regex::impl::group_capture_idx = 3
constexpr

Definition at line 555 of file path2regex.hpp.

◆ group_escaped_idx

std::size_t restinio::path2regex::impl::group_escaped_idx = 1
constexpr

Indexes for different groups in matched result (used when extracting tokens from initial route).

Definition at line 553 of file path2regex.hpp.

◆ group_group_idx

std::size_t restinio::path2regex::impl::group_group_idx = 4
constexpr

Definition at line 556 of file path2regex.hpp.

◆ group_modifier_idx

std::size_t restinio::path2regex::impl::group_modifier_idx = 5
constexpr

Definition at line 557 of file path2regex.hpp.

◆ group_name_idx

std::size_t restinio::path2regex::impl::group_name_idx = 2
constexpr

Definition at line 554 of file path2regex.hpp.

◆ path_regex_str

auto restinio::path2regex::impl::path_regex_str
constexpr
Initial value:
=
R"((\\.)|(?:\:(\w+)(?:\‍(((?:\\.|[^\\‍()])+)\))?|\‍(((?:\\.|[^\\‍()])+)\))([+*?])?)"

The main path matching expression.

Definition at line 356 of file path2regex.hpp.