* QR codes encode mode indicators and terminator codes into a constant bit length of 4. * Micro QR codes have terminator codes that vary in bit length but are always longer than * the mode indicators. * M1 - 0 length mode code, 3 bits terminator code * M2 - 1 bit mode code, 5 bits terminator code * M3 - 2 bit mode code, 7 bits terminator code * M4 - 3 bit mode code, 9 bits terminator code *
| 215 | * @param version the QR or micro QR code version |
| 216 | */ |
| 217 | bool IsEndOfStream(const BitSource& bits, const Version& version) |
| 218 | { |
| 219 | const int bitsRequired = TerminatorBitsLength(version); |
| 220 | const int bitsAvailable = std::min(bits.available(), bitsRequired); |
| 221 | return bitsAvailable == 0 || bits.peakBits(bitsAvailable) == 0; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * <p>QR Codes can encode text as bits in one of several modes, and can use multiple modes |
no test coverage detected