RESTinio
Loading...
Searching...
No Matches
path2regex.hpp File Reference
#include <cassert>
#include <regex>
#include <string>
#include <vector>
#include <memory>
#include <functional>
#include <iterator>
#include <restinio/impl/include_fmtlib.hpp>
#include <restinio/exception.hpp>
#include <restinio/string_view.hpp>

Go to the source code of this file.

Classes

class  restinio::path2regex::options_t
 Options for matching routes. More...
class  restinio::path2regex::impl::string_view_buffer_storage_appender_t< Container >
 Appender for names to a given buffered string. More...
class  restinio::path2regex::impl::token_t< Route_Param_Appender >
 Base class for token variants. More...
class  restinio::path2regex::impl::plain_string_token_t< Route_Param_Appender >
 Plain str token. More...
class  restinio::path2regex::impl::parameter_token_t< Route_Param_Appender, Name >
 Token for paramater (named/indexed). More...
struct  restinio::path2regex::impl::route_regex_matcher_data_t< Route_Param_Appender, Regex_Engine >
 Resulting regex and param extraction for a specific route. More...

Namespaces

namespace  restinio
namespace  restinio::path2regex
namespace  restinio::path2regex::impl

Typedefs

template<typename Route_Param_Appender>
using restinio::path2regex::param_appender_t
 Appends sub-match as a request parameter to specified container.
template<typename Route_Param_Appender>
using restinio::path2regex::param_appender_sequence_t = std::vector< param_appender_t< Route_Param_Appender > >
 A sequence of appenders for submatches.
using restinio::path2regex::impl::names_buffer_appender_t = string_view_buffer_storage_appender_t< std::string >
template<typename Route_Param_Appender>
using restinio::path2regex::impl::token_unique_ptr_t = std::unique_ptr< token_t< Route_Param_Appender > >
template<typename Route_Param_Appender>
using restinio::path2regex::impl::token_list_t = std::vector< token_unique_ptr_t< Route_Param_Appender > >

Enumerations

enum class  restinio::path2regex::impl::token_type_t : std::uint8_t { restinio::path2regex::impl::plain_string , restinio::path2regex::impl::capturing_token }

Functions

auto restinio::path2regex::impl::escape_group (const std::string &group)
 Escapes not allowed symbols in a sub-match group assigned to a parameter.
auto restinio::path2regex::impl::escape_string (const std::string &group)
 Excape regex control chars.
template<typename Route_Param_Appender>
param_appender_t< Route_Param_Appender > restinio::path2regex::make_param_setter (string_view_t key)
 Create default appender for named parameter.
template<typename Route_Param_Appender>
param_appender_t< Route_Param_Appender > restinio::path2regex::make_param_setter (std::size_t)
 Create default appender indexed parameter.
template<typename Route_Param_Appender>
token_unique_ptr_t< Route_Param_Appender > restinio::path2regex::impl::create_token (std::string path)
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)
 Creates tokent for specific parameter.
std::string restinio::path2regex::impl::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 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)
 Handling of a parameterized token.
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.
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.
template<typename Route_Param_Appender, typename Regex_Engine>
auto restinio::path2regex::path2regex (string_view_t path, const options_t &options)
 The main path matching regexp.

Variables

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