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. More...
 
QString getTemporaryFilename ()
 Return the name of the temporary file. More...
 
void moveToTarget ()
 Rename the temporary file to the target filename. More...
 

Protected Attributes

QString m_target
 
QString m_temp
 

Detailed Description

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 26 of file TempWriteFile.h.

Constructor & Destructor Documentation

TempWriteFile::TempWriteFile ( QString  targetFileName)

Definition at line 23 of file TempWriteFile.cpp.

References m_target, m_temp, and SVCERR.

TempWriteFile::~TempWriteFile ( )

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.

Member Function Documentation

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(), 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, m_temp, and SVCERR.

Referenced by WavFileWriter::close(), and CSVFileWriter::writeSelection().

Member Data Documentation

QString TempWriteFile::m_target
protected

Definition at line 54 of file TempWriteFile.h.

Referenced by moveToTarget(), and TempWriteFile().

QString TempWriteFile::m_temp
protected

Definition at line 55 of file TempWriteFile.h.

Referenced by getTemporaryFilename(), moveToTarget(), TempWriteFile(), and ~TempWriteFile().


The documentation for this class was generated from the following files: