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
|
|
|
|
2014-02-25 02:11:36 +02:00
|
|
|
namespace recentfiles
|
|
|
|
{
|
|
|
|
class path
|
2013-09-22 17:39:52 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-02-25 02:11:36 +02:00
|
|
|
path();
|
|
|
|
path(const std::string& p);
|
2013-09-22 17:39:52 +03:00
|
|
|
std::string serialize() const;
|
2014-02-25 02:11:36 +02:00
|
|
|
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;
|
2014-02-25 02:11:36 +02:00
|
|
|
bool operator==(const path& p) const;
|
2013-09-22 17:39:52 +03:00
|
|
|
private:
|
2014-02-25 02:11:36 +02:00
|
|
|
std::string pth;
|
2013-09-22 17:39:52 +03:00
|
|
|
};
|
|
|
|
|
2014-02-25 02:11:36 +02:00
|
|
|
class multirom
|
2013-09-22 17:39:52 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-02-25 02:11:36 +02:00
|
|
|
multirom();
|
2013-09-22 17:39:52 +03:00
|
|
|
std::string serialize() const;
|
2014-02-25 02:11:36 +02:00
|
|
|
static multirom deserialize(const std::string& s);
|
2013-09-22 17:39:52 +03:00
|
|
|
bool check() const;
|
|
|
|
std::string display() const;
|
2014-02-25 02:11:36 +02:00
|
|
|
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:11:36 +02:00
|
|
|
struct hook
|
2013-09-22 17:39:52 +03:00
|
|
|
{
|
2014-02-25 02:11:36 +02:00
|
|
|
virtual ~hook();
|
2013-09-22 17:39:52 +03:00
|
|
|
virtual void operator()() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
2014-02-25 02:11:36 +02:00
|
|
|
class set
|
2012-09-25 23:05:57 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-02-25 02:11:36 +02:00
|
|
|
set(const std::string& cfgfile, size_t maxcount) __attribute__((noinline));
|
2013-09-22 17:39:52 +03:00
|
|
|
void add(const T& file);
|
2014-02-25 02:11:36 +02:00
|
|
|
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;
|
2014-02-25 02:11:36 +02:00
|
|
|
std::list<hook*> hooks;
|
2012-09-25 23:05:57 +03:00
|
|
|
};
|
2014-02-25 02:11:36 +02:00
|
|
|
}
|
2012-09-25 23:05:57 +03:00
|
|
|
#endif
|