most rudimentary Buffer class imaginable
This commit is contained in:
parent
1636ee1728
commit
fdcba81a3d
19
src/core/Buffer.cc
Normal file
19
src/core/Buffer.cc
Normal 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
17
src/core/Buffer.h
Normal 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
|
Loading…
x
Reference in New Issue
Block a user