Class MultiPartParser
Synopsis
#include <lib/inc/drogon/MultiPart.h>
class DROGON_EXPORT MultiPartParser
Description
A parser class which help the user to get the files and the parameters in the multipart format request.
Methods
MultiPartParser | ||
~MultiPartParser | ||
getFiles | Get files, This method should be called after calling the parse() method. | |
getFilesMap | Get files in a map, the keys of the map are item names of the files. | |
getParameters | Get parameters, This method should be called after calling the parse () method. | |
parse overload | Parse the http request stream to get files and parameters. | |
parseEntity |
Source
Lines 116-143 in lib/inc/drogon/MultiPart.h.
class DROGON_EXPORT MultiPartParser
{
public:
MultiPartParser(){};
~MultiPartParser(){};
/// Get files, This method should be called after calling the parse()
/// method.
const std::vector<HttpFile> &getFiles() const;
/// Get files in a map, the keys of the map are item names of the files.
std::unordered_map<std::string, HttpFile> getFilesMap() const;
/// Get parameters, This method should be called after calling the parse ()
/// method.
const std::map<std::string, std::string> &getParameters() const;
/// Parse the http request stream to get files and parameters.
int parse(const HttpRequestPtr &req);
protected:
std::vector<HttpFile> files_;
std::map<std::string, std::string> parameters_;
int parse(const HttpRequestPtr &req,
const char *boundaryData,
size_t boundaryLen);
int parseEntity(const char *begin, const char *end);
HttpRequestPtr requestPtr_;
};