4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
23 * Class for safely creating temporary files without race conditions.
24 * The file is created in the constructor, and deleted in the destructor.
25 * You may do anything with the file (including deletion), but the instance
26 * of this class must stay alive as long as the file is needed.
30 TempFile(TempFile const &);
32 TempFile & operator=(TempFile const &);
35 *Create a temporary file with the given mask.
36 * \p mask must be in filesystem encoding, if it contains a
37 * relative path, the template file will be created in the global
38 * temporary directory as given by 'package().temp_dir()'.
39 * If the mask contains "XXXXXX" this portion will be replaced by
40 * a uniquely generated string. If it does not contain this portion,
41 * it will be automatically appended using a dot. Therefore, please
42 * specify the "XXXXXX" portion if the extension of the generated
43 * name is important (e.g. for the converter machinery).
45 TempFile(std::string const & mask);
46 TempFile(FileName const & temp_dir, std::string const & mask);
49 * Get the name of the temporary file.
50 * This is empty if the file could not be created.
52 FileName name() const;
54 * Set whether the file should be automatically deleted in the
56 * Automatic deletion is the default, but it can be switched off if
57 * the file should be kept, because it should be renamed afterwards.
59 void setAutoRemove(bool autoremove);
66 } // namespace support