most rudimentary Buffer class imaginable

This commit is contained in:
Josh Holtrop 2016-06-29 20:54:08 -04:00
parent 1636ee1728
commit fdcba81a3d
2 changed files with 36 additions and 0 deletions

19
src/core/Buffer.cc Normal file
View File

@ -0,0 +1,19 @@
#include "Buffer.h"
#include "FileLoader.h"
bool Buffer::load_from_file(const char * filename)
{
FileLoader fl;
if (!fl.load(filename))
{
return false;
}
for (size_t i = 0, num_lines = fl.num_lines(); i < num_lines; i++)
{
m_lines.push_back(fl.get_line(i));
}
return true;
}

17
src/core/Buffer.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef BUFFER_H
#define BUFFER_H
#include <list>
#include <memory>
#include "Text.h"
class Buffer
{
public:
bool load_from_file(const char * filename);
protected:
std::list<std::shared_ptr<Text>> m_lines;
};
#endif