RESTinio
Public Member Functions | Private Attributes | List of all members
restinio::chunk_info_t Class Reference

Information about one chunk in an incoming request with chunked encoding. More...

#include <chunked_input_info.hpp>

Public Member Functions

 chunk_info_t (std::size_t started_at, std::size_t size)
 Initializing constructor. More...
 
RESTINIO_NODISCARD std::size_t started_at () const noexcept
 Get the starting offset of chunk. More...
 
RESTINIO_NODISCARD std::size_t size () const noexcept
 Get the size of chunk. More...
 
RESTINIO_NODISCARD string_view_t make_string_view_nonchecked (string_view_t full_body) const noexcept
 Extract the chunk value from the whole body. More...
 
RESTINIO_NODISCARD string_view_t make_string_view (string_view_t full_body) const
 Extract the chunk value from the whole body. More...
 

Private Attributes

std::size_t m_started_at
 
std::size_t m_size
 

Detailed Description

Information about one chunk in an incoming request with chunked encoding.

In RESTinio v.0.6.9 all chunks are concatenated into the one body. The information about individual chunks preserved in the form of vector of chunk_info_t objects. Every object contains the offset from the begining of the concatenated body and the size of the chunk. This information allows to extract the corresponding fragment from the whole body.

Since
v.0.6.9

Definition at line 40 of file chunked_input_info.hpp.

Constructor & Destructor Documentation

◆ chunk_info_t()

restinio::chunk_info_t::chunk_info_t ( std::size_t  started_at,
std::size_t  size 
)
inline

Initializing constructor.

Definition at line 47 of file chunked_input_info.hpp.

Member Function Documentation

◆ make_string_view()

RESTINIO_NODISCARD string_view_t restinio::chunk_info_t::make_string_view ( string_view_t  full_body) const
inline

Extract the chunk value from the whole body.

A check of possibility of extraction is performed.

Exceptions
exception_tif full_body is too small to hold the chunk.

Definition at line 86 of file chunked_input_info.hpp.

◆ make_string_view_nonchecked()

RESTINIO_NODISCARD string_view_t restinio::chunk_info_t::make_string_view_nonchecked ( string_view_t  full_body) const
inlinenoexcept

Extract the chunk value from the whole body.

Attention
This method doesn't check the possibility of the extraction. An attempt of extraction of chunk from a body that is too small is undefined behavior.

Definition at line 73 of file chunked_input_info.hpp.

◆ size()

RESTINIO_NODISCARD std::size_t restinio::chunk_info_t::size ( ) const
inlinenoexcept

Get the size of chunk.

Definition at line 62 of file chunked_input_info.hpp.

◆ started_at()

RESTINIO_NODISCARD std::size_t restinio::chunk_info_t::started_at ( ) const
inlinenoexcept

Get the starting offset of chunk.

Definition at line 57 of file chunked_input_info.hpp.

Member Data Documentation

◆ m_size

std::size_t restinio::chunk_info_t::m_size
private

Definition at line 43 of file chunked_input_info.hpp.

◆ m_started_at

std::size_t restinio::chunk_info_t::m_started_at
private

Definition at line 42 of file chunked_input_info.hpp.


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