|
RESTinio
|
Namespaces | |
| namespace | impl |
Classes | |
| struct | part_description_t |
| A description of one part with an uploaded file. More... | |
Typedefs | |
| using | handling_result_t = restinio::multipart_body::handling_result_t |
| The result to be returned from user-provided handler of parts of multipart body. | |
Enumerations | |
| enum class | enumeration_error_t { content_type_field_not_found , content_type_field_parse_error , content_type_field_inappropriate_value , illegal_boundary_value , content_disposition_field_parse_error , content_disposition_field_inappropriate_value , no_parts_found , no_files_found , terminated_by_handler , unexpected_error } |
| The result of an attempt to enumerate parts of a multipart body that contains uploaded file. More... | |
Functions | |
| RESTINIO_NODISCARD expected_t< part_description_t, enumeration_error_t > | analyze_part (restinio::multipart_body::parsed_part_t parsed_part) |
| Helper function for analyzing an already parsed part of a multipart body for presence of an uploaded file. | |
| template<typename Extra_Data , typename Handler > | |
| expected_t< std::size_t, enumeration_error_t > | enumerate_parts_with_files (const generic_request_t< Extra_Data > &req, Handler &&handler, string_view_t expected_media_type=string_view_t{"multipart"}, string_view_t expected_media_subtype=string_view_t{"form-data"}) |
| A helper function for enumeration of parts of a multipart body those contain uploaded files. | |
| using restinio::file_upload::handling_result_t = typedef restinio::multipart_body::handling_result_t |
The result to be returned from user-provided handler of parts of multipart body.
Definition at line 131 of file file_upload.hpp.
The result of an attempt to enumerate parts of a multipart body that contains uploaded file.
Definition at line 39 of file file_upload.hpp.
|
inline |
Helper function for analyzing an already parsed part of a multipart body for presence of an uploaded file.
This function returns an instance of part_description_t if an uploaded file is found in parsed_part.
If an uploaded file isn't found or any error detected during analysis of parsed_part then enumeration_error_t returned.
Usage example:
Definition at line 221 of file file_upload.hpp.
| expected_t< std::size_t, enumeration_error_t > restinio::file_upload::enumerate_parts_with_files | ( | const generic_request_t< Extra_Data > & | req, |
| Handler && | handler, | ||
| string_view_t | expected_media_type = string_view_t{"multipart"}, |
||
| string_view_t | expected_media_subtype = string_view_t{"form-data"} |
||
| ) |
A helper function for enumeration of parts of a multipart body those contain uploaded files.
This function:
Enumeration stops if handler returns handling_result_t::stop_enumeration or handling_result_t::terminate_enumeration. If handler returns handling_result_t::terminate_enumeration the enumerate_parts() returns enumeration_error_t::terminated_by_handler error code.
A handler passed as handler argument should be a function or lambda/functor with one of the following formats:
Note that enumerate_parts_with_files() passes part_description_t instance to handler as rvalue reference. And this reference will be invalidaded after the return from handler.
Usage example:
| req | Request to be processed. |
| handler | Handler to be called for every part with uploaded file. |
| expected_media_type | The value of 'type' part of media-type in Content-Type field. Please note: the special value '*' is not supported here. |
| expected_media_subtype | The value of 'subtype' part of media-type in Content-Type field. |
Definition at line 360 of file file_upload.hpp.