drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
drogon::MultiPartParser Class Reference

#include <drogon/MultiPart.h>

Collaboration diagram for drogon::MultiPartParser:

Public Member Functions

 MultiPartParser (const MultiPartParser &other)=default
 MultiPartParser (MultiPartParser &&other)=default
const std::vector< HttpFile > & getFiles () const
std::unordered_map< std::string, HttpFilegetFilesMap () const
 Get files in a map, the keys of the map are item names of the files.
const SafeStringMap< std::string > & getParameters () const
template<typename T>
std::optional< T > getOptionalParameter (const std::string &key)
template<typename T>
getParameter (const std::string &key)
int parse (const HttpRequestPtr &req)
 Parse the http request stream to get files and parameters.

Protected Member Functions

int parse (const HttpRequestPtr &req, const char *boundaryData, size_t boundaryLen)
int parseEntity (const HttpRequestPtr &req, const char *begin, const char *end)

Protected Attributes

std::vector< HttpFilefiles_
SafeStringMap< std::string > parameters_

Detailed Description

A parser class which help the user to get the files and the parameters in the multipart format request.

Member Function Documentation

◆ getFiles()

const std::vector< HttpFile > & drogon::MultiPartParser::getFiles ( ) const

Get files, This method should be called after calling the parse() method.

◆ getOptionalParameter()

template<typename T>
std::optional< T > drogon::MultiPartParser::getOptionalParameter ( const std::string & key)
inline

Get the value of an optional parameter This method should be called after calling the parse() method.

◆ getParameter()

template<typename T>
T drogon::MultiPartParser::getParameter ( const std::string & key)
inline

Get the value of a parameter This method should be called after calling the parse() method. Note: returns a default T object if the parameter is missing

◆ getParameters()

const SafeStringMap< std::string > & drogon::MultiPartParser::getParameters ( ) const

Get parameters, This method should be called after calling the parse () method.


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