|
RADLib
RADical C++ application framework
|
RAII temporary file with optional auto-remove. More...
#include <RADCore.h>
Public Member Functions | |
| RADTemporaryFile (std::string prefix="radlib") | |
| Creates a temporary file with prefix. More... | |
| ~RADTemporaryFile () | |
| Closes and removes the file when autoRemove is enabled. More... | |
| RADTemporaryFile (const RADTemporaryFile &)=delete | |
| Temporary files own a file descriptor and cannot be copied. More... | |
| RADTemporaryFile & | operator= (const RADTemporaryFile &)=delete |
| Temporary files own a file descriptor and cannot be copied. More... | |
| RADTemporaryFile (RADTemporaryFile &&other) noexcept | |
| Moves ownership from other. More... | |
| RADTemporaryFile & | operator= (RADTemporaryFile &&other) noexcept |
| Moves ownership from other. More... | |
| bool | isValid () const |
| Returns true when file creation succeeded. More... | |
| const std::string & | fileName () const |
| Returns the temporary file path. More... | |
| int | fd () const |
| Returns the native file descriptor. More... | |
| void | setAutoRemove (bool enabled) |
| Enables or disables removal on destruction. More... | |
| bool | autoRemove () const |
| Returns true when destruction removes the file. More... | |
| bool | remove () |
| Removes the temporary file immediately. More... | |
RAII temporary file with optional auto-remove.
|
explicit |
Creates a temporary file with prefix.
| RADCore::RADTemporaryFile::~RADTemporaryFile | ( | ) |
Closes and removes the file when autoRemove is enabled.
|
delete |
Temporary files own a file descriptor and cannot be copied.
|
noexcept |
Moves ownership from other.
| bool RADCore::RADTemporaryFile::autoRemove | ( | ) | const |
Returns true when destruction removes the file.
| int RADCore::RADTemporaryFile::fd | ( | ) | const |
Returns the native file descriptor.
| const std::string& RADCore::RADTemporaryFile::fileName | ( | ) | const |
Returns the temporary file path.
| bool RADCore::RADTemporaryFile::isValid | ( | ) | const |
Returns true when file creation succeeded.
|
delete |
Temporary files own a file descriptor and cannot be copied.
|
noexcept |
Moves ownership from other.
| bool RADCore::RADTemporaryFile::remove | ( | ) |
Removes the temporary file immediately.
| void RADCore::RADTemporaryFile::setAutoRemove | ( | bool | enabled | ) |
Enables or disables removal on destruction.