This class represents the data set displayed in views.
More...
#include <drogon/HttpViewData.h>
|
| template<typename T> |
| const T & | get (const std::string &key) const |
|
void | insert (const std::string &key, std::any &&obj) |
| | Insert an item identified by the key parameter into the data set;.
|
|
void | insert (const std::string &key, const std::any &obj) |
| template<typename T> |
| void | insertAsString (const std::string &key, T &&val) |
|
void | insertFormattedString (const std::string &key, const char *format,...) |
| | Insert a formatted string identified by the key parameter.
|
|
std::any & | operator[] (const std::string &key) const |
| | Get the 'any' object by the key parameter.
|
|
| static std::string | htmlTranslate (const char *str, size_t length) |
| | Translate some special characters to HTML format.
|
|
static std::string | htmlTranslate (const std::string_view &str) |
|
static bool | needTranslation (const std::string_view &str) |
|
|
using | ViewDataMap = std::unordered_map<std::string, std::any> |
This class represents the data set displayed in views.
◆ get()
template<typename T>
| const T & drogon::HttpViewData::get |
( |
const std::string & | key | ) |
const |
|
inline |
The function template is used to get an item in the data set by the key parameter.
◆ htmlTranslate()
| std::string drogon::HttpViewData::htmlTranslate |
( |
const char * | str, |
|
|
size_t | length ) |
|
static |
Translate some special characters to HTML format.
such as:
" --> "
& --> &
< --> <
> --> >
◆ insertAsString()
template<typename T>
| void drogon::HttpViewData::insertAsString |
( |
const std::string & | key, |
|
|
T && | val ) |
|
inline |
Insert an item identified by the key parameter into the data set; The item is converted to a string.
The documentation for this class was generated from the following file: