stuff-from-scratch/src/core/streams/OutputBitStream.h
2022-11-28 10:16:04 +00:00

24 lines
545 B
C++

#pragma once
#include "BitStream.h"
#include <ostream>
class OutputBitStream : public BitStream
{
public:
OutputBitStream(std::basic_ostream<char>* stream);
bool isFinished() const override;
std::vector<unsigned char> peekNextNBytes(unsigned n) const override;
std::optional<unsigned char> readNextByte() override;
void writeByte(unsigned char data, bool checkOverflow = true) override;
void writeBytes(const std::vector<unsigned char> data) override;
private:
std::basic_ostream<char>* mStream{nullptr};
};