1 #include <buffered_writer.h>
5 buffered_writer::buffered_writer(writer & wter, size_t cap): m_w(wter), m_buf(nullptr), m_pos(0), m_capacity(cap) {
7 m_buf = new char[m_capacity];
11 buffered_writer::~buffered_writer() {
15 m_pos = m_capacity = 0;
19 void buffered_writer::expand(size_t n) {
22 char *tmp_buf = new char[n];
23 memcpy(tmp_buf, this->m_buf, this->size());
25 this->m_buf = tmp_buf;