Lines Matching defs:data
69 QrSegment QrSegment::makeBytes(const vector<uint8_t> &data) {
70 if (data.size() > static_cast<unsigned int>(INT_MAX))
73 for (uint8_t b : data)
75 return QrSegment(Mode::BYTE, static_cast<int>(data.size()), std::move(bb));
164 data(dt) {
173 data(std::move(dt)) {
188 if (seg.data.size() > static_cast<unsigned int>(INT_MAX - result))
190 result += static_cast<int>(seg.data.size());
226 return data;
253 QrCode QrCode::encodeBinary(const vector<uint8_t> &data, Ecc ecl) {
254 vector<QrSegment> segs{QrSegment::makeBytes(data)};
267 int dataCapacityBits = getNumDataCodewords(version, ecl) * 8; // Number of data bits available
271 if (version >= maxVersion) { // All versions in the range could not fit the given data
284 // Increase the error correction level while the data still fits in the current version number
290 // Concatenate all segments to create the data bit string
306 // Pad with alternating bytes until data capacity is reached
410 // Draw configuration data
418 int data = getFormatBits(errorCorrectionLevel) << 3 | msk; // errCorrLvl is uint2, msk is uint3
419 int rem = data;
422 int bits = (data << 10 | rem) ^ 0x5412; // uint15
498 vector<uint8_t> QrCode::addEccAndInterleave(const vector<uint8_t> &data) const {
499 if (data.size() != static_cast<unsigned int>(getNumDataCodewords(version, errorCorrectionLevel)))
509 // Split data into blocks and append ECC to each block
513 vector<uint8_t> dat(data.cbegin() + k, data.cbegin() + (k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1)));
536 void QrCode::drawCodewords(const vector<uint8_t> &data) {
537 if (data.size() != static_cast<unsigned int>(getNumRawDataModules(version) / 8))
540 size_t i = 0; // Bit index into the data
550 if (!isFunction.at(y).at(x) && i < data.size() * 8) {
551 modules.at(y).at(x) = getBit(data.at(i >> 3), 7 - static_cast<int>(i & 7));
559 assert(i == data.size() * 8);
727 vector<uint8_t> QrCode::reedSolomonComputeRemainder(const vector<uint8_t> &data, const vector<uint8_t> &divisor) {
729 for (uint8_t b : data) { // Polynomial division