#include <nawa/request/File.h>
Container for (especially POST-submitted) files.
Definition at line 35 of file File.h.
◆ ~File()
virtual nawa::File::~File |
( |
| ) |
|
|
virtual |
◆ File() [1/4]
File::File |
( |
std::shared_ptr< char[]> |
dataPtr, |
|
|
size_t |
size |
|
) |
| |
Construct a File from data.
- Parameters
-
dataPtr | Shared pointer to the file data. |
size | Size of the file. |
- Deprecated:
- Files should be constructed from std::string objects instead.
Definition at line 55 of file File.cpp.
◆ File() [2/4]
File::File |
( |
std::string const & |
data | ) |
|
|
explicit |
Construct a file from data stored in a string.
- Parameters
-
Definition at line 59 of file File.cpp.
◆ File() [3/4]
nawa::File::File |
( |
File const & |
other | ) |
|
Copy the File object which contains a reference to a file. Please note that this does not deep-copy the file in memory, just the reference!
- Parameters
-
other | File object to copy (the refence) from. |
◆ File() [4/4]
nawa::File::File |
( |
File && |
other | ) |
|
|
noexcept |
◆ operator=() [1/2]
File & nawa::File::operator= |
( |
const File & |
other | ) |
|
Copy-assign from another File object. Please note that this does not deep-copy the file in memory, just the reference!
- Parameters
-
other | File object to copy (the refence) from. |
- Returns
- This File object.
◆ operator=() [2/2]
File & nawa::File::operator= |
( |
File && |
other | ) |
|
|
noexcept |
◆ filename() [1/3]
std::string & nawa::File::filename |
( |
| ) |
|
|
noexcept |
Original file name (submitted by sender).
- Returns
- Reference to file name.
◆ filename() [2/3]
std::string const & nawa::File::filename |
( |
| ) |
const |
|
noexcept |
◆ filename() [3/3]
File & nawa::File::filename |
( |
std::string |
value | ) |
|
|
noexcept |
◆ contentType() [1/3]
std::string & nawa::File::contentType |
( |
| ) |
|
|
noexcept |
Content-Type string.
- Returns
- Reference to content-type string.
◆ contentType() [2/3]
std::string const & nawa::File::contentType |
( |
| ) |
const |
|
noexcept |
◆ contentType() [3/3]
File & nawa::File::contentType |
( |
std::string |
value | ) |
|
|
noexcept |
◆ size()
size_t File::size |
( |
| ) |
const |
|
noexcept |
Get file size in bytes.
- Returns
- File size.
Definition at line 65 of file File.cpp.
◆ toString()
std::string File::toString |
( |
| ) |
const |
Copy the file into a std::string
- Returns
- std::string containing the whole file
Definition at line 69 of file File.cpp.
◆ writeToDisk()
void File::writeToDisk |
( |
std::string const & |
path | ) |
const |
Write the file to disk. Throws a nawa::Excption with error code 1 on failure.
- Parameters
-
path | File name and path where to write the file. |
Definition at line 73 of file File.cpp.
The documentation for this class was generated from the following files: