NAWA 0.9
Web Application Framework for C++
nawa::MimeMultipart Class Reference

#include <nawa/util/MimeMultipart.h>

Classes

class  Part
 

Public Types

using HeadersMap = std::unordered_map< std::string, std::string >
 

Public Member Functions

virtual ~MimeMultipart ()
 
 MimeMultipart ()
 
 MimeMultipart (MimeMultipart const &other)
 
MimeMultipartoperator= (const MimeMultipart &other)
 
 MimeMultipart (MimeMultipart &&other) noexcept
 
MimeMultipartoperator= (MimeMultipart &&other) noexcept
 
 MimeMultipart (std::string const &contentType, std::string content)
 
void parse (std::string const &contentType, std::string content)
 
std::vector< Part > & parts () noexcept
 
std::vector< Part > const & parts () const noexcept
 
MimeMultipartparts (std::vector< Part > value) noexcept
 
void clear ()
 

Detailed Description

Class for parsing MIME multipart data, usually transmitted through POST. Currently, only parsing (and not creating) is supported, but it could be extended in future to create MIME for emails as well. The implementation currently does NOT support nested MIME parts.

Definition at line 39 of file MimeMultipart.h.

Member Typedef Documentation

◆ HeadersMap

using nawa::MimeMultipart::HeadersMap = std::unordered_map<std::string, std::string>

Definition at line 43 of file MimeMultipart.h.

Constructor & Destructor Documentation

◆ ~MimeMultipart()

virtual nawa::MimeMultipart::~MimeMultipart ( )
virtual

◆ MimeMultipart() [1/4]

nawa::MimeMultipart::MimeMultipart ( )

◆ MimeMultipart() [2/4]

nawa::MimeMultipart::MimeMultipart ( MimeMultipart const &  other)

◆ MimeMultipart() [3/4]

nawa::MimeMultipart::MimeMultipart ( MimeMultipart &&  other)
noexcept

◆ MimeMultipart() [4/4]

MimeMultipart::MimeMultipart ( std::string const &  contentType,
std::string  content 
)

Construct a MimeMultipart container and parse content. Throws a nawa::Exception in case of a parsing error (see parse() for details).

Parameters
contentTypeContent type of the data in content, including the boundary.
contentA MIME multipart source according to RFC 2046.

Definition at line 82 of file MimeMultipart.cpp.

Member Function Documentation

◆ operator=() [1/2]

MimeMultipart & nawa::MimeMultipart::operator= ( const MimeMultipart other)

◆ operator=() [2/2]

MimeMultipart & nawa::MimeMultipart::operator= ( MimeMultipart &&  other)
noexcept

◆ parse()

void MimeMultipart::parse ( std::string const &  contentType,
std::string  content 
)

Parse content into the MimeMultipart container. Clears the existing content before. Throws a nawa::Exception in case of a parsing error. Error codes:

  • 1: Could not find boundary in content type.
  • 2: Malformed MIME payload.
    Parameters
    contentTypeContent type of the data in content, including the boundary.
    contentA MIME multipart source according to RFC 2046.

Definition at line 86 of file MimeMultipart.cpp.

◆ parts() [1/3]

std::vector< Part > & nawa::MimeMultipart::parts ( )
noexcept

Access the MIME parts generated by the parser (in future, this class may be able to generate MIME using these parts, therefore, it is already possible to set them).

Returns
Reference to the generated parts.

◆ parts() [2/3]

std::vector< Part > const & nawa::MimeMultipart::parts ( ) const
noexcept

◆ parts() [3/3]

MimeMultipart & nawa::MimeMultipart::parts ( std::vector< Part value)
noexcept

◆ clear()

void MimeMultipart::clear ( )

Clear the existing content in the container.

Definition at line 162 of file MimeMultipart.cpp.


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