aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/BitWriter.hh
blob: 9e99123b13a0897f2a72562a65c3f5d2bfd37263 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Write bits into a bit stream.  See BitStream for reading.

#ifndef __BITWRITER_HH__
#define __BITWRITER_HH__

#include <qpdf/DLL.hh>

class Pipeline;

class DLL_EXPORT 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 val, int bits);
    // Force any partial byte to be written to the pipeline.
    void flush();

  private:
    Pipeline* pl;
    unsigned char ch;
    unsigned int bit_offset;
};

#endif // __BITWRITER_HH__