kge/Frame.cc

65 lines
1.0 KiB
C++

//
// Created by kyle on 10/14/23.
//
#include "Frame.h"
void
Frame::Add()
{
auto buffer = new Buffer;
this->bmap[buffer->Name()] = buffer;
if (this->bmap.size() == 1) {
this->activeBuffer = buffer->Name();
}
}
void
Frame::Add(std::string name)
{
auto buffer = new Buffer(name);
// TODO: find the small buffer name that doesn't conflict with
// any other buffers. Idea: deconflict private method?
this->bmap[buffer->Name()] = buffer;
if (this->bmap.size() == 1) {
this->activeBuffer = buffer->Name();
}
}
void
Frame::Add(std::filesystem::path path)
{
auto buffer = new Buffer(path);
// TODO: find the small buffer name that doesn't conflict with
// any other buffers. Idea: deconflict private method?
this->bmap[buffer->Name()] = buffer;
if (this->bmap.size() == 1) {
this->activeBuffer = buffer->Name();
}
}
Buffer::FileStatus
Frame::Refresh()
{
return this->bmap[this->activeBuffer]->Refresh();
}
Buffer::FileStatus
Frame::Flush()
{
return this->bmap[this->activeBuffer]->Flush();
}