AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::rest::Route Class Referenceabstract

#include <endpoint.hpp>

Inheritance diagram for anch::rest::Route:
Collaboration diagram for anch::rest::Route:

Public Member Functions

 Route (anch::rest::Method method, std::string pattern, std::vector< std::string > parameterNames)
 Route (const Route &)=delete
virtual ~Route ()
virtual anch::rest::Response handle (anch::rest::Request &request, std::vector< std::string > &parameters)=0
virtual std::size_t getPathParameterCount () const noexcept=0
virtual std::optional< std::string > check () const =0
Route & operator= (const Route &)=delete
anch::rest::Method getMethod () const noexcept
const std::string & getPattern () const noexcept
const std::vector< std::string > & getParameterNames () const noexcept

Protected Attributes

anch::rest::Method _method
std::string _pattern
std::vector< std::string > _parameterNames

Detailed Description

Route: endpoint registered in Api for a method and a path pattern.

Author
Vincent Lachenal
Since
0.2

Constructor & Destructor Documentation

◆ Route() [1/2]

anch::rest::Route::Route ( anch::rest::Method method,
std::string pattern,
std::vector< std::string > parameterNames )

Route constructor

Parameters
methodthe method
patternthe path pattern
parameterNamesthe path parameter names

◆ Route() [2/2]

anch::rest::Route::Route ( const Route & )
delete

Prohibit Route copy

Here is the call graph for this function:

◆ ~Route()

virtual anch::rest::Route::~Route ( )
virtual

Route destructor

Member Function Documentation

◆ check()

virtual std::optional< std::string > anch::rest::Route::check ( ) const
pure virtual

Check endpoint configuration (codecs)

Returns
the error message, empty when endpoint is valid

Implemented in anch::rest::Endpoint< F >.

Here is the call graph for this function:

◆ getMethod()

anch::rest::Method anch::rest::Route::getMethod ( ) const
noexcept

Method getter

Returns
the method
Here is the call graph for this function:

◆ getParameterNames()

const std::vector< std::string > & anch::rest::Route::getParameterNames ( ) const
noexcept

Path parameter names getter

Returns
the path parameter names
Here is the call graph for this function:

◆ getPathParameterCount()

virtual std::size_t anch::rest::Route::getPathParameterCount ( ) const
pure virtualnoexcept

Get the number of path parameters expected by endpoint

Returns
the number of path parameters

Implemented in anch::rest::Endpoint< F >.

◆ getPattern()

const std::string & anch::rest::Route::getPattern ( ) const
noexcept

Path pattern getter

Returns
the path pattern
Here is the call graph for this function:

◆ handle()

virtual anch::rest::Response anch::rest::Route::handle ( anch::rest::Request & request,
std::vector< std::string > & parameters )
pure virtual

Execute endpoint

Parameters
requestthe request (path parameters are set)
parametersthe decoded path parameters, in pattern order
Returns
the response
Exceptions
anch::rest::HttpExceptionon request error (400 , 406 , 415 ) or endpoint error

Implemented in anch::rest::Endpoint< F >.

◆ operator=()

Route & anch::rest::Route::operator= ( const Route & )
delete

Prohibit Route copy

Here is the call graph for this function:

Member Data Documentation

◆ _method

anch::rest::Method anch::rest::Route::_method
protected

◆ _parameterNames

std::vector<std::string> anch::rest::Route::_parameterNames
protected

Path parameter names, in pattern order

◆ _pattern

std::string anch::rest::Route::_pattern
protected

Path pattern


The documentation for this class was generated from the following file: