diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-09-24 16:33:53 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-09-24 16:33:53 +0200 |
commit | af0e76deef42154fd9914aceb31e5ca80465410e (patch) | |
tree | ed5bcb54648c6d382abbaf8cfcc404e307b3f11a | |
parent | 90664ba8e173044e01fb965a24c4f09dface775a (diff) |
Add memory buffer (drop-in replacement for kout/stdout)
-rw-r--r-- | include/object/stdbuf.h | 20 |
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 ©); + char *buffer; + + public: + BufferOutput(char *target) { buffer = target; } + virtual void put(char c) { + *buffer = c; + buffer++; + } +}; + +#endif |