14 #include <restinio/http_headers.hpp> 16 #include <initializer_list> 58 match(
const http_method_id_t & method )
const noexcept = 0;
79 template<
typename Matcher >
85 template<
typename... Args >
92 match(
const http_method_id_t & method )
const noexcept override 121 match(
const http_method_id_t & method )
const noexcept override 123 return m_method == method;
138 template< std::size_t Size >
152 std::initializer_list< http_method_id_t > values )
161 match(
const http_method_id_t & method )
const noexcept override 182 template< std::size_t Size >
189 using base_type_t::base_type_t;
193 match(
const http_method_id_t & method )
const noexcept override 274 m_matcher = other.m_mover( other.m_matcher, m_buffer.data() );
327 template<
typename Target_Type,
typename... Args >
332 "Target_Type should have appropriate alignment" );
373 holder.assign< simple_matcher_t >( std::move(method) );
376 template<
typename Arg >
384 "Arg should be derived from method_matcher_t" );
414 template<
typename... Args >
446 template<
typename... Args >
484 match(
const http_method_id_t & method )
const noexcept override 486 for(
const auto & m : m_methods )
494 add( http_method_id_t method )
496 m_methods.emplace_back( std::move(method) );
504 return m_methods.size();
511 return m_methods.empty();
545 match(
const http_method_id_t & method )
const noexcept override 547 for(
const auto & m : m_methods )
555 add( http_method_id_t method )
557 m_methods.emplace_back( std::move(method) );
565 return m_methods.size();
572 return m_methods.empty();
method_matcher_t * get() const noexcept
Get the pointer to actual matcher inside the holder.
bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
An interface of method_matcher.
method_matcher_t & operator=(method_matcher_t &&)=default
A matcher that finds a value in the vector of allowed values of fixed size.
dynamic_any_of_methods_matcher_t & add(http_method_id_t method)
bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
std::size_t size() const noexcept
std::array< char, buffer_size > m_buffer
The internal buffer.
impl::fixed_size_none_of_matcher_t< sizeof...(Args) > none_of_methods(Args &&...args)
A factory function that creates a method_matcher that allows a method if it isn't found in the list o...
bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
method_matcher_t(const method_matcher_t &)=default
void assign(Args &&... args)
Creates an instance of Target_Type and initializes it with arguments Args.
std::unique_ptr< Matcher > m_matcher
buffered_matcher_holder_t & operator=(const buffered_matcher_holder_t &)=delete
buffered_matcher_holder_t & operator=(buffered_matcher_holder_t &&other) noexcept
fixed_size_any_of_matcher_t(std::initializer_list< http_method_id_t > values)
Initializing constructor.
method_matcher_t * operator->() const noexcept
Get the pointer to actual matcher inside the holder.
An implementation of method_matcher that allows a method if it's found in a dynamic list of allowed m...
simple_matcher_t(http_method_id_t method)
friend void assign(buffered_matcher_holder_t &holder, Arg &&method_matcher)
bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
impl::fixed_size_any_of_matcher_t< sizeof...(Args) > any_of_methods(Args &&...args)
A factory function that creates a method_matcher that allows a method if it's found in the list of al...
friend void assign(buffered_matcher_holder_t &holder, http_method_id_t method)
method_matcher_t & operator*() const noexcept
Get a reference to actual matcher inside the holder.
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, std::optional< Value_Type > >::type opt_value(const Parameter_Container ¶ms, string_view_t key)
Gets the value of a parameter specified by key wrapped in std::optional<Value_Type> if parameter exis...
std::array< http_method_id_t, Size > m_methods
A simple method_matcher that compares just one user-specified value.
bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
static constexpr std::size_t buffer_size
The size of the internal buffer.
bool empty() const noexcept
allocated_matcher_proxy_t(Args &&...args)
std::vector< http_method_id_t > m_methods
~buffered_matcher_holder_t() noexcept
A special class that allows to hold a copy of small-size method_matchers or a pointer to dynamically ...
virtual ~method_matcher_t()=default
An implementation of method_matcher that allows a method if it isn't found in a dynamic list of disab...
void move_from(buffered_matcher_holder_t &other)
A matcher that finds a value in the vector of disabled values of fixed size.
dynamic_none_of_methods_matcher_t()=default
std::vector< http_method_id_t > m_methods
std::size_t size() const noexcept
method_matcher_t & operator=(const method_matcher_t &)=default
virtual bool match(const http_method_id_t &method) const noexcept=0
Is the specified method can be applied to a route?
pfn_move_t m_mover
An actual move-function.
buffered_matcher_holder_t(buffered_matcher_holder_t &&other) noexcept
bool empty() const noexcept
method_matcher_t(method_matcher_t &&)=default
A proxy for actual method_matcher that will be allocated in dynamic memory.
dynamic_any_of_methods_matcher_t()=default
buffered_matcher_holder_t()=default
dynamic_none_of_methods_matcher_t & add(http_method_id_t method)
method_matcher_t * m_matcher
A pointer to actual matcher allocated inside the internall buffer.
static constexpr std::size_t alignment
Alignment to be used by the internal buffer.
buffered_matcher_holder_t(const buffered_matcher_holder_t &)=delete
http_method_id_t m_method
method_matcher_t()=default