10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
SimpleBuffer.h
1#ifndef TENDUKE_UTL_SIMPLEBUFFER_H
2#define TENDUKE_UTL_SIMPLEBUFFER_H
3
4#include "./BinaryData.h"
5#include "./DataSink.h"
6
7namespace tenduke { namespace utl {
8
9
16class SimpleBuffer : public BinaryData, public virtual DataSink
17{
18public:
19 SimpleBuffer();
20 ~SimpleBuffer() override;
21
22 SimpleBuffer(const SimpleBuffer &) = delete;
23 SimpleBuffer &operator=(const SimpleBuffer &) = delete;
24
32 void append(const std::uint8_t *newData, size_t newDataLength) override;
33
38 void append(const ::tenduke::utl::DataSpan &data) override;
39
40 void append(std::uint8_t byte) override;
41
42 // tenduke::utl::BinaryData interface
43 unsigned char * getData() const override {return data_;}
44 std::size_t getLength() const override {return length_;}
45
46private:
47 unsigned char * data_;
48 std::size_t length_;
49 std::size_t capacity_;
50};
51
52
53}}
54
55#endif // TENDUKE_UTL_SIMPLEBUFFER_H
A sink to which binary data can be appended.
Definition DataSink.h:14
A holder of binary data.
Definition BinaryData.h:14
unsigned char * data() override
Returns a mutable view of the underlying data.
Definition BinaryData.h:28
unsigned char * getData() const override
Returns the data.
Definition SimpleBuffer.h:43
std::size_t getLength() const override
Returns the length of data in bytes.
Definition SimpleBuffer.h:44
void append(const std::uint8_t *newData, size_t newDataLength) override
Appends data to the buffer.
Utilities.
Definition Base64Decoder.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4