![]() |
C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
|
Represents HTTP headers, acts like a map. More...
#include <http_headers.h>
Classes | |
| struct | _case_insensitive_cmp |
| Function object to perform case insensitive comparison of wstrings. More... | |
Public Types | |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::key_type | key_type |
| STL-style typedefs More... | |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::key_compare | key_compare |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::allocator_type | allocator_type |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::size_type | size_type |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::difference_type | difference_type |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::pointer | pointer |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::const_pointer | const_pointer |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::reference | reference |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::const_reference | const_reference |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::iterator | iterator |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::const_iterator | const_iterator |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::reverse_iterator | reverse_iterator |
| typedef std::map< utility::string_t, utility::string_t, _case_insensitive_cmp >::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
| http_headers () | |
| Constructs an empty set of HTTP headers. More... | |
| http_headers (const http_headers &other) | |
| Copy constructor. More... | |
| http_headers & | operator= (const http_headers &other) |
| Assignment operator. More... | |
| http_headers (http_headers &&other) | |
| Move constructor. More... | |
| http_headers & | operator= (http_headers &&other) |
| Move assignment operator. More... | |
| template<typename _t1 > | |
| void | add (const key_type &name, const _t1 &value) |
| Adds a header field using the '<<' operator. More... | |
| void | remove (const key_type &name) |
| Removes a header field. More... | |
| void | clear () |
| Removes all elements from the headers. More... | |
| bool | has (const key_type &name) const |
| Checks if there is a header with the given key. More... | |
| size_type | size () const |
| Returns the number of header fields. More... | |
| bool | empty () const |
| Tests to see if there are any header fields. More... | |
| utility::string_t & | operator[] (const key_type &name) |
| Returns a reference to header field with given name, if there is no header field one is inserted. More... | |
| iterator | find (const key_type &name) |
| Checks if a header field exists with given name and returns an iterator if found. Otherwise and iterator to end is returned. More... | |
| const_iterator | find (const key_type &name) const |
| template<typename _t1 > | |
| bool | match (const key_type &name, _t1 &value) const |
| Attempts to match a header field with the given name using the '>>' operator. More... | |
| iterator | begin () |
| Returns an iterator referring to the first header field. More... | |
| const_iterator | begin () const |
| iterator | end () |
| Returns an iterator referring to the past-the-end header field. More... | |
| const_iterator | end () const |
| _ASYNCRTIMP utility::size64_t | content_length () const |
| Gets the content length of the message. More... | |
| _ASYNCRTIMP void | set_content_length (utility::size64_t length) |
| Sets the content length of the message. More... | |
| _ASYNCRTIMP utility::string_t | content_type () const |
| Gets the content type of the message. More... | |
| _ASYNCRTIMP void | set_content_type (utility::string_t type) |
| Sets the content type of the message. More... | |
| _ASYNCRTIMP utility::string_t | cache_control () const |
| Gets the cache control header of the message. More... | |
| _ASYNCRTIMP void | set_cache_control (utility::string_t control) |
| Sets the cache control header of the message. More... | |
| _ASYNCRTIMP utility::string_t | date () const |
| Gets the date header of the message. More... | |
| _ASYNCRTIMP void | set_date (const utility::datetime &date) |
| Sets the date header of the message. More... | |
Represents HTTP headers, acts like a map.
| typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::key_type web::http::http_headers::key_type |
STL-style typedefs
|
inline |
Constructs an empty set of HTTP headers.
|
inline |
Copy constructor.
| other | An http_headers object to copy from. |
|
inline |
Move constructor.
| other | An http_headers object to move. |
|
inline |
Adds a header field using the '<<' operator.
| name | The name of the header field. |
| value | The value of the header field. |
If the header field exists, the value will be combined as comma separated string.
|
inline |
Returns an iterator referring to the first header field.
| _ASYNCRTIMP utility::string_t web::http::http_headers::cache_control | ( | ) | const |
Gets the cache control header of the message.
|
inline |
Removes all elements from the headers.
| _ASYNCRTIMP utility::size64_t web::http::http_headers::content_length | ( | ) | const |
Gets the content length of the message.
| _ASYNCRTIMP utility::string_t web::http::http_headers::content_type | ( | ) | const |
Gets the content type of the message.
| _ASYNCRTIMP utility::string_t web::http::http_headers::date | ( | ) | const |
Gets the date header of the message.
|
inline |
Tests to see if there are any header fields.
true if there are no headers, false otherwise.
|
inline |
Returns an iterator referring to the past-the-end header field.
|
inline |
Checks if a header field exists with given name and returns an iterator if found. Otherwise and iterator to end is returned.
| name | The name of the header field. |
|
inline |
Checks if there is a header with the given key.
| name | The name of the header field. |
true if there is a header with the given name, false otherwise.
|
inline |
Attempts to match a header field with the given name using the '>>' operator.
| name | The name of the header field. |
| value | The value of the header field. |
true if header field was found and successfully stored in value parameter.
|
inline |
Assignment operator.
| other | An http_headers object to copy from. |
|
inline |
Move assignment operator.
| other | An http_headers object to move. |
|
inline |
Returns a reference to header field with given name, if there is no header field one is inserted.
|
inline |
Removes a header field.
| name | The name of the header field. |
| _ASYNCRTIMP void web::http::http_headers::set_cache_control | ( | utility::string_t | control | ) |
Sets the cache control header of the message.
| control | The cache control header value. |
| _ASYNCRTIMP void web::http::http_headers::set_content_length | ( | utility::size64_t | length | ) |
Sets the content length of the message.
| length | The length of the content. |
| _ASYNCRTIMP void web::http::http_headers::set_content_type | ( | utility::string_t | type | ) |
Sets the content type of the message.
| type | The content type of the body. |
| _ASYNCRTIMP void web::http::http_headers::set_date | ( | const utility::datetime & | date | ) |
Sets the date header of the message.
| date | The date header value. |
|
inline |
Returns the number of header fields.
1.8.10