SNode.C
Loading...
Searching...
No Matches
express::dispatcher::ScopedParams Class Reference

#include <regex_utils.h>

Collaboration diagram for express::dispatcher::ScopedParams:

Public Member Functions

 ScopedParams (express::Request &req, const std::map< std::string, std::string > &params, bool mergeWithParent)
 ~ScopedParams ()
 ScopedParams (const ScopedParams &)=delete
ScopedParamsoperator= (const ScopedParams &)=delete
 ScopedParams (ScopedParams &&)=delete
ScopedParamsoperator= (ScopedParams &&)=delete

Private Attributes

express::Requestreq_ {nullptr}
std::map< std::string, std::string > backup_

Detailed Description

Definition at line 121 of file regex_utils.h.

Constructor & Destructor Documentation

◆ ScopedParams() [1/3]

express::dispatcher::ScopedParams::ScopedParams ( express::Request & req,
const std::map< std::string, std::string > & params,
bool mergeWithParent )

Definition at line 781 of file regex_utils.cpp.

782 : req_(&req)
783 , backup_(req.params) {
784 req.params.clear();
785
786 if (mergeWithParent) {
787 for (const auto& [k, v] : backup_) {
788 req.params[k] = v;
789 }
790 }
791 for (const auto& [k, v] : params) {
792 req.params[k] = v;
793 }
794 }
std::map< std::string, std::string > params
Definition Request.h:81
std::map< std::string, std::string > backup_

References backup_, express::Request::params, and req_.

Referenced by express::dispatcher::ApplicationDispatcher::dispatch(), express::dispatcher::MiddlewareDispatcher::dispatch(), and express::dispatcher::RouterDispatcher::dispatch().

Here is the caller graph for this function:

◆ ~ScopedParams()

express::dispatcher::ScopedParams::~ScopedParams ( )

Definition at line 796 of file regex_utils.cpp.

796 {
797 if (req_ != nullptr) {
798 req_->params = std::move(backup_);
799 }
800 }

References backup_, express::Request::params, and req_.

◆ ScopedParams() [2/3]

express::dispatcher::ScopedParams::ScopedParams ( const ScopedParams & )
delete

◆ ScopedParams() [3/3]

express::dispatcher::ScopedParams::ScopedParams ( ScopedParams && )
delete

Member Function Documentation

◆ operator=() [1/2]

ScopedParams & express::dispatcher::ScopedParams::operator= ( const ScopedParams & )
delete

◆ operator=() [2/2]

ScopedParams & express::dispatcher::ScopedParams::operator= ( ScopedParams && )
delete

Member Data Documentation

◆ backup_

std::map<std::string, std::string> express::dispatcher::ScopedParams::backup_
private

Definition at line 133 of file regex_utils.h.

Referenced by ScopedParams(), and ~ScopedParams().

◆ req_

express::Request* express::dispatcher::ScopedParams::req_ {nullptr}
private

Definition at line 132 of file regex_utils.h.

132{nullptr};

Referenced by ScopedParams(), and ~ScopedParams().


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