# PartReader.hpp
This File On Github
Ask A Question
API: latest
module: oatpp
#include "oatpp/web/mime/multipart/PartReader.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, const char* data, oatpp::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.
- @param part
- @return - oatpp::async::CoroutineStarter.
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.
- @param part
- @param data - pointer to buffer containing chunk data.
- @param size - size of the buffer.
- @return - oatpp::async::CoroutineStarter.
virtual async::CoroutineStarter onPartDataAsync(const std::shared_ptr<Part>& part, const char* data, oatpp::v_io_size size) = 0
# PartReaderResourceProvider
Resource provider for StreamPartReader
.
namespace oatpp { namespace web { namespace mime { namespace multipart {
class PartReaderResourceProvider {}
}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | ~PartReaderResourceProvider | Default virtual destructor. |
std::shared_ptr<data::resource::Resource> | getResource | Get data resource to write (save) part data in. |
async::CoroutineStarter | getResourceAsync | Get data resource to write (save) part data in. |
# PartReaderResourceProvider::~PartReaderResourceProvider
Default virtual destructor.
virtual ~PartReaderResourceProvider() = default
# PartReaderResourceProvider::getResource
Get data resource to write (save) part data in.
- @param part
- @return
virtual std::shared_ptr<data::resource::Resource> getResource(const std::shared_ptr<Part>& part) = 0
# PartReaderResourceProvider::getResourceAsync
Get data resource to write (save) part data in.
- @param part
- @param resource - put here pointer to obtained resource.
- @return
virtual async::CoroutineStarter getResourceAsync(const std::shared_ptr<Part>& part,
std::shared_ptr<data::resource::Resource>& resource) = 0
# StreamPartReader
Part reader used in order to stream part data.
namespace oatpp { namespace web { namespace mime { namespace multipart {
class StreamPartReader : public PartReader {}
}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | StreamPartReader | Constructor. |
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. |
# StreamPartReader::StreamPartReader
Constructor.
- @param resourceProvider
- @param maxDataSize - use
-1
for no limit.
StreamPartReader(const std::shared_ptr<PartReaderResourceProvider>& resourceProvider, v_io_size maxDataSize = -1)
# StreamPartReader::onNewPart
Called when new part headers are parsed and part object is created.
- @param part
void onNewPart(const std::shared_ptr<Part>& part) override
# StreamPartReader::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.
void onPartData(const std::shared_ptr<Part>& part, const char* data, oatpp::v_io_size size) override
# AsyncStreamPartReader
Async part reader used in order to stream part data in Asynchronous manner.
namespace oatpp { namespace web { namespace mime { namespace multipart {
class AsyncStreamPartReader : public AsyncPartReader {}
}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | AsyncStreamPartReader | Constructor. |
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. |
# AsyncStreamPartReader::AsyncStreamPartReader
Constructor.
- @param resourceProvider
- @param maxDataSize - use
-1
for no limit.
AsyncStreamPartReader(const std::shared_ptr<PartReaderResourceProvider>& resourceProvider, v_io_size maxDataSize = -1)
# AsyncStreamPartReader::onNewPartAsync
Called when new part headers are parsed and part object is created.
- @param part
- @return - oatpp::async::CoroutineStarter.
async::CoroutineStarter onNewPartAsync(const std::shared_ptr<Part>& part) override
# AsyncStreamPartReader::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.
- @param part
- @param data - pointer to buffer containing chunk data.
- @param size - size of the buffer.
- @return - oatpp::async::CoroutineStarter.
async::CoroutineStarter onPartDataAsync(const std::shared_ptr<Part>& part, const char* data, oatpp::v_io_size size) override