HTTP module

StringPart

Form part backed by an in-memory string payload.

StringPart

#include <icy/http/form.h>

Inherits: FormPart

Form part backed by an in-memory string payload.

Public Methods

ReturnNameDescription
StringPartCreates a StringPart with the given data and default content type "application/octet-stream".
StringPartCreates a StringPart with the given data and MIME content type.
~StringPart virtualDestroys the StringPart.
boolwriteChunk virtualWrites the string data as a single chunk to the FormWriter.
voidwrite virtualWrites the string data to the FormWriter.
voidwrite virtualWrites the string data to an output stream.
uint64_tlength virtual constReturns the byte length of the string data.

StringPart

StringPart(const std::string & data)

Creates a StringPart with the given data and default content type "application/octet-stream".

Parameters

  • data String data to send as this part.

StringPart

StringPart(const std::string & data, const std::string & contentType)

Creates a StringPart with the given data and MIME content type.

Parameters

  • data String data to send as this part.

  • contentType MIME type for this part.


~StringPart

virtual

virtual ~StringPart()

Destroys the StringPart.


writeChunk

virtual

virtual bool writeChunk(FormWriter & writer)

Writes the string data as a single chunk to the FormWriter.

Parameters

Returns

false always (string data is sent in a single chunk).


write

virtual

virtual void write(FormWriter & writer)

Writes the string data to the FormWriter.

Parameters


write

virtual

virtual void write(std::ostream & ostr)

Writes the string data to an output stream.

Parameters

  • ostr Output stream to write to.

length

virtual const

virtual uint64_t length() const

Returns the byte length of the string data.

Protected Attributes

ReturnNameDescription
std::string_data

_data

std::string _data