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 780 of file regex_utils.cpp.

781 : req_(&req)
782 , backup_(req.params) {
783 req.params.clear();
784
785 if (mergeWithParent) {
786 for (const auto& [k, v] : backup_) {
787 req.params[k] = v;
788 }
789 }
790 for (const auto& [k, v] : params) {
791 req.params[k] = v;
792 }
793 }
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 795 of file regex_utils.cpp.

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

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: