2008-04-29 12:55:25 +00:00
|
|
|
// Write bits into a bit stream. See BitStream for reading.
|
|
|
|
|
2009-04-25 01:39:17 +00:00
|
|
|
#ifndef __BITWRITER_HH__
|
|
|
|
#define __BITWRITER_HH__
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2009-10-19 20:17:14 +00:00
|
|
|
#include <qpdf/DLL.h>
|
2009-09-26 15:19:12 +00:00
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
class Pipeline;
|
|
|
|
|
2009-10-21 00:27:24 +00:00
|
|
|
class BitWriter
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Write bits to the pipeline. It is the caller's responsibility
|
|
|
|
// to eventually call finish on the pipeline.
|
2009-10-21 01:45:13 +00:00
|
|
|
QPDF_DLL
|
2008-04-29 12:55:25 +00:00
|
|
|
BitWriter(Pipeline* pl);
|
2009-10-21 01:45:13 +00:00
|
|
|
QPDF_DLL
|
2012-06-24 19:26:28 +00:00
|
|
|
void writeBits(unsigned long long val, unsigned int bits);
|
2008-04-29 12:55:25 +00:00
|
|
|
// Force any partial byte to be written to the pipeline.
|
2009-10-21 01:45:13 +00:00
|
|
|
QPDF_DLL
|
2008-04-29 12:55:25 +00:00
|
|
|
void flush();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Pipeline* pl;
|
|
|
|
unsigned char ch;
|
|
|
|
unsigned int bit_offset;
|
|
|
|
};
|
|
|
|
|
2009-04-25 01:39:17 +00:00
|
|
|
#endif // __BITWRITER_HH__
|