Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
RouteMatch Struct Reference

Represents a match of a route against an incoming HTTP request. More...

#include <RouteTypes.h>

+ Collaboration diagram for RouteMatch:

Public Member Functions

std::optional< std::string > getParam (const std::string &name) const
 

Public Attributes

std::vector< std::string > ordered
 
std::unordered_map< std::string, std::string > named
 

Detailed Description

This structure holds the ordered parameters and named parameters extracted from the route. It provides a method to retrieve a parameter by name.

Examples
/home/runner/work/pico-framework-docs/pico-framework-docs/pico-framework/framework/include/http/Middleware.h.

Definition at line 18 of file RouteTypes.h.

Member Function Documentation

◆ getParam()

std::optional< std::string > RouteMatch::getParam ( const std::string &  name) const
inline

Definition at line 22 of file RouteTypes.h.

22 {
23 auto it = named.find(name);
24 if (it != named.end()) return it->second;
25 return std::nullopt;
26 }
std::unordered_map< std::string, std::string > named
Definition RouteTypes.h:20

References named.

Referenced by DashboardController::deleteFile(), and DashboardController::setLedState().

+ Here is the caller graph for this function:

Member Data Documentation

◆ named

std::unordered_map<std::string, std::string> RouteMatch::named

Definition at line 20 of file RouteTypes.h.

Referenced by getParam(), and Router::handleRequest().

◆ ordered

std::vector<std::string> RouteMatch::ordered

Definition at line 19 of file RouteTypes.h.

Referenced by Router::handleRequest(), and GpioController::initRoutes().


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