#ifndef BUFFER_H
#define BUFFER_H

#include <list>
#include <memory>
#include "LineEndings.h"
#include "Encoding.h"
#include "GapBuffer.h"

class Buffer
{
public:
    Buffer(const char * filename = nullptr);
    bool write_to_file(const char * filename);
    auto add_cursor() { return m_gap_buffer->add_cursor(); }

protected:
    bool m_eol_at_eof;
    LineEndings::Type m_line_endings;
    std::shared_ptr<GapBuffer> m_gap_buffer;

    bool load_from_file(const char * filename);
    void load_empty_buffer();
};

#endif
