Newer
Older
#include "slc.hh"
#include "history.hh"
History::History(size_t size) : size_(size) {}
History::~History() {
// save into file;
}
void History::add(const string &line) {
if (table_.size() + 1 > size_)
table_.erase(table_.begin());
table_.push_back(line);
++size_;
}
const string &History::get(size_t off) const {
assert(table_.size() > 0);
assert(off < table_.size());
return table_[table_.size() - 1 - off];
}
const string &History::get() const {
return table_.back();
}
size_t History::size() const {
return table_.size();
}