FilePart
FilePart
#include <icy/http/form.h>class FilePartDefined in src/http/include/icy/http/form.h:236
Inherits:
FormPart
Form part backed by a file on disk.
List of all members
| Name | Kind | Owner |
|---|---|---|
FilePart | function | Declared here |
FilePart | function | Declared here |
FilePart | function | Declared here |
~FilePart | function | Declared here |
open | function | Declared here |
reset | function | Declared here |
writeChunk | function | Declared here |
write | function | Declared here |
write | function | Declared here |
filename | function | Declared here |
stream | function | Declared here |
length | function | Declared here |
_path | variable | Declared here |
_filename | variable | Declared here |
_istr | variable | Declared here |
_fileSize | variable | Declared here |
FormPart | function | Inherited from FormPart |
~FormPart | function | Inherited from FormPart |
reset | function | Inherited from FormPart |
writeChunk | function | Inherited from FormPart |
write | function | Inherited from FormPart |
write | function | Inherited from FormPart |
headers | function | Inherited from FormPart |
initialWrite | function | Inherited from FormPart |
contentType | function | Inherited from FormPart |
length | function | Inherited from FormPart |
_contentType | variable | Inherited from FormPart |
_length | variable | Inherited from FormPart |
_headers | variable | Inherited from FormPart |
_initialWrite | variable | Inherited from FormPart |
Inherited from FormPart
| Kind | Name | Description |
|---|---|---|
function | FormPart | Creates the FormPart with the given MIME content type. |
function | ~FormPart virtual | Destroys the FormPart. |
function | reset virtual | Resets the internal state and write position to the beginning. Called by FormWriter when retrying or recalculating content length. |
function | writeChunk virtual | Writes the next chunk of data to the FormWriter. |
function | write virtual | Writes the entire part data to the FormWriter in one call. |
function | write virtual | Writes the entire part data to an output stream (used for content-length calculation). |
function | headers | Returns the extra MIME headers for this part (e.g. Content-Disposition). |
function | initialWrite virtual const | Returns true if this is the first write call since construction or reset(). |
function | contentType const | Returns the MIME content type for this part. |
function | length virtual const | Returns the total byte length of the part data. |
variable | _contentType | |
variable | _length | |
variable | _headers | |
variable | _initialWrite |
Public Methods
| Return | Name | Description |
|---|---|---|
FilePart | Creates the FilePart for the given path. | |
FilePart | Creates the FilePart for the given path and MIME type. | |
FilePart | Creates the FilePart for the given path and MIME type. The given filename is used as part filename (see filename()) only. | |
~FilePart virtual | Destroys the FilePart. | |
void | open virtual | Opens the file for reading. |
void | reset virtual override | Resets the file stream to the beginning and clears initial-write state. |
bool | writeChunk virtual override | Writes the next chunk of the file to the FormWriter. |
void | write virtual override | Writes the entire file content to the FormWriter. |
void | write virtual override | Writes the entire file content to an output stream (used for content-length calculation). |
const std::string & | filename const | Returns the filename component of the file path (not the full path). |
std::ifstream & | stream | Returns a reference to the underlying file input stream. |
uint64_t | length virtual const override | Returns the total file size in bytes. |
FilePart
FilePart(const std::string & path)Defined in src/http/include/icy/http/form.h:244
Creates the FilePart for the given path.
The MIME type is set to application/octet-stream.
Throws an FileException if the file cannot be opened.
FilePart
FilePart(const std::string & path, const std::string & contentType)Defined in src/http/include/icy/http/form.h:250
Creates the FilePart for the given path and MIME type.
Throws an FileException if the file cannot be opened.
FilePart
FilePart(const std::string & path, const std::string & filename, const std::string & contentType)Defined in src/http/include/icy/http/form.h:257
Creates the FilePart for the given path and MIME type. The given filename is used as part filename (see filename()) only.
Throws an FileException if the file cannot be opened.
~FilePart
virtual
virtual ~FilePart()Defined in src/http/include/icy/http/form.h:261
Destroys the FilePart.
open
virtual
virtual void open()Defined in src/http/include/icy/http/form.h:265
Opens the file for reading.
Exceptions
std::runtime_errorif the file cannot be opened.
reset
virtual override
virtual void reset() overrideDefined in src/http/include/icy/http/form.h:268
Resets the file stream to the beginning and clears initial-write state.
Reimplements
writeChunk
virtual override
virtual bool writeChunk(FormWriter & writer) overrideDefined in src/http/include/icy/http/form.h:273
Writes the next chunk of the file to the FormWriter.
Parameters
writerThe FormWriter to send the chunk through.
Returns
true if more data remains; false when the file is fully sent.
Reimplements
write
virtual override
virtual void write(FormWriter & writer) overrideDefined in src/http/include/icy/http/form.h:277
Writes the entire file content to the FormWriter.
Parameters
writerThe FormWriter to send data through.
Reimplements
write
virtual override
virtual void write(std::ostream & ostr) overrideDefined in src/http/include/icy/http/form.h:281
Writes the entire file content to an output stream (used for content-length calculation).
Parameters
ostrOutput stream to write to.
Reimplements
filename
const
const std::string & filename() constDefined in src/http/include/icy/http/form.h:284
Returns the filename component of the file path (not the full path).
stream
std::ifstream & stream()Defined in src/http/include/icy/http/form.h:287
Returns a reference to the underlying file input stream.
length
virtual const override
virtual uint64_t length() const overrideDefined in src/http/include/icy/http/form.h:290
Returns the total file size in bytes.
Reimplements
Protected Attributes
_path
std::string _pathDefined in src/http/include/icy/http/form.h:293
_filename
std::string _filenameDefined in src/http/include/icy/http/form.h:294
_istr
std::ifstream _istrDefined in src/http/include/icy/http/form.h:295
_fileSize
uint64_t _fileSize