Web framework C++
2.0.0
Simple web framework on c++ designed to easily create web pages, etc
|
class wrapper for middleware More...
#include <middleware.h>
Public Member Functions | |
Middleware (const char *nameID) | |
virtual | ~Middleware () |
void | setContent (Request *request, Response *response) |
void | addValueToMap (const char *key, const char *value) |
bool | getValueFromMap (const char *key, std::string &value) |
std::unordered_map< std::string, std::string > * | getMap () |
virtual bool | autoExec ()=0 |
virtual void | exec ()=0 |
std::string | getNameID () |
virtual void | clear () |
Protected Attributes | |
Request * | request |
Response * | response |
std::unordered_map< std::string, std::string > * | map |
class wrapper for middleware
Middleware have got current request and response objects and also map for key-value pairs. Method exec and autoExec can use request and response objects to perform actions.
Middleware::Middleware | ( | const char * | nameID | ) |
|
virtual |
void Middleware::addValueToMap | ( | const char * | key, |
const char * | value | ||
) |
Add value to map by key. If key exists, it should be overwritten
key | key as string |
value | value as string |
|
pure virtual |
Check if current request allow do exec method
Implemented in AuthMiddleware, FsMiddleware, JsonMiddleware, FormMiddleware, HtmlMiddleware, and CookieMiddleware.
|
virtual |
delete all data, saved in internal values, set to default
Reimplemented in AuthMiddleware, HtmlMiddleware, CookieMiddleware, JsonMiddleware, and FormMiddleware.
|
pure virtual |
perform operation with request and response objects
Implemented in AuthMiddleware, FsMiddleware, JsonMiddleware, FormMiddleware, HtmlMiddleware, and CookieMiddleware.
std::unordered_map<std::string, std::string>* Middleware::getMap | ( | ) |
get map of key-value pairs
std::string Middleware::getNameID | ( | ) |
get name id of middleware
bool Middleware::getValueFromMap | ( | const char * | key, |
std::string & | value | ||
) |
get value from map by key
key | needed key |
value | out param, if value exists should be written, do nothing otherwise |
set request and response objects into Middleware
request | request object |
response | response object |
|
protected |
|
protected |
|
protected |