MCPcopy Create free account
hub / github.com/devilsen/CZXing / ParseStructuredAppend

Function ParseStructuredAppend

czxing/src/main/cpp/zxing/src/aztec/AZDecoder.cpp:223–250  ·  view source on GitHub ↗

* See ISO/IEC 24778:2008 Section 8 */

Source from the content-addressed store, hash-verified

221* See ISO/IEC 24778:2008 Section 8
222*/
223static StructuredAppendInfo ParseStructuredAppend(ByteArray& bytes)
224{
225 std::string text(bytes.begin(), bytes.end());
226 StructuredAppendInfo sai;
227 std::string::size_type i = 0;
228
229 if (text[0] == ' ') { // Space-delimited id
230 std::string::size_type sp = text.find(' ', 1);
231 if (sp == std::string::npos)
232 return {};
233
234 sai.id = text.substr(1, sp - 1); // Strip space delimiters
235 i = sp + 1;
236 }
237 if (i + 1 >= text.size() || !std::isupper(text[i]) || !std::isupper(text[i + 1]))
238 return {};
239
240 sai.index = text[i] - 'A';
241 sai.count = text[i + 1] - 'A' + 1;
242
243 if (sai.count == 1 || sai.count <= sai.index) // If info doesn't make sense
244 sai.count = 0; // Choose to mark count as unknown
245
246 text.erase(0, i + 2); // Remove
247 bytes = ByteArray(text);
248
249 return sai;
250}
251
252static void DecodeContent(const BitArray& bits, Content& res)
253{

Callers 1

DecoderResult DecodeFunction · 0.70

Calls 6

findMethod · 0.80
ByteArrayClass · 0.50
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected