Class MultiPartParser

Synopsis

#include <lib/inc/drogon/MultiPart.h>

class MultiPartParser

Description

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

Methods

MultiPartParser
~MultiPartParser
getFilesGet files, This method should be called after calling the parse() method.
getParametersGet parameters, This method should be called after calling the parse () method.
parseParse the http request stream to get files and parameters.
parseEntity

Source

Lines 93-117 in lib/inc/drogon/MultiPart.h. Line 94 in lib/inc/drogon/MultiPart.h.

class MultiPartParser
{
  public:
    MultiPartParser(){};
    ~MultiPartParser(){};
    /// Get files, This method should be called after calling the parse()
    /// method.
    const std::vector<HttpFile> &getFiles() 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_;
};





Add Discussion as Guest

Log in to DocsForge