HTTP module

FormPart

An implementation of [FormPart]({#ref classicy_1_1http_1_1FormPart #}).

FormPart

#include <icy/http/form.h>

Subclassed by: FilePart, StringPart

An implementation of FormPart.

Public Methods

ReturnNameDescription
FormPartCreates the FormPart with the given MIME content type.
~FormPart virtualDestroys the FormPart.
voidreset virtualResets the internal state and write position to the beginning. Called by FormWriter when retrying or recalculating content length.
boolwriteChunkWrites the next chunk of data to the FormWriter.
voidwriteWrites the entire part data to the FormWriter in one call.
voidwriteWrites the entire part data to an output stream (used for content-length calculation).
NVCollection &headersReturns the extra MIME headers for this part (e.g. Content-Disposition).
boolinitialWrite virtual constReturns true if this is the first write call since construction or reset().
const std::string &contentType constReturns the MIME content type for this part.
uint64_tlength constReturns the total byte length of the part data.

FormPart

FormPart(const std::string & contentType)

Creates the FormPart with the given MIME content type.

Parameters

  • contentType MIME 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

  • writer The 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


write

void write(std::ostream & ostr)

Writes the entire part data to an output stream (used for content-length calculation).

Parameters

  • ostr Output 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() const

Returns true if this is the first write call since construction or reset().


contentType

const

const std::string & contentType() const

Returns the MIME content type for this part.


length

const

uint64_t length() const

Returns the total byte length of the part data.

Protected Attributes

ReturnNameDescription
std::string_contentType
uint64_t_length
NVCollection_headers
bool_initialWrite

_contentType

std::string _contentType

_length

uint64_t _length

_headers

NVCollection _headers

_initialWrite

bool _initialWrite