blob: 5390ebb44b67fbfe5363d060da61c5e1fe413af8 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include "Base.h"
namespace cru {
class Buffer {
public:
explicit Buffer(Index size);
Buffer(const Buffer& other);
Buffer(Buffer&& other) noexcept;
Buffer& operator=(const Buffer& other);
Buffer& operator=(Buffer&& other) noexcept;
~Buffer();
private:
Index GetSize() const;
Index GetUsedSize() const;
bool IsFull() const { return GetSize() == GetUsedSize(); }
bool IsNotFull() const { return !IsFull(); }
std::byte& GetAt(Index index);
std::byte GetAt(Index index) const;
Index PushEnd(std::byte* other, Index other_size);
Index PopEnd(Index size);
std::byte* Data();
const std::byte* Data() const;
operator std::byte*() { return Data(); }
operator const std::byte*() const { return Data(); }
private:
std::byte* ptr_;
Index size_;
Index used_size_;
};
void swap(Buffer& left, Buffer& right);
class BufferList {
public:
explicit BufferList(Index buffer_size);
private:
};
} // namespace cru
|