16#include <initializer_list>
79template<
typename Matcher >
85 template<
typename... Args >
138template< std::
size_t Size >
152 std::initializer_list< http_method_id_t > values )
154 assert( Size == values.size() );
156 std::copy( values.begin(), values.end(),
m_methods.begin() );
182template< std::
size_t Size >
189 using base_type_t::base_type_t;
327 template<
typename Target_Type,
typename... Args >
331 static_assert(
alignof(Target_Type) <=
alignment,
332 "Target_Type should have appropriate alignment" );
340 auto * what =
reinterpret_cast<Target_Type *
>(raw_what);
341 return new(dest_storage) Target_Type{
std::move(*what) };
349 auto * what =
reinterpret_cast<actual_type *
>(raw_what);
350 return new(dest_storage) actual_type{
std::move(*what) };
376 template<
typename Arg >
380 using pure_method_matcher_type = std::decay_t<Arg>;
382 static_assert( std::is_base_of<
384 "Arg should be derived from method_matcher_t" );
386 holder.
assign< pure_method_matcher_type >(
387 std::forward<Arg>(method_matcher) );
414template<
typename... Args >
416impl::fixed_size_any_of_matcher_t<
sizeof...(Args) >
419 return { std::initializer_list<http_method_id_t>{ std::forward<Args>(args)... } };
446template<
typename... Args >
448impl::fixed_size_none_of_matcher_t<
sizeof...(Args) >
451 return { std::initializer_list<http_method_id_t>{ std::forward<Args>(args)... } };
A type for representation of HTTP method ID.
An implementation of method_matcher that allows a method if it's found in a dynamic list of allowed m...
std::vector< http_method_id_t > m_methods
dynamic_any_of_methods_matcher_t & add(http_method_id_t method)
RESTINIO_NODISCARD std::size_t size() const noexcept
RESTINIO_NODISCARD bool empty() const noexcept
dynamic_any_of_methods_matcher_t()=default
RESTINIO_NODISCARD bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
An implementation of method_matcher that allows a method if it isn't found in a dynamic list of disab...
RESTINIO_NODISCARD bool empty() const noexcept
RESTINIO_NODISCARD std::size_t size() const noexcept
RESTINIO_NODISCARD bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
dynamic_none_of_methods_matcher_t()=default
std::vector< http_method_id_t > m_methods
dynamic_none_of_methods_matcher_t & add(http_method_id_t method)
A proxy for actual method_matcher that will be allocated in dynamic memory.
RESTINIO_NODISCARD bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
std::unique_ptr< Matcher > m_matcher
allocated_matcher_proxy_t(Args &&...args)
A special class that allows to hold a copy of small-size method_matchers or a pointer to dynamically ...
std::array< char, buffer_size > m_buffer
The internal buffer.
friend void assign(buffered_matcher_holder_t &holder, Arg &&method_matcher)
pfn_move_t m_mover
An actual move-function.
friend void assign(buffered_matcher_holder_t &holder, http_method_id_t method)
RESTINIO_NODISCARD method_matcher_t & operator*() const noexcept
Get a reference to actual matcher inside the holder.
void move_from(buffered_matcher_holder_t &other)
buffered_matcher_holder_t & operator=(buffered_matcher_holder_t &&other) noexcept
RESTINIO_NODISCARD method_matcher_t * operator->() const noexcept
Get the pointer to actual matcher inside the holder.
buffered_matcher_holder_t & operator=(const buffered_matcher_holder_t &)=delete
method_matcher_t *(*)(void *object, void *buffer) pfn_move_t
A type of free function to be used to move a value of an object to the specified buffer.
void assign(Args &&... args)
Creates an instance of Target_Type and initializes it with arguments Args.
buffered_matcher_holder_t()=default
RESTINIO_NODISCARD method_matcher_t * get() const noexcept
Get the pointer to actual matcher inside the holder.
buffered_matcher_holder_t(buffered_matcher_holder_t &&other) noexcept
static constexpr std::size_t alignment
Alignment to be used by the internal buffer.
static constexpr std::size_t buffer_size
The size of the internal buffer.
~buffered_matcher_holder_t() noexcept
method_matcher_t * m_matcher
A pointer to actual matcher allocated inside the internall buffer.
buffered_matcher_holder_t(const buffered_matcher_holder_t &)=delete
A matcher that finds a value in the vector of allowed values of fixed size.
fixed_size_any_of_matcher_t(std::initializer_list< http_method_id_t > values)
Initializing constructor.
RESTINIO_NODISCARD bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
std::array< http_method_id_t, Size > m_methods
A matcher that finds a value in the vector of disabled values of fixed size.
RESTINIO_NODISCARD bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
A simple method_matcher that compares just one user-specified value.
RESTINIO_NODISCARD bool match(const http_method_id_t &method) const noexcept override
Is the specified method can be applied to a route?
simple_matcher_t(http_method_id_t method)
http_method_id_t m_method
#define RESTINIO_NODISCARD
RESTINIO_NODISCARD 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...
RESTINIO_NODISCARD 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...
An interface of method_matcher.
method_matcher_t(method_matcher_t &&)=default
virtual ~method_matcher_t()=default
method_matcher_t & operator=(const method_matcher_t &)=default
method_matcher_t()=default
method_matcher_t & operator=(method_matcher_t &&)=default
method_matcher_t(const method_matcher_t &)=default
virtual RESTINIO_NODISCARD bool match(const http_method_id_t &method) const noexcept=0
Is the specified method can be applied to a route?