lsnes/include/library/recentfiles.hpp

81 lines
1.5 KiB
C++
Raw Normal View History

2012-11-13 22:01:12 +02:00
#ifndef _library__recentfiles__hpp__included__
#define _library__recentfiles__hpp__included__
2012-09-25 23:05:57 +03:00
#include <string>
#include <cstdlib>
#include <list>
2013-09-22 17:39:52 +03:00
#include <vector>
2012-09-25 23:05:57 +03:00
namespace recentfiles
{
class path
2013-09-22 17:39:52 +03:00
{
public:
path();
path(const std::string& p);
2013-09-22 17:39:52 +03:00
std::string serialize() const;
static path deserialize(const std::string& s);
2013-09-22 17:39:52 +03:00
bool check() const;
std::string display() const;
std::string get_path() const;
bool operator==(const path& p) const;
2013-09-22 17:39:52 +03:00
private:
std::string pth;
2013-09-22 17:39:52 +03:00
};
class multirom
2013-09-22 17:39:52 +03:00
{
public:
multirom();
2013-09-22 17:39:52 +03:00
std::string serialize() const;
static multirom deserialize(const std::string& s);
2013-09-22 17:39:52 +03:00
bool check() const;
std::string display() const;
bool operator==(const multirom& p) const;
2013-09-22 17:39:52 +03:00
std::string packfile;
std::string singlefile;
std::string core;
std::string system;
std::string region;
std::vector<std::string> files;
};
2014-02-25 02:21:22 +02:00
class namedobj
{
public:
namedobj();
std::string serialize() const;
static namedobj deserialize(const std::string& s);
bool check() const;
std::string display() const;
bool operator==(const namedobj& p) const;
std::string _id;
std::string _filename;
std::string _display;
};
struct hook
2013-09-22 17:39:52 +03:00
{
virtual ~hook();
2013-09-22 17:39:52 +03:00
virtual void operator()() = 0;
};
template<class T>
class set
2012-09-25 23:05:57 +03:00
{
public:
set(const std::string& cfgfile, size_t maxcount) __attribute__((noinline));
2013-09-22 17:39:52 +03:00
void add(const T& file);
void add_hook(hook& h);
void remove_hook(hook& h);
2013-09-22 17:39:52 +03:00
std::list<T> get();
2012-09-25 23:05:57 +03:00
private:
std::string cfgfile;
size_t maxcount;
std::list<hook*> hooks;
2012-09-25 23:05:57 +03:00
};
}
2012-09-25 23:05:57 +03:00
#endif