Poco::Net

class PartSource

Library: Net
Package: Messages
Header: Poco/Net/PartSource.h

Description

This abstract class is used for adding parts or attachments to mail messages, as well as for uploading files as part of a HTML form.

Inheritance

Known Derived Classes: FilePartSource, PartStore, FilePartStore, StringPartSource

Member Summary

Member Functions: filename, getContentLength, headers, mediaType, stream

Constructors

PartSource protected

PartSource();

Creates the PartSource, using the application/octet-stream MIME type.

PartSource protected

PartSource(
    const std::string & mediaType
);

Creates the PartSource, using the given MIME type.

Destructor

~PartSource virtual

virtual ~PartSource();

Destroys the PartSource.

Member Functions

filename virtual

virtual const std::string & filename() const;

Returns the filename for the part or attachment.

May be overridded by subclasses. The default implementation returns an empty string.

getContentLength virtual

virtual std::streamsize getContentLength() const;

Returns the content length for this part which may be UNKNOWN_CONTENT_LENGTH if not available.

headers inline

MessageHeader & headers();

Returns a MessageHeader containing additional header fields for the part.

headers

const MessageHeader & headers() const;

Returns a MessageHeader containing additional header fields for the part.

mediaType inline

const std::string & mediaType() const;

Returns the MIME media type for this part or attachment.

stream virtual

virtual std::istream & stream() = 0;

Returns an input stream for reading the part data.

Subclasses must override this method.

Variables

UNKNOWN_CONTENT_LENGTH static

static const int UNKNOWN_CONTENT_LENGTH;