2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-01 01:40:51 +00:00
qpdf/libqpdf/qpdf/BitWriter.hh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
656 B
C++
Raw Permalink Normal View History

// Write bits into a bit stream. See BitStream for reading.
#ifndef BITWRITER_HH
#define BITWRITER_HH
2023-05-20 11:22:32 +00:00
#include <cstddef>
class Pipeline;
class BitWriter
{
public:
// Write bits to the pipeline. It is the caller's responsibility to eventually call finish on
// the pipeline.
BitWriter(Pipeline* pl);
void writeBits(unsigned long long val, size_t bits);
void writeBitsSigned(long long val, size_t bits);
void writeBitsInt(int val, size_t bits);
// Force any partial byte to be written to the pipeline.
void flush();
private:
Pipeline* pl;
unsigned char ch;
size_t bit_offset;
};
#endif // BITWRITER_HH