RESTinio
Classes | Namespaces | Enumerations | Functions | Variables
multipart_body.hpp File Reference

Various tools for working with multipart bodies. More...

#include <restinio/helpers/string_algo.hpp>
#include <restinio/helpers/easy_parser.hpp>
#include <restinio/helpers/http_field_parsers/basics.hpp>
#include <restinio/helpers/http_field_parsers/content-type.hpp>
#include <restinio/http_headers.hpp>
#include <restinio/request_handler.hpp>
#include <restinio/expected.hpp>
#include <restinio/impl/string_caseless_compare.hpp>
#include <restinio/utils/metaprogramming.hpp>
#include <iostream>

Go to the source code of this file.

Classes

struct  restinio::multipart_body::parsed_part_t
 A description of parsed content of one part of a multipart body. More...
 
struct  restinio::multipart_body::impl::parser_details::body_producer_t
 A special producer that consumes the whole remaining content from the input stream. More...
 
struct  restinio::multipart_body::impl::parser_details::field_value_producer_t
 A special producer that consumes the rest of the current line in the input stream until CR/LF will be found. More...
 
struct  restinio::multipart_body::impl::valid_handler_type< typename, typename >
 
struct  restinio::multipart_body::impl::valid_handler_type< T, restinio::utils::metaprogramming::void_t< std::enable_if_t< std::is_same< handling_result_t, decltype(std::declval< T >()(std::declval< parsed_part_t >())) >::value, bool > > >
 

Namespaces

namespace  restinio
 
namespace  restinio::multipart_body
 
namespace  restinio::multipart_body::impl
 
namespace  restinio::multipart_body::impl::parser_details
 
namespace  restinio::multipart_body::impl::boundary_value_checkers
 

Enumerations

enum class  restinio::multipart_body::handling_result_t { restinio::multipart_body::continue_enumeration , restinio::multipart_body::stop_enumeration , restinio::multipart_body::terminate_enumeration }
 The result to be returned from user-provided handler of parts of multipart body. More...
 
enum class  restinio::multipart_body::enumeration_error_t {
  restinio::multipart_body::content_type_field_not_found , restinio::multipart_body::content_type_field_parse_error , restinio::multipart_body::content_type_field_inappropriate_value , restinio::multipart_body::illegal_boundary_value ,
  restinio::multipart_body::no_parts_found , restinio::multipart_body::terminated_by_handler , restinio::multipart_body::unexpected_error
}
 The result of an attempt to enumerate parts of a multipart body. More...
 

Functions

RESTINIO_NODISCARD std::vector< string_view_t > restinio::multipart_body::split_multipart_body (string_view_t body, string_view_t boundary)
 Helper function for spliting a multipart body into a serie of separate parts. More...
 
RESTINIO_NODISCARD auto restinio::multipart_body::impl::make_parser ()
 A factory function for a parser of a part of multipart message. More...
 
RESTINIO_NODISCARD expected_t< parsed_part_t, restinio::easy_parser::parse_error_trestinio::multipart_body::try_parse_part (string_view_t part)
 Helper function for parsing content of one part of a multipart body. More...
 
RESTINIO_NODISCARD constexpr bool restinio::multipart_body::impl::boundary_value_checkers::is_bcharnospace (char ch)
 
RESTINIO_NODISCARD constexpr bool restinio::multipart_body::impl::boundary_value_checkers::is_bchar (char ch)
 
RESTINIO_NODISCARD optional_t< enumeration_error_t > restinio::multipart_body::check_boundary_value (string_view_t value)
 A helper function for checking the validity of 'boundary' value. More...
 
template<typename Extra_Data >
RESTINIO_NODISCARD expected_t< std::string, enumeration_error_t > restinio::multipart_body::detect_boundary_for_multipart_body (const generic_request_t< Extra_Data > &req, string_view_t expected_media_type, optional_t< string_view_t > expected_media_subtype)
 Helper function for parsing Content-Type field and extracting the value of 'boundary' parameter. More...
 
template<typename Handler >
RESTINIO_NODISCARD expected_t< std::size_t, enumeration_error_t > restinio::multipart_body::impl::enumerate_parts_of_request_body (const std::vector< string_view_t > &parts, Handler &&handler)
 A function that parses every part of a multipart body and calls a user-provided handler for every parsed part. More...
 
template<typename User_Type , typename Handler >
RESTINIO_NODISCARD expected_t< std::size_t, enumeration_error_t > restinio::multipart_body::enumerate_parts (const generic_request_t< User_Type > &req, Handler &&handler, string_view_t expected_media_type=string_view_t{ "multipart" }, optional_t< string_view_t > expected_media_subtype=nullopt)
 A helper function for enumeration of parts of a multipart body. More...
 

Variables

constexpr char restinio::multipart_body::impl::parser_details::CR = '\r'
 
constexpr char restinio::multipart_body::impl::parser_details::LF = '\n'
 

Detailed Description

Various tools for working with multipart bodies.

Since
v.0.6.1

Definition in file multipart_body.hpp.