summaryrefslogtreecommitdiff
path: root/include/object/stdbuf.h
blob: 271c3ea4ab4e03a804ed385e2616321fb02233a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef STDBUF_H
#define STDBUF_H

#include "object/outputstream.h"

template <class T = OutputStream>
class BufferOutput : public T {
	private:
		BufferOutput(const BufferOutput &copy);
		char *buffer;
		uint16_t length;

	public:
		BufferOutput(char *target) : buffer(target), length(0) {}
		virtual void put(char c) {
			*buffer = c;
			buffer++;
			length++;
		}
		inline uint16_t size() {
			return length;
		}
};

#endif