Inheritance diagram for restcgi::hdr:
Notes:
Public Types | |
typedef std::map< key, std::string > | map_type |
map type | |
typedef map_type::const_iterator | const_iterator |
const iterator | |
fc_null | |
none | |
fc_general = 1<<0 | |
general fields | |
fc_request = 1<<1 | |
request fields | |
fc_response = 1<<2 | |
response fields | |
fc_other = 1<<3 | |
other fields | |
fc_entity_rsp = 1<<4 | |
entity response fields | |
fc_entity_cnt = 1<<5 | |
entity content fields | |
enum | fld_category { fc_null, fc_general = 1<<0, fc_request = 1<<1, fc_response = 1<<2, fc_other = 1<<3, fc_entity_rsp = 1<<4, fc_entity_cnt = 1<<5 } |
Field category enumeration. IN TRANSMISSION ORDER!!! More... | |
Public Member Functions | |
virtual | ~hdr () |
Destruct. | |
bool | empty () const |
Test if empty. | |
const_iterator | begin () const |
Get map beginning. | |
const_iterator | end () const |
template<typename T> | |
bool | insert (const std::string &name, const T &value) |
template<typename T> | |
bool | find (const std::string &name, T &value) const |
bool | erase (const std::string &name) |
std::ostream & | operator<< (std::ostream &os) const |
Stream out in HTTP header format. | |
Static Public Member Functions | |
static const fld_traits * | find_fld_traits (const std::string &lower_name) |
Find standard field traits from lower-case name, returning 0 if not found. | |
Static Public Attributes | |
static const char | FLD_NAME_END_CHAR |
field name end char (':') | |
static const char | EOL_CSTR [3] |
end-of-line ("\r\n") | |
Protected Member Functions | |
hdr (int categories) | |
Construct. | |
bool | insert (int fld_traits_off, const std::string &v) |
Insert. | |
bool | insert (const key &k, const std::string &value, bool update=false) |
Insert. | |
std::string | find (int fld_traits_off) const |
Find. | |
virtual void | on_inserted (const_iterator it) |
Inserted notification. | |
Static Protected Member Functions | |
static void | throw_bad_request (const char *name, const char *what) |
Throw bad request. | |
Protected Attributes | |
const int | categories_ |
categories | |
Friends | |
void RESTCGI_API | copy (const env &e, request_hdr &rh, content_hdr &ch) |
Copy the request and content headers from the environment. | |
Classes | |
class | fld_traits |
Traits for the standard fields. More... | |
class | key |
Key for field-to-value map. More... |
const_iterator restcgi::hdr::end | ( | ) | const [inline] |
Get map end.
bool restcgi::hdr::erase | ( | const std::string & | name | ) |
Erase field, returning whether successful.
bool restcgi::hdr::find | ( | const std::string & | name, | |
T & | value | |||
) | const [inline] |
Find the field returning the typed value and whether found. Works with both standard and "other" fields. The name is case insensitive on lookup.
bad_request | if conversion error |
bool restcgi::hdr::insert | ( | const std::string & | name, | |
const T & | value | |||
) | [inline] |
Insert the field into the header, returning whether it was inserted or not. Fields are not overwritten if already in the header or the insert value is empty. Works for both standard fields and "other" fields. The name is case insensitive on lookup.
void RESTCGI_API copy | ( | const env & | e, | |
request_hdr & | rh, | |||
content_hdr & | ch | |||
) | [friend] |
Copy the request and content headers from the environment.
Note that the "general" and "other" fields are put into the request hdr, only content-specific ones are put in the content hdr.