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-pattern" to "Subscriber".

  • @tparam Param - input parameter for Subscriber.
  • @tparam ReturnType - output parameter of Subscriber.

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

Typedefs

Type Name Summary
Subscriber<Param, ReturnType> UrlSubscriber Convenience typedef for oatpp::web::url::mapping::Subscriber.
oatpp::data::share::StringKeyLabel StringKeyLabel Convenience typedef oatpp::data::share::StringKeyLabel.

Methods

Return Type Name Summary
void addSubscriber Add path-pattern subscriber.
Route getRoute Resolve path to corresponding subscriber.

Router::UrlSubscriber

Convenience typedef for oatpp::web::url::mapping::Subscriber.

typedef Subscriber<Param, ReturnType> UrlSubscriber

Router::StringKeyLabel

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

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

Router::addSubscriber

Add path-pattern subscriber.

  • @param urlPattern
  • @param subscriber

void addSubscriber(const oatpp::String& urlPattern,
                   const std::shared_ptr<UrlSubscriber>& subscriber)

Router::getRoute

Resolve path to corresponding subscriber.

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

Route getRoute(const StringKeyLabel& url)

Router::Route

Resolved "Route" for "path-pattern"

namespace oatpp { namespace web { namespace url { namespace mapping { 
  template<class Param, class ReturnType>
  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.
ReturnType processEvent Call oatpp::web::url::mapping::Subscriber::processEvent() with corresponding parameter.
oatpp::async::CoroutineStarterForResult<const ReturnType&> processEventAsync Call oatpp::web::url::mapping::Subscriber::processEventAsync() with corresponding parameter.

Router::Route::matchMap

Match map of resolved path containing resolved path variables.

Pattern::MatchMap matchMap

Router::Route::Route

  1. Default constructor.
    Route()
      : m_subscriber(nullptr)
    
  2. Constructor.
    • @param subscriber - Router::UrlSubscriber.
    • @param pMatchMap - Match map of resolved path containing resolved path variables.
    Route(UrlSubscriber* subscriber, const Pattern::MatchMap& pMatchMap)
      : m_subscriber(subscriber)
      , matchMap(pMatchMap)
    

Router::Route::processEvent

Call oatpp::web::url::mapping::Subscriber::processEvent() with corresponding parameter.

  • @param param
  • @return - corresponding ReturnType.

ReturnType processEvent(const Param& param) const

Router::Route::processEventAsync

Call oatpp::web::url::mapping::Subscriber::processEventAsync() with corresponding parameter.

  • @param param
  • @return - oatpp::async::CoroutineStarterForResult.

oatpp::async::CoroutineStarterForResult<const ReturnType&> processEventAsync(const Param& param) const