Struct temporary_file
Defined in File helpers.hpp
Struct Documentation
-
struct temporary_file
A temporary file with RAII removal
Public Functions
-
explicit temporary_file(fs::path filename)
Create an empty temporary file with
filenameas its name.- Parameters:
filename – The desired filename for the file.
-
temporary_file(fs::path filename, const std::string_view &text)
Create a temporary file with
filenameas its name andtextas its contents.- Parameters:
filename – The desired filename for the file.
text – The text to be used for contents.
-
~temporary_file()
Destroy and remove a temporary file.
-
void write(const std::string_view &text)
Write text data to the temporary file.
- Parameters:
text – The text to write.
-
void write(const std::vector<char> &data)
Write binary data to the temporary file.
- Parameters:
text – The binary data to write.
-
fs::path filename() const
Return the
filenamefor the temporary file.- Returns:
The temporary file’s
filename.
-
std::size_t size() const
Return the
sizefor the temporary file.- Returns:
The temporary file’s
size.
-
explicit temporary_file(fs::path filename)