#include <icy/http/form.h>Inherits:
FormPart
Form part backed by a file on disk.
| 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 | Resets the file stream to the beginning and clears initial-write state. |
bool | writeChunk virtual | Writes the next chunk of the file to the FormWriter. |
void | write virtual | Writes the entire file content to the FormWriter. |
void | write virtual | 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 | Returns the total file size in bytes. |
FilePart(const std::string & path)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(const std::string & path, const std::string & contentType)Creates the FilePart for the given path and MIME type.
Throws an FileException if the file cannot be opened.
FilePart(const std::string & path, const std::string & filename, const std::string & contentType)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.
virtual
virtual ~FilePart()Destroys the FilePart.
virtual
virtual void open()Opens the file for reading.
std::runtime_error if the file cannot be opened.virtual
virtual void reset()Resets the file stream to the beginning and clears initial-write state.
virtual
virtual bool writeChunk(FormWriter & writer)Writes the next chunk of the file to the FormWriter.
writer The FormWriter to send the chunk through.true if more data remains; false when the file is fully sent.
virtual
virtual void write(FormWriter & writer)Writes the entire file content to the FormWriter.
writer The FormWriter to send data through.virtual
virtual void write(std::ostream & ostr)Writes the entire file content to an output stream (used for content-length calculation).
ostr Output stream to write to.const
const std::string & filename() constReturns the filename component of the file path (not the full path).
std::ifstream & stream()Returns a reference to the underlying file input stream.
virtual const
virtual uint64_t length() constReturns the total file size in bytes.
std::string _pathstd::string _filenamestd::ifstream _istruint64_t _fileSize