Multipart.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/mime/multipart/Multipart.hpp"

Headers

Namespace: oatpp::web::mime::multipart

Typedef for headers map. Headers map key is case-insensitive. std::unordered_map of oatpp::data::share::StringKeyLabelCI_FAST and oatpp::data::share::StringKeyLabel.

typedef std::unordered_map<oatpp::data::share::StringKeyLabelCI_FAST, oatpp::data::share::StringKeyLabel> Headers

Multipart

Structure that holds parts of Multipart.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class Multipart {}
}}}}

Methods

Return Type Name Summary
[none] Multipart Multiple implementations:
  1. Constructor.
  2. Constructor.
[none] ~Multipart Default virtual Destructor.
std::shared_ptr<Multipart> createSharedWithRandomBoundary Create Multipart object with random boundary.
oatpp::String getBoundary Get multipart boundary value.
void addPart Add part to Multipart.
std::shared_ptr<Part> getNamedPart Get part by name
const std::list<std::shared_ptr<Part>>& getAllParts Get list of all parts.
v_int32 count Get parts count.

Multipart::Multipart

  1. Constructor.
    • @param boundary - multipart boundary value.
    Multipart(const oatpp::String& boundary)
    
  2. Constructor.
    • @param requestHeaders - request headers. Headers must contain "Content-Type" header.
    Multipart(const Headers& requestHeaders)
    

Multipart::~Multipart

Default virtual Destructor.

virtual ~Multipart() = default

Multipart::createSharedWithRandomBoundary

Create Multipart object with random boundary.
It will generate random vector of size boundarySize in bytes encoded in base64.

  • @param boundarySize - size of the random vecrot in bytes.
  • @return - std::shared_ptr to Multipart.

static std::shared_ptr<Multipart> createSharedWithRandomBoundary(v_int32 boundarySize = 15)

Multipart::getBoundary

Get multipart boundary value.

  • @return - multipart boundary value.

oatpp::String getBoundary()

Multipart::addPart

Add part to Multipart.

void addPart(const std::shared_ptr<Part>& part)

Multipart::getNamedPart

Get part by name
Applicable to named parts only.

std::shared_ptr<Part> getNamedPart(const oatpp::String& name)

Multipart::getAllParts

Get list of all parts.

const std::list<std::shared_ptr<Part>>& getAllParts()

Multipart::count

Get parts count.

  • @return - parts count.

v_int32 count()

generateRandomBoundary

Namespace: oatpp::web::mime::multipart

Generate random boundary for Multipart object. Base64 encoded.

  • @param boundarySize - size in bytes of random vector.
  • @return - oatpp::String.

oatpp::String generateRandomBoundary(v_int32 boundarySize = 15)