the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2
3//A buffer is a linear, finite sequence of elements of a specific primitive type. Aside from its content,
4//the essential properties of a buffer are its capacity, limit, and position:
5//
6//A buffer's capacity is the number of elements it contains. The capacity of a buffer is never negative and never changes.
7//
8//A buffer's limit is the index of the first element that should not be read or written.
9//A buffer's limit is never negative and is never greater than its capacity.
10//
11//A buffer's position is the index of the next element to be read or written.
12//A buffer's position is never negative and is never greater than its limit.
13class Buffer
14{
15protected:
16 const unsigned int m_capacity;
17 unsigned int m_position;
18 unsigned int m_limit;
19 unsigned int m_mark;
20 bool hasBackingArray;
21
22public:
23 Buffer( unsigned int capacity );
24 virtual ~Buffer() {}
25
26 Buffer *clear();
27 Buffer *limit(unsigned int newLimit);
28 unsigned int limit();
29 Buffer *position( unsigned int newPosition );
30 unsigned int position();
31 unsigned int remaining();
32
33 virtual Buffer *flip() = 0;
34};