mirror of
https://gitee.com/openharmony/third_party_qrcodegen
synced 2024-11-27 01:11:45 +00:00
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 ----*/
|
||||
|
||||
// The minimum and maximum defined QR Code version numbers for Model 2.
|
||||
#define qrcodegen_VERSION_MIN 1
|
||||
#define qrcodegen_VERSION_MAX 40
|
||||
#define qrcodegen_VERSION_MIN 1 // The minimum version number supported in the QR Code Model 2 standard
|
||||
#define qrcodegen_VERSION_MAX 40 // The maximum version number supported in the QR Code Model 2 standard
|
||||
|
||||
// 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)];'
|
||||
|
@ -96,19 +96,20 @@ class QrCode final {
|
||||
|
||||
// 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;
|
||||
|
||||
/* The width and height of this QR Code, measured in modules.
|
||||
* Always equal to version * 4 + 17, in the range 21 to 177. */
|
||||
/* The width and height of this QR Code, measured in modules, between
|
||||
* 21 and 177 (inclusive). This is equal to version * 4 + 17. */
|
||||
private: int size;
|
||||
|
||||
/* The error correction level used in this QR Code. */
|
||||
private: Ecc errorCorrectionLevel;
|
||||
|
||||
/* The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
||||
* Note that even if a constructor was called with automatic masking requested
|
||||
* (mask = -1), the resulting object will still have a mask value between 0 and 7. */
|
||||
/* 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. */
|
||||
private: int mask;
|
||||
|
||||
// Private grids of modules/pixels, with dimensions of size*size:
|
||||
@ -255,7 +256,10 @@ class QrCode final {
|
||||
|
||||
/*---- Constants and tables ----*/
|
||||
|
||||
// The minimum version number supported in the QR Code Model 2 standard.
|
||||
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;
|
||||
|
||||
|
||||
|
@ -173,19 +173,20 @@ public final class QrCode {
|
||||
|
||||
// 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;
|
||||
|
||||
/** The width and height of this QR Code, measured in modules.
|
||||
* Always equal to version × 4 + 17, in the range 21 to 177 (inclusive). */
|
||||
/** The width and height of this QR Code, measured in modules, between
|
||||
* 21 and 177 (inclusive). This is equal to version × 4 + 17. */
|
||||
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;
|
||||
|
||||
/** The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
||||
* Note that even if a constructor was called with automatic masking requested
|
||||
* (mask = -1), the resulting object will still have a mask value between 0 and 7. */
|
||||
/** The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||
* <p>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. */
|
||||
public final int mask;
|
||||
|
||||
// Private grids of modules/pixels, with dimensions of size*size:
|
||||
@ -705,7 +706,10 @@ public final class QrCode {
|
||||
|
||||
/*---- Constants and tables ----*/
|
||||
|
||||
/** The minimum version number (1) supported in the QR Code Model 2 standard. */
|
||||
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;
|
||||
|
||||
|
||||
|
@ -121,19 +121,20 @@ var qrcodegen = new function() {
|
||||
|
||||
/*---- 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});
|
||||
|
||||
// The width and height of this QR Code, measured in modules.
|
||||
// Always equal to version * 4 + 17, in the range 21 to 177.
|
||||
// The width and height of this QR Code, measured in modules, between
|
||||
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
||||
Object.defineProperty(this, "size", {value:size});
|
||||
|
||||
// The error correction level used in this QR Code.
|
||||
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).
|
||||
// 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.
|
||||
// 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.
|
||||
Object.defineProperty(this, "mask", {value:mask});
|
||||
|
||||
|
||||
@ -638,8 +639,8 @@ var qrcodegen = new function() {
|
||||
|
||||
/*---- Constants and tables for QrCode ----*/
|
||||
|
||||
var MIN_VERSION = 1;
|
||||
var MAX_VERSION = 40;
|
||||
var MIN_VERSION = 1; // The minimum version number supported in the QR Code Model 2 standard
|
||||
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, "MAX_VERSION", {value:MAX_VERSION});
|
||||
|
||||
|
@ -158,8 +158,16 @@ class QrCode(object):
|
||||
raise ValueError("Mask value out of range")
|
||||
if not isinstance(errcorlvl, QrCode.Ecc):
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
# The error correction level used in this QR Code.
|
||||
self._errcorlvl = errcorlvl
|
||||
|
||||
# Initialize both grids to be size*size arrays of Boolean false
|
||||
@ -187,6 +195,10 @@ class QrCode(object):
|
||||
assert 0 <= mask <= 7
|
||||
self._draw_format_bits(mask) # Overwrite old format bits
|
||||
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
|
||||
|
||||
del self._isfunction
|
||||
@ -529,8 +541,8 @@ class QrCode(object):
|
||||
|
||||
# ---- Constants and tables ----
|
||||
|
||||
MIN_VERSION = 1
|
||||
MAX_VERSION = 40
|
||||
MIN_VERSION = 1 # The minimum version number supported in the QR Code Model 2 standard
|
||||
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.
|
||||
_PENALTY_N1 = 3
|
||||
|
@ -33,19 +33,20 @@ pub struct QrCode {
|
||||
|
||||
// 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,
|
||||
|
||||
// The width and height of this QR Code, measured in modules.
|
||||
// Always equal to version * 4 + 17, in the range 21 to 177.
|
||||
// The width and height of this QR Code, measured in modules, between
|
||||
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
||||
size: i32,
|
||||
|
||||
// The error correction level used in this QR Code.
|
||||
errorcorrectionlevel: QrCodeEcc,
|
||||
|
||||
// The mask pattern used in this QR Code, in the range 0 to 7 (i.e. unsigned 3-bit integer).
|
||||
// Note that even if a constructor was called with automatic masking requested
|
||||
// (mask = -1), the resulting object will still have a mask value between 0 and 7.
|
||||
// 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 = None),
|
||||
// the resulting object still has a mask value between 0 and 7.
|
||||
mask: Mask,
|
||||
|
||||
// Grids of modules/pixels, with dimensions of size*size:
|
||||
@ -681,7 +682,10 @@ impl QrCode {
|
||||
|
||||
/*---- Cconstants and tables ----*/
|
||||
|
||||
// The minimum version number supported in the QR Code Model 2 standard.
|
||||
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);
|
||||
|
||||
|
||||
|
@ -133,8 +133,8 @@ namespace qrcodegen {
|
||||
|
||||
/*-- Fields --*/
|
||||
|
||||
// The width and height of this QR Code, measured in modules.
|
||||
// Always equal to version * 4 + 17, in the range 21 to 177.
|
||||
// The width and height of this QR Code, measured in modules, between
|
||||
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
|
||||
public readonly size: int;
|
||||
|
||||
// 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 --*/
|
||||
|
||||
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,
|
||||
|
||||
// The error correction level used in this QR Code.
|
||||
@ -155,9 +156,9 @@ namespace qrcodegen {
|
||||
|
||||
dataCodewords: Array<byte>,
|
||||
|
||||
// The mask pattern used in this QR Code, 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.
|
||||
// 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.
|
||||
public readonly mask: int) {
|
||||
|
||||
// Check scalar arguments
|
||||
@ -609,7 +610,9 @@ namespace qrcodegen {
|
||||
|
||||
/*-- Constants and tables --*/
|
||||
|
||||
// The minimum version number supported in the QR Code Model 2 standard.
|
||||
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;
|
||||
|
||||
// For use in getPenaltyScore(), when evaluating which mask is best.
|
||||
|
Loading…
Reference in New Issue
Block a user