| Home · Modules · Classes · Namespaces · Functions |
The QxtTemporaryDir class manages temporary directories. More...
#include <QxtTemporaryDir>
The QxtTemporaryDir class manages temporary directories.
QxtTemporaryDir is used to create unique temporary directories. The directory itself is created when calling dir() or path(). The name of the temporary directory is guaranteed to be unique (i.e., you are guaranteed to not overwrite an existing directory), and the directory will subsequently be removed upon destruction of the QxtTemporaryDir object. This is an important technique that avoids data corruption for applications that store data in temporary directories. The directory name is based on a template, which can be passed to QxtTemporaryDir's constructor.
A temporary directory will have some static part of the name and some part that is calculated to be unique. The default directory template "qxt" will be placed into the temporary path as returned by QDir::tempPath(). If you specify your own directory template a relative file path will not be placed in the temporary directory by default, but be relative to the current working directory.
See also QDir::tempPath() and QTemporaryFile.
Constructs a new QxtTemporaryDir in QDir::tempPath(), using the default dir template ("qxt").
See also setDirTemplate() and QDir::tempPath().
Constructs a new QxtTemporaryDir with dirTemplate.
If dirTemplate is a relative path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct dirTemplate if you want use the system's temporary directory.
See also dirTemplate() and QDir::tempPath().
Destructs the temporary dir. The temporary dir is automatically removed if in auto remove mode.
See also autoRemove().
Returns true if the QxtTemporaryDir is in auto remove mode. Auto-remove mode will automatically remove the directory from disk upon destruction. This makes it very easy to create QxtTemporaryDir object on the stack, fill it with data, read from it, and finally on function return it will automatically clean up after itself.
Auto-remove is on by default.
See also setAutoRemove() and remove().
Returns a QDir object pointing to the temporary directory.
See also path().
Returns the directory template. The default directory template is called "qxt" and be placed in QDir::tempPath().
See also setDirTemplate().
Returns a human-readable description of the last device error that occurred.
Returns path to the temporary directory.
See also dir().
Removes the temporary directory from disk. Returns true if removal succeed, false otherwise.
Sets the QxtTemporaryDir into auto-remove mode if autoRemove is true.
Auto-remove is on by default.
See also autoRemove() and remove().
Sets the static portion of the dir name to dirTemplate.
If name contains a relative file path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct name if you want use the system's temporary directory.
See also dirTemplate().
| Copyright © 2007-2010 Qxt Foundation |
Qxt 0.7.0 |