2011-09-23 16:31:57 +02:00
|
|
|
#ifndef register_manager_hh_INCLUDED
|
|
|
|
#define register_manager_hh_INCLUDED
|
|
|
|
|
2012-02-08 00:01:02 +01:00
|
|
|
#include "register.hh"
|
2011-09-23 16:31:57 +02:00
|
|
|
#include "utils.hh"
|
|
|
|
|
2012-02-10 00:47:55 +01:00
|
|
|
#include <unordered_map>
|
2012-06-29 18:37:17 +02:00
|
|
|
#include <vector>
|
|
|
|
#include <functional>
|
2012-02-10 00:47:55 +01:00
|
|
|
|
2011-09-23 16:31:57 +02:00
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
2014-01-09 20:50:01 +01:00
|
|
|
using RegisterRetriever = std::function<std::vector<String> (const Context&)>;
|
2012-06-29 18:37:17 +02:00
|
|
|
|
2011-09-23 16:31:57 +02:00
|
|
|
class RegisterManager : public Singleton<RegisterManager>
|
|
|
|
{
|
|
|
|
public:
|
2012-06-29 18:37:17 +02:00
|
|
|
Register& operator[](char reg);
|
|
|
|
void register_dynamic_register(char reg, RegisterRetriever function);
|
2011-09-23 16:31:57 +02:00
|
|
|
|
|
|
|
protected:
|
2012-06-29 18:37:17 +02:00
|
|
|
std::unordered_map<char, std::unique_ptr<Register>> m_registers;
|
2011-09-23 16:31:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // register_manager_hh_INCLUDED
|