Save bitmaps as PNG
[lsnes.git] / include / library / recentfiles.hpp
blob705e53285f9c7eba0a215a880cc609a20ee4a941
1 #ifndef _library__recentfiles__hpp__included__
2 #define _library__recentfiles__hpp__included__
4 #include <string>
5 #include <cstdlib>
6 #include <list>
7 #include <vector>
9 class recentfile_path
11 public:
12 recentfile_path();
13 recentfile_path(const std::string& p);
14 std::string serialize() const;
15 static recentfile_path deserialize(const std::string& s);
16 bool check() const;
17 std::string display() const;
18 std::string get_path() const;
19 bool operator==(const recentfile_path& p) const;
20 private:
21 std::string path;
24 class recentfile_multirom
26 public:
27 recentfile_multirom();
28 std::string serialize() const;
29 static recentfile_multirom deserialize(const std::string& s);
30 bool check() const;
31 std::string display() const;
32 bool operator==(const recentfile_multirom& p) const;
34 std::string packfile;
35 std::string singlefile;
36 std::string core;
37 std::string system;
38 std::string region;
39 std::vector<std::string> files;
42 struct recent_files_hook
44 virtual ~recent_files_hook();
45 virtual void operator()() = 0;
48 template<class T>
49 class recent_files
51 public:
52 recent_files(const std::string& cfgfile, size_t maxcount) __attribute__((noinline));
53 void add(const T& file);
54 void add_hook(recent_files_hook& h);
55 void remove_hook(recent_files_hook& h);
56 std::list<T> get();
57 private:
58 std::string cfgfile;
59 size_t maxcount;
60 std::list<recent_files_hook*> hooks;
63 #endif