mirror of https://github.com/SeanOMik/libki.git
util: Add a postfix increment operator to BitStream::stream_pos
This commit is contained in:
parent
48dde6abe8
commit
c9f99e1f1a
|
@ -7,11 +7,10 @@
|
|||
namespace ki
|
||||
{
|
||||
/**
|
||||
*
|
||||
* A readable/writeable stream of bits.
|
||||
*/
|
||||
class BitStream
|
||||
{
|
||||
|
||||
public:
|
||||
/**
|
||||
* Represents a position in a BitStream's buffer.
|
||||
|
@ -34,6 +33,8 @@ namespace ki
|
|||
stream_pos &operator -=(int bits);
|
||||
stream_pos &operator ++();
|
||||
stream_pos &operator --();
|
||||
stream_pos operator ++(int increment);
|
||||
stream_pos operator --(int increment);
|
||||
|
||||
private:
|
||||
intmax_t m_byte;
|
||||
|
|
|
@ -118,6 +118,20 @@ namespace ki
|
|||
return *this;
|
||||
}
|
||||
|
||||
BitStream::stream_pos BitStream::stream_pos::operator++(int increment)
|
||||
{
|
||||
auto copy(*this);
|
||||
++(*this);
|
||||
return copy;
|
||||
}
|
||||
|
||||
BitStream::stream_pos BitStream::stream_pos::operator--(int increment)
|
||||
{
|
||||
auto copy(*this);
|
||||
--(*this);
|
||||
return copy;
|
||||
}
|
||||
|
||||
BitStream::BitStream(const size_t buffer_size)
|
||||
{
|
||||
m_buffer = new uint8_t[buffer_size] { 0 };
|
||||
|
|
Loading…
Reference in New Issue