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

Method QrCode

Libraries/QRCode/tests/QrCode.cpp:109–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107
108
109qrcodegen::QrCode::QrCode(int ver, const Ecc &ecl, const std::vector<uint8_t> &dataCodewords, int mask) :
110 // Initialize scalar fields
111 version(ver),
112 size(1 <= ver && ver <= 40 ? ver * 4 + 17 : -1), // Avoid signed overflow undefined behavior
113 errorCorrectionLevel(ecl) {
114
115 // Check arguments
116 if (ver < 1 || ver > 40 || mask < -1 || mask > 7)
117 throw "Value out of range";
118
119 std::vector<bool> row(size);
120 for (int i = 0; i < size; i++) {
121 modules.push_back(row);
122 isFunction.push_back(row);
123 }
124
125 // Draw function patterns, draw all codewords, do masking
126 drawFunctionPatterns();
127 const std::vector<uint8_t> allCodewords(appendErrorCorrection(dataCodewords));
128 drawCodewords(allCodewords);
129 this->mask = handleConstructorMasking(mask);
130}
131
132
133qrcodegen::QrCode::QrCode(const QrCode &qr, int mask) :

Callers

nothing calls this directly

Calls 3

drawFunctionPatternsFunction · 0.85
drawCodewordsFunction · 0.85
applyMaskFunction · 0.85

Tested by

no test coverage detected