1
1
mirror of https://github.com/mawww/kakoune.git synced 2025-01-04 17:58:31 +03:00
kakoune/src/buffer_manager.hh
Maxime Coste 535e200587 Add a BufferManager singleton class, handling buffer lifetime
it also provide access to buffers by name
2011-09-08 00:11:48 +00:00

33 lines
581 B
C++

#ifndef buffer_manager_hh_INCLUDED
#define buffer_manager_hh_INCLUDED
#include "buffer.hh"
#include <unordered_map>
#include <memory>
namespace Kakoune
{
class BufferManager
{
public:
void register_buffer(Buffer* buffer);
void delete_buffer(Buffer* buffer);
Buffer* get_buffer(const std::string& name);
static BufferManager& instance();
static void delete_instance();
private:
BufferManager();
static BufferManager* ms_instance;
std::unordered_map<std::string, std::unique_ptr<Buffer>> m_buffers;
};
}
#endif // buffer_manager_hh_INCLUDED