summaryrefslogtreecommitdiff
path: root/include/object/stdbuf.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/object/stdbuf.h')
-rw-r--r--include/object/stdbuf.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/object/stdbuf.h b/include/object/stdbuf.h
new file mode 100644
index 0000000..db30621
--- /dev/null
+++ b/include/object/stdbuf.h
@@ -0,0 +1,20 @@
+#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;
+
+ public:
+ BufferOutput(char *target) { buffer = target; }
+ virtual void put(char c) {
+ *buffer = c;
+ buffer++;
+ }
+};
+
+#endif