#include <file.h>
A RAII type to replace std::FILE *.
While open, the file name ends with ".unfinished".
Automatically closes and renames the file to the original when it goes out of scope.
Public Member Functions | |
| RenamingFilePtr (const bf::path &filename, const std::string &mode) | |
Construct a RenamingFilePtr. More... | |
| FILE * | get () |
Get the underlying FILE* pointer. More... | |
| ~RenamingFilePtr () | |
| Close the file and rename it. More... | |
Private Attributes | |
| FILE * | file_ |
| Internal file pointer. More... | |
| bf::path | filename_ |
| Path of the finished file. More... | |
| bf::path | filename_unfinished_ |
| Path of the unfinished file. More... | |
| smash::RenamingFilePtr::RenamingFilePtr | ( | const bf::path & | filename, |
| const std::string & | mode | ||
| ) |
Construct a RenamingFilePtr.
| [in] | filename | Path to the file. |
| [in] | mode | The mode in which the file should be opened (see std::fopen). |
Definition at line 19 of file file.cc.
| smash::RenamingFilePtr::~RenamingFilePtr | ( | ) |
| FILE * smash::RenamingFilePtr::get | ( | ) |
|
private |
|
private |
|
private |