* An appendable sequence of bits. Bits are packed in big endian within a byte. */
| 35 | * An appendable sequence of bits. Bits are packed in big endian within a byte. |
| 36 | */ |
| 37 | class BitBuffer { |
| 38 | |
| 39 | /*---- Fields ----*/ |
| 40 | private: |
| 41 | |
| 42 | std::vector<uint8_t> data; |
| 43 | int bitLength; |
| 44 | |
| 45 | |
| 46 | |
| 47 | /*---- Constructor ----*/ |
| 48 | public: |
| 49 | |
| 50 | // Creates an empty bit buffer (length 0). |
| 51 | BitBuffer(); |
| 52 | |
| 53 | |
| 54 | |
| 55 | /*---- Methods ----*/ |
| 56 | public: |
| 57 | |
| 58 | // Returns the number of bits in the buffer, which is a non-negative value. |
| 59 | int getBitLength() const; |
| 60 | |
| 61 | |
| 62 | // Returns a copy of all bytes, padding up to the nearest byte. |
| 63 | std::vector<uint8_t> getBytes() const; |
| 64 | |
| 65 | |
| 66 | // Appends the given number of bits of the given value to this sequence. |
| 67 | // If 0 <= len <= 31, then this requires 0 <= val < 2^len. |
| 68 | void appendBits(uint32_t val, int len); |
| 69 | |
| 70 | |
| 71 | // Appends the data of the given segment to this bit buffer. |
| 72 | void appendData(const QrSegment &seg); |
| 73 | |
| 74 | }; |
| 75 | |
| 76 | } |
nothing calls this directly
no outgoing calls
no test coverage detected