restinio::response_builder_t< restinio_controlled_output_t > Class Referencefinal

Simple standard response builder. More...

`#include <message_builders.hpp>`

Inheritance diagram for restinio::response_builder_t< restinio_controlled_output_t >:

## Public Types

using | base_type_t = base_response_builder_t< response_builder_t< restinio_controlled_output_t > >
using | self_type_t = response_builder_t< restinio_controlled_output_t >

## Public Member Functions

| response_builder_t (response_builder_t &&)=default
self_type_t & | set_body (writable_item_t body) &
| Set body. More...
self_type_t && | set_body (writable_item_t body) &&
| Set body. More...
self_type_t & | append_body (writable_item_t body_part) &
| Append body. More...
self_type_t && | append_body (writable_item_t body_part) &&
| Append body. More...
request_handling_status_t | done (write_status_cb_t wscb=write_status_cb_t{})
| Complete response. More...
Public Member Functions inherited from restinio::base_response_builder_t< response_builder_t< restinio_controlled_output_t > >
| base_response_builder_t (const base_response_builder_t &)=delete
| base_response_builder_t (base_response_builder_t &&) noexcept=default
| base_response_builder_t (http_status_line_t status_line, impl::connection_handle_t connection, request_id_t request_id, bool should_keep_alive)
base_response_builder_t & | operator= (const base_response_builder_t &)=delete
base_response_builder_t & | operator= (base_response_builder_t &&) noexcept=default
virtual | ~base_response_builder_t ()=default
response_builder_t< restinio_controlled_output_t > & | append_header (std::string field_name, std::string field_value) &
| Add header field. More...
response_builder_t< restinio_controlled_output_t > && | append_header (std::string field_name, std::string field_value) &&
| Add header field. More...
response_builder_t< restinio_controlled_output_t > & | append_header (http_header_field_t http_header_field) &
| Add header field. More...
response_builder_t< restinio_controlled_output_t > && | append_header (http_header_field_t http_header_field) &&
| Add header field. More...
response_builder_t< restinio_controlled_output_t > & | append_header (http_field_t field_id, std::string field_value) &
| Add header field. More...
response_builder_t< restinio_controlled_output_t > && | append_header (http_field_t field_id, std::string field_value) &&
| Add header field. More...
response_builder_t< restinio_controlled_output_t > & | append_header_date_field (std::chrono::system_clock::time_point tp=std::chrono::system_clock::now()) &
| Add header `Date` field. More...
response_builder_t< restinio_controlled_output_t > && | append_header_date_field (std::chrono::system_clock::time_point tp=std::chrono::system_clock::now()) &&
| Add header `Date` field. More...
response_builder_t< restinio_controlled_output_t > & | connection_close () &noexcept
| Set connection close. More...
response_builder_t< restinio_controlled_output_t > && | connection_close () &&noexcept
| Set connection close. More...
response_builder_t< restinio_controlled_output_t > & | connection_keep_alive () &noexcept
| Set connection keep-alive. More...
response_builder_t< restinio_controlled_output_t > && | connection_keep_alive () &&noexcept
http_response_header_t & | header () noexcept
| Accessors for header. More...
const http_response_header_t & | header () const noexcept

## Private Member Functions

self_type_t & | set_body_impl (writable_item_t &body, std::size_t body_size)
self_type_t & | append_body_impl (writable_item_t &body_part, std::size_t append_size)
void | if_neccessary_reserve_first_element_for_header ()

## Private Attributes

std::size_t | m_body_size { 0 }
writable_items_container_t | m_response_parts

## Additional Inherited Members

Protected Member Functions inherited from restinio::base_response_builder_t< response_builder_t< restinio_controlled_output_t > >
std::size_t | calculate_status_line_size () const noexcept
void | throw_done_must_be_called_once () const
Protected Attributes inherited from restinio::base_response_builder_t< response_builder_t< restinio_controlled_output_t > >
http_response_header_t | m_header
impl::connection_handle_t | m_connection
const request_id_t | m_request_id

## Detailed Description

Simple standard response builder.

Requires user to set header and body. Content length is automatically calculated. Once the data is ready, the user calls done() method and the resulting response is scheduled for sending.

Definition at line 258 of file message_builders.hpp.

## Member Typedef Documentation

## base_type_t

using restinio::response_builder_t< restinio_controlled_output_t >::base_type_t = base_response_builder_t< response_builder_t< restinio_controlled_output_t > >

Definition at line 262 of file message_builders.hpp.

## self_type_t

using restinio::response_builder_t< restinio_controlled_output_t >::self_type_t = response_builder_t< restinio_controlled_output_t >

Definition at line 264 of file message_builders.hpp.

## Constructor & Destructor Documentation

## response_builder_t()

restinio::response_builder_t< restinio_controlled_output_t >::response_builder_t | ( | response_builder_t< restinio_controlled_output_t > && |  | ) |

default

## Member Function Documentation

## append_body() [1/2]

self_type_t & restinio::response_builder_t< restinio_controlled_output_t >::append_body | ( | writable_item_t | body_part | ) | &

inline

Append body.

Definition at line 289 of file message_builders.hpp.

## append_body() [2/2]

self_type_t && restinio::response_builder_t< restinio_controlled_output_t >::append_body | ( | writable_item_t | body_part | ) | &&

inline

Append body.

Definition at line 297 of file message_builders.hpp.

## append_body_impl()

self_type_t & restinio::response_builder_t< restinio_controlled_output_t >::append_body_impl | ( | writable_item_t & | body_part,
|  | std::size_t | append_size
| ) |  |

inline private

Definition at line 364 of file message_builders.hpp.

## done()

request_handling_status_t restinio::response_builder_t< restinio_controlled_output_t >::done | ( | write_status_cb_t | wscb = `write_status_cb_t{}` | ) |

inline

Complete response.

Definition at line 304 of file message_builders.hpp.

## if_neccessary_reserve_first_element_for_header()

void restinio::response_builder_t< restinio_controlled_output_t >::if_neccessary_reserve_first_element_for_header | ( |  | ) |

inline private

Definition at line 378 of file message_builders.hpp.

## set_body() [1/2]

self_type_t & restinio::response_builder_t< restinio_controlled_output_t >::set_body | ( | writable_item_t | body | ) | &

inline

Set body.

Definition at line 274 of file message_builders.hpp.

## set_body() [2/2]

self_type_t && restinio::response_builder_t< restinio_controlled_output_t >::set_body | ( | writable_item_t | body | ) | &&

inline

Set body.

Definition at line 282 of file message_builders.hpp.

## set_body_impl()

self_type_t & restinio::response_builder_t< restinio_controlled_output_t >::set_body_impl | ( | writable_item_t & | body,
|  | std::size_t | body_size
| ) |  |

inline private

Definition at line 345 of file message_builders.hpp.

## Member Data Documentation

## m_body_size

std::size_t restinio::response_builder_t< restinio_controlled_output_t >::m_body_size { 0 }

private

Definition at line 387 of file message_builders.hpp.

## m_response_parts

writable_items_container_t restinio::response_builder_t< restinio_controlled_output_t >::m_response_parts

private

Definition at line 388 of file message_builders.hpp.

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

- restinio/message_builders.hpp