]> git.decadent.org.uk Git - videolink.git/blob - temp_file.hpp
e1d942efa0ecbd06b308f760af3394bc9c8abb94
[videolink.git] / temp_file.hpp
1 // Copyright 2005-6 Ben Hutchings <ben@decadentplace.org.uk>.
2 // See the file "COPYING" for licence details.
3
4 #ifndef INC_TEMP_FILE_HPP
5 #define INC_TEMP_FILE_HPP
6
7 #include <string>
8
9 class temp_file
10 {
11 public:
12     explicit temp_file(const std::string & base_name);
13     ~temp_file();
14
15     void close();
16
17     int get_fd() const { return fd_; }
18     const std::string & get_name() const { return name_; }
19
20     static void keep_all(bool keep);
21
22 private:
23     int fd_;
24     std::string name_;
25
26     static bool keep_;
27 };
28
29 #endif // !INC_TEMP_FILE_HPP