jes/src/core/Buffer.h

35 lines
803 B
C++

#ifndef BUFFER_H
#define BUFFER_H
#include <list>
#include <memory>
#include "Text.h"
#include "FileLoader.h"
class Buffer
{
public:
bool load_from_file(const char * filename);
typedef std::shared_ptr<Text> LineType;
typedef std::list<LineType> LinesType;
auto begin() { return m_lines.begin(); }
auto end() { return m_lines.end(); }
auto cbegin() const { return m_lines.cbegin(); }
auto cend() const { return m_lines.cend(); }
auto rbegin() { return m_lines.rbegin(); }
auto rend() { return m_lines.rend(); }
auto crbegin() const { return m_lines.crbegin(); }
auto crend() const { return m_lines.crend(); }
int get_num_lines() { return m_lines.size(); }
protected:
LinesType m_lines;
/* TODO: delete this */
FileLoader m_fl;
};
#endif