move Client::Mode class definition in client.cc

This commit is contained in:
Maxime Coste 2012-09-24 14:03:04 +02:00
parent b3c4912404
commit 0380c999c3
2 changed files with 19 additions and 13 deletions

View File

@ -10,6 +10,19 @@ namespace Kakoune
extern std::unordered_map<Key, std::function<void (Context& context)>> keymap;
class Client::Mode
{
public:
Mode(Client& client) : m_client(client) {}
virtual ~Mode() {}
Mode(const Mode&) = delete;
Mode& operator=(const Mode&) = delete;
virtual void on_key(const Key& key, Context& context) = 0;
protected:
Client& m_client;
};
class Client::NormalMode : public Client::Mode
{
public:
@ -374,6 +387,10 @@ Client::Client()
{
}
Client::~Client()
{
}
void Client::insert(Editor& editor, IncrementalInserter::Mode mode)
{
m_mode.reset(new InsertMode(*this, editor, mode));

View File

@ -22,7 +22,7 @@ class Client : public SafeCountable
{
public:
Client();
virtual ~Client() {}
virtual ~Client();
virtual void draw_window(Window& window) = 0;
virtual void print_status(const String& status,
CharCount cursor_pos = -1) = 0;
@ -49,18 +49,7 @@ private:
void reset_normal_mode();
std::pair<IncrementalInserter::Mode, std::vector<Key>> m_last_insert;
class Mode
{
public:
Mode(Client& client) : m_client(client) {}
virtual ~Mode() {}
Mode(const Mode&) = delete;
Mode& operator=(const Mode&) = delete;
virtual void on_key(const Key& key, Context& context) = 0;
protected:
Client& m_client;
};
class Mode;
std::unique_ptr<Mode> m_mode;
class NormalMode;