FormPart
FormPart
#include <icy/http/form.h>Subclassed by:
FilePart,StringPart
An implementation of FormPart.
Public Methods
| Return | Name | Description |
|---|---|---|
FormPart | Creates the FormPart with the given MIME content type. | |
~FormPart virtual | Destroys the FormPart. | |
void | reset virtual | Resets the internal state and write position to the beginning. Called by FormWriter when retrying or recalculating content length. |
bool | writeChunk | Writes the next chunk of data to the FormWriter. |
void | write | Writes the entire part data to the FormWriter in one call. |
void | write | Writes the entire part data to an output stream (used for content-length calculation). |
NVCollection & | headers | Returns the extra MIME headers for this part (e.g. Content-Disposition). |
bool | initialWrite virtual const | Returns true if this is the first write call since construction or reset(). |
const std::string & | contentType const | Returns the MIME content type for this part. |
uint64_t | length const | Returns the total byte length of the part data. |
FormPart
FormPart(const std::string & contentType)Creates the FormPart with the given MIME content type.
Parameters
contentTypeMIME type for this part (default: "application/octet-stream").
~FormPart
virtual
virtual ~FormPart()Destroys the FormPart.
reset
virtual
virtual void reset()Resets the internal state and write position to the beginning. Called by FormWriter when retrying or recalculating content length.
writeChunk
bool writeChunk(FormWriter & writer)Writes the next chunk of data to the FormWriter.
Parameters
writerThe FormWriter to send the chunk through.
Returns
true if more data remains to be written; false when complete.
write
void write(FormWriter & writer)Writes the entire part data to the FormWriter in one call.
Parameters
writerThe FormWriter to send data through.
write
void write(std::ostream & ostr)Writes the entire part data to an output stream (used for content-length calculation).
Parameters
ostrOutput stream to write to.
headers
NVCollection & headers()Returns the extra MIME headers for this part (e.g. Content-Disposition).
initialWrite
virtual const
virtual bool initialWrite() constReturns true if this is the first write call since construction or reset().
contentType
const
const std::string & contentType() constReturns the MIME content type for this part.
length
const
uint64_t length() constReturns the total byte length of the part data.
Protected Attributes
| Return | Name | Description |
|---|---|---|
std::string | _contentType | |
uint64_t | _length | |
NVCollection | _headers | |
bool | _initialWrite |
_contentType
std::string _contentType_length
uint64_t _length_headers
NVCollection _headers_initialWrite
bool _initialWrite