Rearranged QrCode constructor parameters in JavaScript/TypeScript/Python code to match order in Java/C++/Rust.
This commit is contained in:
parent
ae7b5296f2
commit
fd64af3e50
|
@ -32,7 +32,7 @@
|
|||
* - Function encodeSegments(list<QrSegment> segs, QrCode.Ecc ecl,
|
||||
* int minVersion=1, int maxVersion=40, mask=-1, boostEcl=true) -> QrCode
|
||||
* - Constants int MIN_VERSION, MAX_VERSION
|
||||
* - Constructor QrCode(list<int> dataCodewords, int mask, int version, QrCode.Ecc ecl)
|
||||
* - Constructor QrCode(int version, QrCode.Ecc ecl, list<int> dataCodewords, int mask)
|
||||
* - Fields int version, size, mask
|
||||
* - Field QrCode.Ecc errorCorrectionLevel
|
||||
* - Method getModule(int x, int y) -> bool
|
||||
|
@ -68,7 +68,7 @@ var qrcodegen = new function() {
|
|||
* and mask number. mask = -1 is for automatic choice, or 0 to 7 for fixed choice. This is a cumbersome low-level constructor
|
||||
* that should not be invoked directly by the user. To go one level up, see the QrCode.encodeSegments() function.
|
||||
*/
|
||||
this.QrCode = function(dataCodewords, mask, version, errCorLvl) {
|
||||
this.QrCode = function(version, errCorLvl, dataCodewords, mask) {
|
||||
|
||||
/*---- Constructor (low level) ----*/
|
||||
|
||||
|
@ -597,7 +597,7 @@ var qrcodegen = new function() {
|
|||
bb.appendBits(padByte, 8);
|
||||
|
||||
// Create the QR Code symbol
|
||||
return new this(bb.getBytes(), mask, version, ecl);
|
||||
return new this(version, ecl, bb.getBytes(), mask);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ This module "qrcodegen", public members:
|
|||
- Function encode_segments(list<QrSegment> segs, QrCode.Ecc ecl,
|
||||
int minversion=1, int maxversion=40, mask=-1, boostecl=true) -> QrCode
|
||||
- Constants int MIN_VERSION, MAX_VERSION
|
||||
- Constructor QrCode(bytes datacodewords, int mask, int version, QrCode.Ecc ecl)
|
||||
- Constructor QrCode(int version, QrCode.Ecc ecl, bytes datacodewords, int mask)
|
||||
- Method get_version() -> int
|
||||
- Method get_size() -> int
|
||||
- Method get_error_correction_level() -> QrCode.Ecc
|
||||
|
@ -141,12 +141,12 @@ class QrCode(object):
|
|||
bb.append_bits(padbyte, 8)
|
||||
|
||||
# Create the QR Code symbol
|
||||
return QrCode(bb.get_bytes(), mask, version, ecl)
|
||||
return QrCode(version, ecl, bb.get_bytes(), mask)
|
||||
|
||||
|
||||
# ---- Constructor (low level) ----
|
||||
|
||||
def __init__(self, datacodewords, mask, version, errcorlvl):
|
||||
def __init__(self, version, errcorlvl, datacodewords, mask):
|
||||
"""Creates a new QR Code symbol with the given version number, error correction level, binary data array,
|
||||
and mask number. mask = -1 is for automatic choice, or 0 to 7 for fixed choice. This is a cumbersome low-level constructor
|
||||
that should not be invoked directly by the user. To go one level up, see the QrCode.encode_segments() function."""
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace qrcodegen {
|
|||
bb.appendBits(padByte, 8);
|
||||
|
||||
// Create the QR Code symbol
|
||||
return new QrCode(bb.getBytes(), mask, version, ecl);
|
||||
return new QrCode(version, ecl, bb.getBytes(), mask);
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,18 +147,18 @@ namespace qrcodegen {
|
|||
/*-- Constructor (low level) and fields --*/
|
||||
|
||||
public constructor(
|
||||
// This QR Code symbol's version number, which is always between 1 and 40 (inclusive).
|
||||
public readonly version: int,
|
||||
|
||||
// The error correction level used in this QR Code symbol.
|
||||
public readonly errorCorrectionLevel: QrCode.Ecc,
|
||||
|
||||
dataCodewords: Array<byte>,
|
||||
|
||||
// The mask pattern used in this QR Code symbol, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
||||
// Note that even if the constructor was called with automatic masking requested
|
||||
// (mask = -1), the resulting object will still have a mask value between 0 and 7.
|
||||
public readonly mask: int,
|
||||
|
||||
// This QR Code symbol's version number, which is always between 1 and 40 (inclusive).
|
||||
public readonly version: int,
|
||||
|
||||
// The error correction level used in this QR Code symbol.
|
||||
public readonly errorCorrectionLevel: QrCode.Ecc) {
|
||||
public readonly mask: int) {
|
||||
|
||||
// Check arguments and handle simple scalar fields
|
||||
if (mask < -1 || mask > 7)
|
||||
|
|
Loading…
Reference in New Issue