Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
http::MultipartStreamParser Class Reference

Streaming parser for multipart/form-data. More...

#include <MultipartStreamParser.hpp>

Public Types

using OnFieldCallback = std::function< void(const std::string &name, const std::string &value)>
 
using OnFileCallback = std::function< void(const std::string &name, const std::string &filename, const std::string &content_type, const std::string &tmp_filepath)>
 

Public Member Functions

 MultipartStreamParser (const std::string &boundary, OnFieldCallback on_field, OnFileCallback on_file)
 Constructs a new MultipartStreamParser.
 
 ~MultipartStreamParser ()
 
void feed (std::string_view chunk)
 Feeds a chunk of data into the parser.
 
void end ()
 Signals the end of the input stream.
 

Detailed Description

Streaming parser for multipart/form-data.

Member Typedef Documentation

◆ OnFieldCallback

using http::MultipartStreamParser::OnFieldCallback = std::function<void(const std::string& name, const std::string& value)>

◆ OnFileCallback

using http::MultipartStreamParser::OnFileCallback = std::function<void(const std::string& name, const std::string& filename, const std::string& content_type, const std::string& tmp_filepath)>

Constructor & Destructor Documentation

◆ MultipartStreamParser()

http::MultipartStreamParser::MultipartStreamParser ( const std::string &  boundary,
OnFieldCallback  on_field,
OnFileCallback  on_file 
)

Constructs a new MultipartStreamParser.

Parameters
boundaryThe boundary string from the Content-Type header.
on_fieldCallback invoked when a standard form field is parsed.
on_fileCallback invoked when a file is parsed and saved to a temporary location.

◆ ~MultipartStreamParser()

http::MultipartStreamParser::~MultipartStreamParser ( )

Member Function Documentation

◆ end()

void http::MultipartStreamParser::end ( )

Signals the end of the input stream.

◆ feed()

void http::MultipartStreamParser::feed ( std::string_view  chunk)

Feeds a chunk of data into the parser.

Parameters
chunkThe data chunk to parse.

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