MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / BitBuffer

Class BitBuffer

Libraries/QRCode/tests/BitBuffer.hpp:37–74  ·  view source on GitHub ↗

* An appendable sequence of bits. Bits are packed in big endian within a byte. */

Source from the content-addressed store, hash-verified

35 * An appendable sequence of bits. Bits are packed in big endian within a byte.
36 */
37class BitBuffer {
38
39 /*---- Fields ----*/
40private:
41
42 std::vector<uint8_t> data;
43 int bitLength;
44
45
46
47 /*---- Constructor ----*/
48public:
49
50 // Creates an empty bit buffer (length 0).
51 BitBuffer();
52
53
54
55 /*---- Methods ----*/
56public:
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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected