Skip to content

Commit

Permalink
Merge pull request zxing-cpp#845 from kurzdigital/add_qr_data_mask_in…
Browse files Browse the repository at this point in the history
…_result

QRCode: add QR data mask type to DecoderResult
  • Loading branch information
axxel authored Oct 10, 2024
2 parents 8a9111b + 8ca3d5e commit e9475f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/src/DecoderResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DecoderResult
std::string _ecLevel;
int _lineCount = 0;
int _versionNumber = 0;
int _dataMask = 0;
StructuredAppendInfo _structuredAppend;
bool _isMirrored = false;
bool _readerInit = false;
Expand Down Expand Up @@ -71,6 +72,7 @@ class DecoderResult
ZX_PROPERTY(std::string, ecLevel, setEcLevel)
ZX_PROPERTY(int, lineCount, setLineCount)
ZX_PROPERTY(int, versionNumber, setVersionNumber)
ZX_PROPERTY(int, dataMask, setDataMask)
ZX_PROPERTY(StructuredAppendInfo, structuredAppend, setStructuredAppend)
ZX_PROPERTY(Error, error, setError)
ZX_PROPERTY(bool, isMirrored, setIsMirrored)
Expand Down
4 changes: 3 additions & 1 deletion core/src/qrcode/QRDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ DecoderResult Decode(const BitMatrix& bits)
}

// Decode the contents of that stream of bytes
auto ret = DecodeBitStream(std::move(resultBytes), version, formatInfo.ecLevel).setIsMirrored(formatInfo.isMirrored);
auto ret = DecodeBitStream(std::move(resultBytes), version, formatInfo.ecLevel)
.setDataMask(formatInfo.mask)
.setIsMirrored(formatInfo.isMirrored);
if (error)
ret.setError(error);
return ret;
Expand Down

0 comments on commit e9475f2

Please sign in to comment.