RESTinio
Public Member Functions | Private Attributes | List of all members
restinio::http_response_header_t Struct Referencefinal

Resp header. More...

#include <http_headers.hpp>

Inheritance diagram for restinio::http_response_header_t:
restinio::http_header_common_t restinio::http_header_fields_t

Public Member Functions

 http_response_header_t ()
 
 http_response_header_t (http_status_line_t status_line)
 
http_status_code_t status_code () const noexcept
 
void status_code (http_status_code_t c) noexcept
 
const std::string & reason_phrase () const noexcept
 
void reason_phrase (std::string r)
 
const http_status_line_tstatus_line () const noexcept
 
void status_line (http_status_line_t sl)
 
- Public Member Functions inherited from restinio::http_header_common_t
std::uint64_t content_length () const noexcept
 Length of body of an http-message. More...
 
void content_length (std::uint64_t l) noexcept
 
bool should_keep_alive () const noexcept
 
void should_keep_alive (bool keep_alive) noexcept
 
http_connection_header_t connection () const
 Get the value of 'connection' header field. More...
 
void connection (http_connection_header_t ch) noexcept
 Set the value of 'connection' header field. More...
 
std::uint16_t http_major () const noexcept
 Http version. More...
 
void http_major (std::uint16_t v) noexcept
 
std::uint16_t http_minor () const noexcept
 
void http_minor (std::uint16_t v) noexcept
 
- Public Member Functions inherited from restinio::http_header_fields_t
 http_header_fields_t ()
 
 http_header_fields_t (const http_header_fields_t &)=default
 
 http_header_fields_t (http_header_fields_t &&)=default
 
virtual ~http_header_fields_t ()
 
http_header_fields_toperator= (const http_header_fields_t &)=default
 
http_header_fields_toperator= (http_header_fields_t &&)=default
 
void swap_fields (http_header_fields_t &http_header_fields)
 
bool has_field (string_view_t field_name) const noexcept
 Check field by name. More...
 
bool has_field (http_field_t field_id) const noexcept
 Check field by field-id. More...
 
void set_field (http_header_field_t http_header_field)
 Set header field via http_header_field_t. More...
 
void set_field (std::string field_name, std::string field_value)
 Set field with string pair. More...
 
void set_field (http_field_t field_id, std::string field_value)
 Set field with id-value pair. More...
 
void append_field (string_view_t field_name, string_view_t field_value)
 Append field with name. More...
 
void append_field (http_field_t field_id, string_view_t field_value)
 Append field with id. More...
 
const std::string & get_field (string_view_t field_name) const
 Get field by name. More...
 
nullable_pointer_t< const std::string > try_get_field (string_view_t field_name) const noexcept
 Try to get the value of a field by field name. More...
 
const std::string & get_field (http_field_t field_id) const
 Get field by id. More...
 
nullable_pointer_t< const std::string > try_get_field (http_field_t field_id) const noexcept
 Try to get the value of a field by field ID. More...
 
std::string get_field_or (string_view_t field_name, string_view_t default_value) const
 Get field value by field name or default value if the field not found. More...
 
std::string get_field_or (string_view_t field_name, std::string &&default_value) const
 Get field value by field name or default value if the field not found. More...
 
auto get_field_or (string_view_t field_name, const char *default_value) const
 Get field by name or default value if the field not found. More...
 
auto get_field_or (string_view_t field_name, const std::string &default_value) const
 Get field by name or default value if the field not found. More...
 
std::string get_field_or (http_field_t field_id, string_view_t default_value) const
 Get field by id or default value if the field not found. More...
 
auto get_field_or (http_field_t field_id, const char *default_value) const
 Get field by id or default value if the field not found. More...
 
auto get_field_or (http_field_t field_id, const std::string &default_value) const
 Get field by id or default value if the field not found. More...
 
std::string get_field_or (http_field_t field_id, std::string &&default_value) const
 Get field by id or default value if the field not found. More...
 
void remove_field (string_view_t field_name)
 Remove field by name. More...
 
void remove_field (http_field_t field_id)
 Remove field by id. More...
 
template<typename Lambda >
void for_each_field (Lambda &&lambda) const noexcept(noexcept(lambda(std::declval< const http_header_field_t &>())))
 Enumeration of fields. More...
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
auto fields_count () const noexcept
 
string_view_t value_of (string_view_t name) const
 Get the value of a field or throw if the field not found. More...
 
string_view_t value_of (http_field_t field_id) const
 Get the value of a field or throw if the field not found. More...
 
optional_t< string_view_topt_value_of (string_view_t name) const noexcept
 Get optional value of a field. More...
 
optional_t< string_view_topt_value_of (http_field_t field_id) const noexcept
 Get optional value of a field. More...
 

Private Attributes

http_status_line_t m_status_line
 

Additional Inherited Members

- Public Types inherited from restinio::http_header_fields_t
using fields_container_t = std::vector< http_header_field_t >
 
using const_iterator = fields_container_t::const_iterator
 Type of const_iterator for enumeration of fields. More...
 

Detailed Description

Resp header.

Definition at line 2130 of file http_headers.hpp.

Constructor & Destructor Documentation

◆ http_response_header_t() [1/2]

restinio::http_response_header_t::http_response_header_t ( )
inline

Definition at line 2134 of file http_headers.hpp.

◆ http_response_header_t() [2/2]

restinio::http_response_header_t::http_response_header_t ( http_status_line_t  status_line)
inline

Definition at line 2137 of file http_headers.hpp.

Member Function Documentation

◆ reason_phrase() [1/2]

const std::string& restinio::http_response_header_t::reason_phrase ( ) const
inlinenoexcept

Definition at line 2150 of file http_headers.hpp.

◆ reason_phrase() [2/2]

void restinio::http_response_header_t::reason_phrase ( std::string  r)
inline

Definition at line 2154 of file http_headers.hpp.

◆ status_code() [1/2]

http_status_code_t restinio::http_response_header_t::status_code ( ) const
inlinenoexcept

Definition at line 2142 of file http_headers.hpp.

◆ status_code() [2/2]

void restinio::http_response_header_t::status_code ( http_status_code_t  c)
inlinenoexcept

Definition at line 2146 of file http_headers.hpp.

◆ status_line() [1/2]

const http_status_line_t& restinio::http_response_header_t::status_line ( ) const
inlinenoexcept

Definition at line 2158 of file http_headers.hpp.

◆ status_line() [2/2]

void restinio::http_response_header_t::status_line ( http_status_line_t  sl)
inline

Definition at line 2164 of file http_headers.hpp.

Member Data Documentation

◆ m_status_line

http_status_line_t restinio::http_response_header_t::m_status_line
private

Definition at line 2170 of file http_headers.hpp.


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