Updated and synchronized documentation comments for QrCode class's fields and constants, in all languages.
This commit is contained in:
parent
eebae19fb2
commit
a5b6c28a1f
|
@ -113,9 +113,8 @@ struct qrcodegen_Segment {
|
||||||
|
|
||||||
/*---- Macro constants and functions ----*/
|
/*---- Macro constants and functions ----*/
|
||||||
|
|
||||||
// The minimum and maximum defined QR Code version numbers for Model 2.
|
#define qrcodegen_VERSION_MIN 1 // The minimum version number supported in the QR Code Model 2 standard
|
||||||
#define qrcodegen_VERSION_MIN 1
|
#define qrcodegen_VERSION_MAX 40 // The maximum version number supported in the QR Code Model 2 standard
|
||||||
#define qrcodegen_VERSION_MAX 40
|
|
||||||
|
|
||||||
// Calculates the number of bytes needed to store any QR Code up to and including the given version number,
|
// Calculates the number of bytes needed to store any QR Code up to and including the given version number,
|
||||||
// as a compile-time constant. For example, 'uint8_t buffer[qrcodegen_BUFFER_LEN_FOR_VERSION(25)];'
|
// as a compile-time constant. For example, 'uint8_t buffer[qrcodegen_BUFFER_LEN_FOR_VERSION(25)];'
|
||||||
|
|
|
@ -96,19 +96,20 @@ class QrCode final {
|
||||||
|
|
||||||
// Immutable scalar parameters:
|
// Immutable scalar parameters:
|
||||||
|
|
||||||
/* This QR Code's version number, which is always between 1 and 40 (inclusive). */
|
/* The version number of this QR Code, which is between 1 and 40 (inclusive).
|
||||||
|
* This determines the size of this barcode. */
|
||||||
private: int version;
|
private: int version;
|
||||||
|
|
||||||
/* The width and height of this QR Code, measured in modules.
|
/* The width and height of this QR Code, measured in modules, between
|
||||||
* Always equal to version * 4 + 17, in the range 21 to 177. */
|
* 21 and 177 (inclusive). This is equal to version * 4 + 17. */
|
||||||
private: int size;
|
private: int size;
|
||||||
|
|
||||||
/* The error correction level used in this QR Code. */
|
/* The error correction level used in this QR Code. */
|
||||||
private: Ecc errorCorrectionLevel;
|
private: Ecc errorCorrectionLevel;
|
||||||
|
|
||||||
/* The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
/* The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||||
* Note that even if a constructor was called with automatic masking requested
|
* Even if a QR Code is created with automatic masking requested (mask = -1),
|
||||||
* (mask = -1), the resulting object will still have a mask value between 0 and 7. */
|
* the resulting object still has a mask value between 0 and 7. */
|
||||||
private: int mask;
|
private: int mask;
|
||||||
|
|
||||||
// Private grids of modules/pixels, with dimensions of size*size:
|
// Private grids of modules/pixels, with dimensions of size*size:
|
||||||
|
@ -255,7 +256,10 @@ class QrCode final {
|
||||||
|
|
||||||
/*---- Constants and tables ----*/
|
/*---- Constants and tables ----*/
|
||||||
|
|
||||||
|
// The minimum version number supported in the QR Code Model 2 standard.
|
||||||
public: static constexpr int MIN_VERSION = 1;
|
public: static constexpr int MIN_VERSION = 1;
|
||||||
|
|
||||||
|
// The maximum version number supported in the QR Code Model 2 standard.
|
||||||
public: static constexpr int MAX_VERSION = 40;
|
public: static constexpr int MAX_VERSION = 40;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -173,19 +173,20 @@ public final class QrCode {
|
||||||
|
|
||||||
// Public immutable scalar parameters:
|
// Public immutable scalar parameters:
|
||||||
|
|
||||||
/** This QR Code's version number, which is always between 1 and 40 (inclusive). */
|
/** The version number of this QR Code, which is between 1 and 40 (inclusive).
|
||||||
|
* This determines the size of this barcode. */
|
||||||
public final int version;
|
public final int version;
|
||||||
|
|
||||||
/** The width and height of this QR Code, measured in modules.
|
/** The width and height of this QR Code, measured in modules, between
|
||||||
* Always equal to version × 4 + 17, in the range 21 to 177 (inclusive). */
|
* 21 and 177 (inclusive). This is equal to version × 4 + 17. */
|
||||||
public final int size;
|
public final int size;
|
||||||
|
|
||||||
/** The error correction level used in this QR Code. Never {@code null}. */
|
/** The error correction level used in this QR Code, which is not {@code null}. */
|
||||||
public final Ecc errorCorrectionLevel;
|
public final Ecc errorCorrectionLevel;
|
||||||
|
|
||||||
/** The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
/** The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||||
* Note that even if a constructor was called with automatic masking requested
|
* <p>Even if a QR Code is created with automatic masking requested (mask =
|
||||||
* (mask = -1), the resulting object will still have a mask value between 0 and 7. */
|
* −1), the resulting object still has a mask value between 0 and 7. */
|
||||||
public final int mask;
|
public final int mask;
|
||||||
|
|
||||||
// Private grids of modules/pixels, with dimensions of size*size:
|
// Private grids of modules/pixels, with dimensions of size*size:
|
||||||
|
@ -705,7 +706,10 @@ public final class QrCode {
|
||||||
|
|
||||||
/*---- Constants and tables ----*/
|
/*---- Constants and tables ----*/
|
||||||
|
|
||||||
|
/** The minimum version number (1) supported in the QR Code Model 2 standard. */
|
||||||
public static final int MIN_VERSION = 1;
|
public static final int MIN_VERSION = 1;
|
||||||
|
|
||||||
|
/** The maximum version number (40) supported in the QR Code Model 2 standard. */
|
||||||
public static final int MAX_VERSION = 40;
|
public static final int MAX_VERSION = 40;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,19 +121,20 @@ var qrcodegen = new function() {
|
||||||
|
|
||||||
/*---- Read-only instance properties ----*/
|
/*---- Read-only instance properties ----*/
|
||||||
|
|
||||||
// This QR Code's version number, which is always between 1 and 40 (inclusive).
|
// The version number of this QR Code, which is between 1 and 40 (inclusive).
|
||||||
|
// This determines the size of this barcode.
|
||||||
Object.defineProperty(this, "version", {value:version});
|
Object.defineProperty(this, "version", {value:version});
|
||||||
|
|
||||||
// The width and height of this QR Code, measured in modules.
|
// The width and height of this QR Code, measured in modules, between
|
||||||
// Always equal to version * 4 + 17, in the range 21 to 177.
|
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
||||||
Object.defineProperty(this, "size", {value:size});
|
Object.defineProperty(this, "size", {value:size});
|
||||||
|
|
||||||
// The error correction level used in this QR Code.
|
// The error correction level used in this QR Code.
|
||||||
Object.defineProperty(this, "errorCorrectionLevel", {value:errCorLvl});
|
Object.defineProperty(this, "errorCorrectionLevel", {value:errCorLvl});
|
||||||
|
|
||||||
// The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
// The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||||
// Note that even if the constructor was called with automatic masking requested
|
// Even if a QR Code is created with automatic masking requested (mask = -1),
|
||||||
// (mask = -1), the resulting object will still have a mask value between 0 and 7.
|
// the resulting object still has a mask value between 0 and 7.
|
||||||
Object.defineProperty(this, "mask", {value:mask});
|
Object.defineProperty(this, "mask", {value:mask});
|
||||||
|
|
||||||
|
|
||||||
|
@ -638,8 +639,8 @@ var qrcodegen = new function() {
|
||||||
|
|
||||||
/*---- Constants and tables for QrCode ----*/
|
/*---- Constants and tables for QrCode ----*/
|
||||||
|
|
||||||
var MIN_VERSION = 1;
|
var MIN_VERSION = 1; // The minimum version number supported in the QR Code Model 2 standard
|
||||||
var MAX_VERSION = 40;
|
var MAX_VERSION = 40; // The maximum version number supported in the QR Code Model 2 standard
|
||||||
Object.defineProperty(this.QrCode, "MIN_VERSION", {value:MIN_VERSION});
|
Object.defineProperty(this.QrCode, "MIN_VERSION", {value:MIN_VERSION});
|
||||||
Object.defineProperty(this.QrCode, "MAX_VERSION", {value:MAX_VERSION});
|
Object.defineProperty(this.QrCode, "MAX_VERSION", {value:MAX_VERSION});
|
||||||
|
|
||||||
|
|
|
@ -158,8 +158,16 @@ class QrCode(object):
|
||||||
raise ValueError("Mask value out of range")
|
raise ValueError("Mask value out of range")
|
||||||
if not isinstance(errcorlvl, QrCode.Ecc):
|
if not isinstance(errcorlvl, QrCode.Ecc):
|
||||||
raise TypeError("QrCode.Ecc expected")
|
raise TypeError("QrCode.Ecc expected")
|
||||||
|
|
||||||
|
# The version number of this QR Code, which is between 1 and 40 (inclusive).
|
||||||
|
# This determines the size of this barcode.
|
||||||
self._version = version
|
self._version = version
|
||||||
|
|
||||||
|
# The width and height of this QR Code, measured in modules, between
|
||||||
|
# 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
||||||
self._size = version * 4 + 17
|
self._size = version * 4 + 17
|
||||||
|
|
||||||
|
# The error correction level used in this QR Code.
|
||||||
self._errcorlvl = errcorlvl
|
self._errcorlvl = errcorlvl
|
||||||
|
|
||||||
# Initialize both grids to be size*size arrays of Boolean false
|
# Initialize both grids to be size*size arrays of Boolean false
|
||||||
|
@ -187,6 +195,10 @@ class QrCode(object):
|
||||||
assert 0 <= mask <= 7
|
assert 0 <= mask <= 7
|
||||||
self._draw_format_bits(mask) # Overwrite old format bits
|
self._draw_format_bits(mask) # Overwrite old format bits
|
||||||
self._apply_mask(mask) # Apply the final choice of mask
|
self._apply_mask(mask) # Apply the final choice of mask
|
||||||
|
|
||||||
|
# The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||||
|
# Even if a QR Code is created with automatic masking requested (mask = -1),
|
||||||
|
# the resulting object still has a mask value between 0 and 7.
|
||||||
self._mask = mask
|
self._mask = mask
|
||||||
|
|
||||||
del self._isfunction
|
del self._isfunction
|
||||||
|
@ -529,8 +541,8 @@ class QrCode(object):
|
||||||
|
|
||||||
# ---- Constants and tables ----
|
# ---- Constants and tables ----
|
||||||
|
|
||||||
MIN_VERSION = 1
|
MIN_VERSION = 1 # The minimum version number supported in the QR Code Model 2 standard
|
||||||
MAX_VERSION = 40
|
MAX_VERSION = 40 # The maximum version number supported in the QR Code Model 2 standard
|
||||||
|
|
||||||
# For use in getPenaltyScore(), when evaluating which mask is best.
|
# For use in getPenaltyScore(), when evaluating which mask is best.
|
||||||
_PENALTY_N1 = 3
|
_PENALTY_N1 = 3
|
||||||
|
|
|
@ -33,19 +33,20 @@ pub struct QrCode {
|
||||||
|
|
||||||
// Scalar parameters:
|
// Scalar parameters:
|
||||||
|
|
||||||
// This QR Code's version number, which is always between 1 and 40 (inclusive).
|
// The version number of this QR Code, which is between 1 and 40 (inclusive).
|
||||||
|
// This determines the size of this barcode.
|
||||||
version: Version,
|
version: Version,
|
||||||
|
|
||||||
// The width and height of this QR Code, measured in modules.
|
// The width and height of this QR Code, measured in modules, between
|
||||||
// Always equal to version * 4 + 17, in the range 21 to 177.
|
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
||||||
size: i32,
|
size: i32,
|
||||||
|
|
||||||
// The error correction level used in this QR Code.
|
// The error correction level used in this QR Code.
|
||||||
errorcorrectionlevel: QrCodeEcc,
|
errorcorrectionlevel: QrCodeEcc,
|
||||||
|
|
||||||
// The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
// The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||||
// Note that even if a constructor was called with automatic masking requested
|
// Even if a QR Code is created with automatic masking requested (mask = None),
|
||||||
// (mask = -1), the resulting object will still have a mask value between 0 and 7.
|
// the resulting object still has a mask value between 0 and 7.
|
||||||
mask: Mask,
|
mask: Mask,
|
||||||
|
|
||||||
// Grids of modules/pixels, with dimensions of size*size:
|
// Grids of modules/pixels, with dimensions of size*size:
|
||||||
|
@ -681,7 +682,10 @@ impl QrCode {
|
||||||
|
|
||||||
/*---- Cconstants and tables ----*/
|
/*---- Cconstants and tables ----*/
|
||||||
|
|
||||||
|
// The minimum version number supported in the QR Code Model 2 standard.
|
||||||
pub const QrCode_MIN_VERSION: Version = Version( 1);
|
pub const QrCode_MIN_VERSION: Version = Version( 1);
|
||||||
|
|
||||||
|
// The maximum version number supported in the QR Code Model 2 standard.
|
||||||
pub const QrCode_MAX_VERSION: Version = Version(40);
|
pub const QrCode_MAX_VERSION: Version = Version(40);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,8 @@ namespace qrcodegen {
|
||||||
|
|
||||||
/*-- Fields --*/
|
/*-- Fields --*/
|
||||||
|
|
||||||
// The width and height of this QR Code, measured in modules.
|
// The width and height of this QR Code, measured in modules, between
|
||||||
// Always equal to version * 4 + 17, in the range 21 to 177.
|
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
||||||
public readonly size: int;
|
public readonly size: int;
|
||||||
|
|
||||||
// The modules of this QR Code (false = white, true = black). Immutable after constructor finishes.
|
// The modules of this QR Code (false = white, true = black). Immutable after constructor finishes.
|
||||||
|
@ -147,7 +147,8 @@ namespace qrcodegen {
|
||||||
/*-- Constructor (low level) and fields --*/
|
/*-- Constructor (low level) and fields --*/
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
// This QR Code's version number, which is always between 1 and 40 (inclusive).
|
// The version number of this QR Code, which is between 1 and 40 (inclusive).
|
||||||
|
// This determines the size of this barcode.
|
||||||
public readonly version: int,
|
public readonly version: int,
|
||||||
|
|
||||||
// The error correction level used in this QR Code.
|
// The error correction level used in this QR Code.
|
||||||
|
@ -155,9 +156,9 @@ namespace qrcodegen {
|
||||||
|
|
||||||
dataCodewords: Array<byte>,
|
dataCodewords: Array<byte>,
|
||||||
|
|
||||||
// The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
// The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||||
// Note that even if the constructor was called with automatic masking requested
|
// Even if a QR Code is created with automatic masking requested (mask = -1),
|
||||||
// (mask = -1), the resulting object will still have a mask value between 0 and 7.
|
// the resulting object still has a mask value between 0 and 7.
|
||||||
public readonly mask: int) {
|
public readonly mask: int) {
|
||||||
|
|
||||||
// Check scalar arguments
|
// Check scalar arguments
|
||||||
|
@ -609,7 +610,9 @@ namespace qrcodegen {
|
||||||
|
|
||||||
/*-- Constants and tables --*/
|
/*-- Constants and tables --*/
|
||||||
|
|
||||||
|
// The minimum version number supported in the QR Code Model 2 standard.
|
||||||
public static readonly MIN_VERSION: int = 1;
|
public static readonly MIN_VERSION: int = 1;
|
||||||
|
// The maximum version number supported in the QR Code Model 2 standard.
|
||||||
public static readonly MAX_VERSION: int = 40;
|
public static readonly MAX_VERSION: int = 40;
|
||||||
|
|
||||||
// For use in getPenaltyScore(), when evaluating which mask is best.
|
// For use in getPenaltyScore(), when evaluating which mask is best.
|
||||||
|
|
Loading…
Reference in New Issue