blob: 3e669d980e45e78310a95a91ea6b2e8b21a24704 (
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
26
27
28
29
30
|
/*
* Copyright 2020 Daniel Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#ifndef STDBUF_H
#define STDBUF_H
#include "object/outputstream.h"
template <class T = OutputStream>
class BufferOutput : public T {
private:
BufferOutput(const BufferOutput ©);
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
|