1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-11 04:34:27 +03:00
kakoune/src/buffer_manager.hh

46 lines
1.0 KiB
C++
Raw Normal View History

#ifndef buffer_manager_hh_INCLUDED
#define buffer_manager_hh_INCLUDED
#include "buffer.hh"
#include "completion.hh"
#include "utils.hh"
#include "safe_ptr.hh"
namespace Kakoune
{
class BufferManager : public Singleton<BufferManager>
{
public:
using BufferList = Vector<std::unique_ptr<Buffer>>;
2012-08-08 21:36:40 +04:00
using iterator = BufferList::const_iterator;
~BufferManager();
Buffer* create_buffer(String name, Buffer::Flags flags,
StringView data = {},
timespec fs_timestamp = InvalidTime);
void delete_buffer(Buffer& buffer);
2012-08-08 21:36:40 +04:00
iterator begin() const { return m_buffers.cbegin(); }
iterator end() const { return m_buffers.cend(); }
size_t count() const { return m_buffers.size(); }
2014-04-19 12:53:37 +04:00
Buffer* get_buffer_ifp(StringView name);
Buffer& get_buffer(StringView name);
Buffer& get_first_buffer();
void backup_modified_buffers();
void clear_buffer_trash();
private:
2012-08-08 21:36:40 +04:00
BufferList m_buffers;
BufferList m_buffer_trash;
};
}
#endif // buffer_manager_hh_INCLUDED