]> git.decadent.org.uk Git - videolink.git/blobdiff - temp_file.hpp
Replaced auto_temp_file with temp_file, which handles creation as well as deletion.
[videolink.git] / temp_file.hpp
diff --git a/temp_file.hpp b/temp_file.hpp
new file mode 100644 (file)
index 0000000..7402fe9
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright 2005 Ben Hutchings <ben@decadentplace.org.uk>.
+// See the file "COPYING" for licence details.
+
+#ifndef INC_TEMP_FILE_HPP
+#define INC_TEMP_FILE_HPP
+
+#include <string>
+
+class temp_file
+{
+public:
+    explicit temp_file(const std::string & base_name);
+    ~temp_file();
+
+    void close();
+
+    int get_fd() const { return fd_; }
+    const std::string & get_name() const { return name_; }
+
+private:
+    int fd_;
+    std::string name_;
+};
+
+#endif // !INC_TEMP_FILE_HPP