HttpHeaders Class Reference

Encapsulates a set of HTTP header information. More...

#include <HttpHeaders.h>

Inheritance diagram for HttpHeaders:
Collaboration diagram for HttpHeaders:

Classes

class  HeaderConst
 
class  Iterator
 

Public Member Functions

 HttpHeaders ()=default
 
 HttpHeaders (const HttpHeaders &headers)
 
Iterator begin () const
 
Iterator end () const
 
const Stringoperator[] (const String &name) const
 Fetch a reference to the header field value by name. More...
 
Stringoperator[] (const String &name)
 Fetch a reference to the header field value by name. More...
 
String operator[] (unsigned index) const
 Return the HTTP header line for the value at the given index. More...
 
template<bool is_const>
String operator[] (const BaseElement< is_const > &elem) const
 
bool contains (const String &name) const
 Determine if given header field is present. More...
 
bool append (const HttpHeaderFieldName &name, const String &value)
 Append value to multi-value field. More...
 
void remove (const String &name)
 
void setMultiple (const HttpHeaders &headers)
 
HttpHeadersoperator= (const HttpHeaders &headers)
 
void clear ()
 
DateTime getLastModifiedDate () const
 
DateTime getServerDate () const
 
bool contains (const K &key) const
 
void remove (const K &key)
 
unsigned int count () const
 
- Public Member Functions inherited from HttpHeaderFields
Flags getFlags (HttpHeaderFieldName name) const
 Get flags (if any) for given header field. More...
 
String toString (HttpHeaderFieldName name) const
 
String toString (HttpHeaderFieldName name, const String &value) const
 
HttpHeaderFieldName fromString (const String &name) const
 Find the enumerated value for the given field name string. More...
 
HttpHeaderFieldName findOrCreate (const String &name)
 Find the enumerated value for the given field name string, create a custom entry if not found. More...
 
void clear ()
 

Additional Inherited Members

- Public Types inherited from HttpHeaderFields
enum class  Flag { Multi }
 Flag values providing additional information about header fields. More...
 
using Flags = BitSet< uint8_t, Flag, 1 >
 
- Static Public Member Functions inherited from HttpHeaderFields
static String toString (const String &name, const String &value)
 Produce a string for output in the HTTP header, with line ending. More...
 

Detailed Description

Encapsulates a set of HTTP header information.

Note
fields are stored as a map of field names vs. values. Standard fields may be accessed using enumeration tags. Behaviour is as for HashMap, with the addition of methods to support enumerated field names.
Todo:
add name and/or value escaping

Constructor & Destructor Documentation

◆ HttpHeaders() [1/2]

HttpHeaders::HttpHeaders ( )
default

◆ HttpHeaders() [2/2]

HttpHeaders::HttpHeaders ( const HttpHeaders headers)
inline

Member Function Documentation

◆ append()

bool HttpHeaders::append ( const HttpHeaderFieldName name,
const String value 
)

Append value to multi-value field.

Parameters
name
value
Return values
boolfalse if value exists and field does not permit multiple values

◆ begin()

Iterator HttpHeaders::begin ( ) const
inline

◆ clear()

void HttpHeaders::clear ( void  )
inline

◆ contains() [1/2]

bool HashMap< K, V >::contains
inline

◆ contains() [2/2]

bool HttpHeaders::contains ( const String name) const
inline

Determine if given header field is present.

◆ count()

unsigned int HashMap< K, V >::count
inline

◆ end()

Iterator HttpHeaders::end ( ) const
inline

◆ getLastModifiedDate()

DateTime HttpHeaders::getLastModifiedDate ( ) const
inline

◆ getServerDate()

DateTime HttpHeaders::getServerDate ( ) const
inline

◆ operator=()

HttpHeaders& HttpHeaders::operator= ( const HttpHeaders headers)
inline

◆ operator[]() [1/4]

template<bool is_const>
String HttpHeaders::operator[] ( const BaseElement< is_const > &  elem) const
inline

◆ operator[]() [2/4]

String& HttpHeaders::operator[] ( const String name)
inline

Fetch a reference to the header field value by name.

Parameters
name
Return values
String&Reference to value
Note
if the field doesn't exist it is created with the default null value

◆ operator[]() [3/4]

const String& HttpHeaders::operator[] ( const String name) const

Fetch a reference to the header field value by name.

Parameters
name
Return values
constString& Reference to value
Note
if the field doesn't exist a null String reference is returned

◆ operator[]() [4/4]

String HttpHeaders::operator[] ( unsigned  index) const
inline

Return the HTTP header line for the value at the given index.

Parameters
index
Return values
String
Note
if the index is invalid,

◆ remove() [1/2]

void HashMap< K, V >::remove
inline

◆ remove() [2/2]

void HttpHeaders::remove ( const String name)
inline

◆ setMultiple()

void HttpHeaders::setMultiple ( const HttpHeaders headers)

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