svcore
1.9
|
A class that manages the creation of a temporary file with a given prefix and the renaming of that file to the prefix after use. More...
#include <TempWriteFile.h>
Public Member Functions | |
TempWriteFile (QString targetFileName) | |
~TempWriteFile () | |
Destroy the temporary file object. | |
QString | getTemporaryFilename () |
Return the name of the temporary file. | |
void | moveToTarget () |
Rename the temporary file to the target filename. | |
Protected Attributes | |
QString | m_target |
QString | m_temp |
A class that manages the creation of a temporary file with a given prefix and the renaming of that file to the prefix after use.
For use when saving a file over an existing one, to avoid clobbering the original before the save is complete.
Definition at line 27 of file TempWriteFile.h.
TempWriteFile::TempWriteFile | ( | QString | targetFileName | ) |
Definition at line 23 of file TempWriteFile.cpp.
Destroy the temporary file object.
If moveToTarget has not been called, the associated temporary file will be deleted without being copied to the target location.
Definition at line 38 of file TempWriteFile.cpp.
References m_temp.
QString TempWriteFile::getTemporaryFilename | ( | ) |
Return the name of the temporary file.
Unless the constructor threw an exception, this file will have been created already (but it will not be open).
(If moveToTarget has already been called, return an empty string.)
Definition at line 47 of file TempWriteFile.cpp.
References m_temp.
Referenced by WavFileWriter::getWriteFilename(), WavFileWriter::WavFileWriter(), CSVFileWriter::write(), and CSVFileWriter::writeSelection().
void TempWriteFile::moveToTarget | ( | ) |
Rename the temporary file to the target filename.
Definition at line 53 of file TempWriteFile.cpp.
References m_target, and m_temp.
Referenced by WavFileWriter::close(), CSVFileWriter::write(), and CSVFileWriter::writeSelection().
QString TempWriteFile::m_target [protected] |
Definition at line 55 of file TempWriteFile.h.
Referenced by moveToTarget(), and TempWriteFile().
QString TempWriteFile::m_temp [protected] |
Definition at line 56 of file TempWriteFile.h.
Referenced by getTemporaryFilename(), moveToTarget(), TempWriteFile(), and ~TempWriteFile().