Reader.hpp

This File On Github
Ask A Question

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

PartReader

Abstract read handler of multipart parts.

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

Methods

Return Type Name Summary
[none] ~PartReader Default virtual destructor.
void onNewPart Called when new part headers are parsed and part object is created.
void onPartData Called on each new chunk of data is parsed for the multipart-part.

PartReader::~PartReader

Default virtual destructor.

virtual ~PartReader() = default

PartReader::onNewPart

Called when new part headers are parsed and part object is created.

  • @param part

virtual void onNewPart(const std::shared_ptr<Part>& part) = 0

PartReader::onPartData

Called on each new chunk of data is parsed for the multipart-part.
When all data is read, called again with data == nullptr size == 0 to indicate end of the part.

  • @param part
  • @param data - pointer to buffer containing chunk data.
  • @param size - size of the buffer.

virtual void onPartData(const std::shared_ptr<Part>& part, p_char8 data, oatpp::data::v_io_size size) = 0

AsyncPartReader

Abstract Async read handler of multipart parts.

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

Methods

Return Type Name Summary
[none] ~AsyncPartReader Default virtual destructor.
async::CoroutineStarter onNewPartAsync Called when new part headers are parsed and part object is created.
async::CoroutineStarter onPartDataAsync Called on each new chunk of data is parsed for the multipart-part.

AsyncPartReader::~AsyncPartReader

Default virtual destructor.

virtual ~AsyncPartReader() = default

AsyncPartReader::onNewPartAsync

Called when new part headers are parsed and part object is created.

virtual async::CoroutineStarter onNewPartAsync(const std::shared_ptr<Part>& part) = 0

AsyncPartReader::onPartDataAsync

Called on each new chunk of data is parsed for the multipart-part.
When all data is read, called again with data == nullptr size == 0 to indicate end of the part.

virtual async::CoroutineStarter onPartDataAsync(const std::shared_ptr<Part>& part, p_char8 data, oatpp::data::v_io_size size) = 0

PartReadersMap

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

Map of part readers. <part-name> --> <part-reader>.

typedef std::unordered_map<oatpp::String, std::shared_ptr<PartReader>> PartReadersMap

PartsParser

In memory multipart parser.
Extends - oatpp::web::mime::multipart::StatefulParser::Listener.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class PartsParser : public StatefulParser::Listener {}
}}}}

Methods

Return Type Name Summary
[none] PartsParser Constructor.

PartsParser::PartsParser

Constructor.

PartsParser(Multipart* multipart)

AsyncPartReadersMap

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

Map of async part readers. <part-name> --> <part-reader>.

typedef std::unordered_map<oatpp::String, std::shared_ptr<AsyncPartReader>> AsyncPartReadersMap

AsyncPartsParser

Async In memory multipart parser.
Extends - oatpp::web::mime::multipart::StatefulParser::AsyncListener.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class AsyncPartsParser : public StatefulParser::AsyncListener {}
}}}}

Methods

Return Type Name Summary
[none] AsyncPartsParser Constructor.

AsyncPartsParser::AsyncPartsParser

Constructor.

AsyncPartsParser(Multipart* multipart)

Reader

In memory Multipart reader. Extends - oatpp::data::stream::WriteCallback.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class Reader : public oatpp::data::stream::WriteCallback {}
}}}}

Methods

Return Type Name Summary
[none] Reader Constructor.
void setPartReader Set named part reader.
void setDefaultPartReader Set default reader for parts.

Reader::Reader

Constructor.

  • @param multipart - Multipart object to save read data to.

Reader(Multipart* multipart)

Reader::setPartReader

Set named part reader.
Part with the name == partName will be read using the specified reader.

  • @param partName - name of the part to read.
  • @param reader - reader to read part with.

void setPartReader(const oatpp::String& partName, const std::shared_ptr<PartReader>& reader)

Reader::setDefaultPartReader

Set default reader for parts.
setPartReader has precedence.

  • @param reader

void setDefaultPartReader(const std::shared_ptr<PartReader>& reader)

AsyncReader

In memory Multipart reader. Extends - oatpp::data::stream::AsyncWriteCallback.

namespace oatpp { namespace web { namespace mime { namespace multipart { 
  class AsyncReader : public oatpp::data::stream::AsyncWriteCallback {}
}}}}

Methods

Return Type Name Summary
[none] AsyncReader Constructor.
void setPartReader Set named part reader.
void setDefaultPartReader Set default reader for parts.

AsyncReader::AsyncReader

Constructor.

  • @param multipart - Multipart object to save read data to.

AsyncReader(const std::shared_ptr<Multipart>& multipart)

AsyncReader::setPartReader

Set named part reader.
Part with the name == partName will be read using the specified reader.

  • @param partName - name of the part to read.
  • @param reader - reader to read part with.

void setPartReader(const oatpp::String& partName, const std::shared_ptr<AsyncPartReader>& reader)

AsyncReader::setDefaultPartReader

Set default reader for parts.
setPartReader has precedence.

  • @param reader

void setDefaultPartReader(const std::shared_ptr<AsyncPartReader>& reader)