Fixed the crash/Keep Alive issue, I think
[theodwalha.git] / theodwalha / temporary.hpp
bloba65350ff5b44f11046359c846568ab160862636f
1 #pragma once
3 #include <string>
4 #include <set>
5 #include <ail/types.hpp>
6 #include <boost/thread/mutex.hpp>
8 struct temporary_file_entry
10 std::string name;
11 ulong timestamp;
13 temporary_file_entry(std::string const & name);
14 bool operator<(temporary_file_entry const & other) const;
15 bool operator==(temporary_file_entry const & other) const;
18 class temporary_file_manager
20 public:
21 temporary_file_manager(std::string const & directory);
22 bool initialise();
23 std::string generate_name();
24 void release(std::string const & path);
26 private:
27 std::string directory;
28 std::set<temporary_file_entry> files;
29 boost::mutex mutex;
31 bool clean();
32 bool clean_all();