aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/BitStream.hh
blob: bdbf2645b4ff461158b16fe7e7f72a62b0ce0a02 (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
27
28
29
30
31
// Read bits from a bit stream.  See BitWriter for writing.

#ifndef BITSTREAM_HH
#define BITSTREAM_HH

#include <qpdf/DLL.h>

class BitStream
{
  public:
    QPDF_DLL
    BitStream(unsigned char const* p, int nbytes);
    QPDF_DLL
    void reset();
    QPDF_DLL
    unsigned long long getBits(int nbits);
    QPDF_DLL
    long long getBitsSigned(int nbits);
    QPDF_DLL
    void skipToNextByte();

  private:
    unsigned char const* start;
    int nbytes;

    unsigned char const* p;
    unsigned int bit_offset;
    unsigned int bits_available;
};

#endif // BITSTREAM_HH