Web framework C++  2.0.0
Simple web framework on c++ designed to easily create web pages, etc
Public Member Functions | List of all members
Headers Class Reference

wrapper class for http headers More...

#include <headers.h>

Collaboration diagram for Headers:
Collaboration graph

Public Member Functions

 Headers ()
 
 ~Headers ()
 
 Headers (std::string &httpHeaders)
 
std::string toString ()
 
std::unordered_map< std::string, std::string > getHeaders ()
 
void add (const char *key, const char *value)
 
bool getValue (const char *key, std::string &value)
 
void clear ()
 

Detailed Description

wrapper class for http headers

Headers consist of map with key-value pairs, and is using for Request and Response http objects

Constructor & Destructor Documentation

Headers::Headers ( )

create empty headers object

Headers::~Headers ( )

cleanup map of key-value pairs

Headers::Headers ( std::string &  httpHeaders)
explicit

create Headers, parsing http input string

Parameters
httpHeadersinput http headers string

Member Function Documentation

void Headers::add ( const char *  key,
const char *  value 
)

insert value by key to map, if key exists, it will be overwritten

Parameters
keyinput key
valueinput value
void Headers::clear ( )

delete all data

std::unordered_map<std::string, std::string> Headers::getHeaders ( )

get current map

Returns
map of key-value pairs
bool Headers::getValue ( const char *  key,
std::string &  value 
)

get value from map by key

Parameters
keysearched key
valueout param, if key exists, value will be written, nothing do otherwise
Returns
true if value exists, false otherwise
std::string Headers::toString ( )

serialize Headers to string

Returns
serialized string

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