Router.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/url/mapping/Router.hpp"

Router

Class responsible to map "Path" to "Route" by "Path-Pattern".

  • @tparam Endpoint - endpoint of the route.

namespace oatpp { namespace web { namespace url { namespace mapping { 
  template<class Endpoint>
  class Router : public base::Countable {}
}}}}

Typedefs

Type Name Summary
std::pair<std::shared_ptr<Pattern>, std::shared_ptr<Endpoint>> Pair Pair oatpp::web::url::mapping::Pattern to Endpoint.
oatpp::data::share::StringKeyLabel StringKeyLabel Convenience typedef oatpp::data::share::StringKeyLabel.

Methods

Return Type Name Summary
void route Add path-pattern to endpoint mapping.
Route getRoute Resolve path to corresponding endpoint.

Router::Pair

Pair oatpp::web::url::mapping::Pattern to Endpoint.

typedef std::pair<std::shared_ptr<Pattern>, std::shared_ptr<Endpoint>> Pair

Router::StringKeyLabel

Convenience typedef oatpp::data::share::StringKeyLabel.

typedef oatpp::data::share::StringKeyLabel StringKeyLabel

Router::route

Add path-pattern to endpoint mapping.

  • @param pathPattern - path pattern for endpoint.
  • @param endpoint - route endpoint.

void route(const oatpp::String& pathPattern, const std::shared_ptr<Endpoint>& endpoint)

Router::getRoute

Resolve path to corresponding endpoint.

  • @param path
  • @return - Router::Route.

Route getRoute(const StringKeyLabel& path)

Router::Route

Resolved "Route" for "path-pattern"

namespace oatpp { namespace web { namespace url { namespace mapping { 
  template<class Endpoint>
  class Router : public base::Countable {
    class Route {}
  };
}}}}

Fields

Type Name Summary
Pattern::MatchMap matchMap Match map of resolved path containing resolved path variables.

Methods

Return Type Name Summary
[none] Route Multiple implementations:
  1. Default constructor.
  2. Constructor.
Endpoint* getEndpoint Get endpoint of the route.

Router::Route::matchMap

Match map of resolved path containing resolved path variables.

Pattern::MatchMap matchMap

Router::Route::Route

  1. Default constructor.
    Route()
      : m_endpoint(nullptr)
    
  2. Constructor.
    • @param pEndpoint - route endpoint.
    • @param pMatchMap - Match map of resolved path containing resolved path variables.
    Route(Endpoint* endpoint, const Pattern::MatchMap& pMatchMap)
      : m_endpoint(endpoint)
      , matchMap(pMatchMap)
    

Router::Route::getEndpoint

Get endpoint of the route.

Endpoint* getEndpoint()