Workspace 6.21.5
|
An application-level temporary directory, similar to QTemporaryFile. More...
#include <Workspace/Application/System/temporarydirectory.h>
Public Member Functions | |
TemporaryDirectory (const QString &prefix) | |
TemporaryDirectory (const TemporaryDirectory &tmpDir) | |
~TemporaryDirectory () | |
QDir | getDir () const |
QString | getFilePath (const QString &fileName) const |
QString | getPath () const |
QString | getPrefix () const |
bool | isValid () const |
TemporaryDirectory & | operator= (const TemporaryDirectory &tmpDir) |
This class creates an application-level temporary directory. It uses reference counting internally to ensure that when all TemporaryDirectory objects for a given prefix are deleted, the temporary directory is also deleted along with all its contents.
This class is thread-safe.
TemporaryDirectory | ( | const QString & | prefix | ) |
prefix | The prefix to use for the temporary directory. The final name of the temporary directory will be this prefix with some characters including the process id appended to it. |
The permissions of the temporary directory will be set to allow only the current user to read from or write to it.
TemporaryDirectory | ( | const TemporaryDirectory & | tmpDir | ) |
tmpDir | The object to copy. |
~TemporaryDirectory | ( | ) |
When no more TemporaryDirectory objects for the specified prefix exist, the destructor attempts to delete the temporary directory, including all of its contents.
QDir getDir | ( | ) | const |
QString getFilePath | ( | const QString & | fileName | ) | const |
fileName | The name of a file within the temporary directory. The file does not have to exist. |
This function is equivalent to calling getDir().filePath(fileName)
.
QString getPath | ( | ) | const |
getDir().path()
QString getPrefix | ( | ) | const |
bool isValid | ( | ) | const |
This function is equivalent to calling getDir().exists()
.
TemporaryDirectory & operator= | ( | const TemporaryDirectory & | tmpDir | ) |
tmpDir | The object to assign from. |