Part.hpp

This File On Github
Ask A Question

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

Part

One part of the multipart.

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

Typedefs

Type Name Summary
oatpp::data::share::LazyStringMap<oatpp::data::share::StringKeyLabelCI_FAST> Headers Typedef for headers map. Headers map key is case-insensitive. For more info see oatpp::data::share::LazyStringMap.

Methods

Return Type Name Summary
[none] Part Multiple implementations:
  1. Constructor.
  2. Constructor.
void setDataInfo Multiple implementations:
  1. Set part data info.
  2. Same as setDataInfo(inputStream, nullptr, -1);.
oatpp::String getName Get name of the part.
oatpp::String getFilename Get filename of the part (if applicable).
const Headers& getHeaders Get request's headers map.
oatpp::String getHeader Get header value
void putHeader Add http header.
bool putHeaderIfNotExists Add http header if not already exists.
std::shared_ptr<data::stream::InputStream> getInputStream Get input stream of the part data.
oatpp::String getInMemoryData Get in-memory data (if applicable).
data::v_io_size getKnownSize Return known size of the part data.
void setTag Tag-object - object used to associate some data with the Part.
const char* getTagName Get tag name.
std::shared_ptr<oatpp::base::Countable> getTagObject Get tag object.
void clearTag Clear the tag.

Part::Headers

Typedef for headers map. Headers map key is case-insensitive. For more info see oatpp::data::share::LazyStringMap.

typedef oatpp::data::share::LazyStringMap<oatpp::data::share::StringKeyLabelCI_FAST> Headers

Part::Part

  1. Constructor.
    • @param headers - headers of the part.
    • @param inputStream - input stream of the part data.
    • @param inMemoryData - possible in-memory data of the part. Same data as the referred by input stream. For convenience purposes.
    • @param knownSize - known size of the data in the input stream. Pass -1 value if size is unknown.
    Part(const Headers& headers,
         const std::shared_ptr<data::stream::InputStream>& inputStream,
         const oatpp::String inMemoryData,
         data::v_io_size knownSize)
    
  2. Constructor.
    • @param headers - headers of the part.
    Part(const Headers& headers)
    

Part::setDataInfo

  1. Set part data info.
    • @param inputStream - input stream of the part data.
    • @param inMemoryData - possible in-memory data of the part. Same data as the referred by input stream. For convenience purposes.
    • @param knownSize - known size of the data in the input stream. Pass -1 value if size is unknown.
    void setDataInfo(const std::shared_ptr<data::stream::InputStream>& inputStream,
                     const oatpp::String inMemoryData,
                     data::v_io_size knownSize)
    
  2. Same as setDataInfo(inputStream, nullptr, -1);.
    • @param inputStream - input stream of the part data.
    void setDataInfo(const std::shared_ptr<data::stream::InputStream>& inputStream)
    

Part::getName

Get name of the part.

  • @return - name of the part.

oatpp::String getName() const

Part::getFilename

Get filename of the part (if applicable).

  • @return - filename.

oatpp::String getFilename() const

Part::getHeaders

Get request's headers map.

  • @return Headers map

const Headers& getHeaders() const

Part::getHeader

Get header value

  • @param headerName
  • @return header value

oatpp::String getHeader(const oatpp::data::share::StringKeyLabelCI_FAST& headerName) const

Part::putHeader

Add http header.

void putHeader(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value)

Part::putHeaderIfNotExists

Add http header if not already exists.

bool putHeaderIfNotExists(const oatpp::data::share::StringKeyLabelCI_FAST& key, const oatpp::data::share::StringKeyLabel& value)

Part::getInputStream

Get input stream of the part data.

  • @return - input stream of the part data.

std::shared_ptr<data::stream::InputStream> getInputStream() const

Part::getInMemoryData

Get in-memory data (if applicable).
It may be possible set for the part in case of storing part data in memory.
This property is optional. Preferred way to access data of the part is through getInputStream() method.

  • @return - in-memory data.

oatpp::String getInMemoryData() const

Part::getKnownSize

Return known size of the part data.

  • @return - known size of the part data. -1 - if size is unknown.

data::v_io_size getKnownSize() const

Part::setTag

Tag-object - object used to associate some data with the Part.
Ex.: used by oatpp::web::mime::multipart::InMemoryPartReader. to associate intermediate buffer with the part.

  • @param tagName
  • @param tagObject

void setTag(const char* tagName, const std::shared_ptr<oatpp::base::Countable>& tagObject)

Part::getTagName

Get tag name.

  • @return

const char* getTagName()

Part::getTagObject

Get tag object.

  • @return

std::shared_ptr<oatpp::base::Countable> getTagObject()

Part::clearTag

Clear the tag.

void clearTag()