diff --git a/c/qrcodegen.h b/c/qrcodegen.h index 7b93ca5..70b1ce8 100644 --- a/c/qrcodegen.h +++ b/c/qrcodegen.h @@ -36,13 +36,15 @@ extern "C" { /*---- Enum and struct types----*/ /* - * The error correction level used in a QR Code symbol. + * The error correction level in a QR Code symbol. */ enum qrcodegen_Ecc { - qrcodegen_Ecc_LOW = 0, - qrcodegen_Ecc_MEDIUM, - qrcodegen_Ecc_QUARTILE, - qrcodegen_Ecc_HIGH, + // Must be declared in ascending order of error protection + // so that an internal qrcodegen function works properly + qrcodegen_Ecc_LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords + qrcodegen_Ecc_MEDIUM , // The QR Code can tolerate about 15% erroneous codewords + qrcodegen_Ecc_QUARTILE, // The QR Code can tolerate about 25% erroneous codewords + qrcodegen_Ecc_HIGH , // The QR Code can tolerate about 30% erroneous codewords }; @@ -66,7 +68,7 @@ enum qrcodegen_Mask { /* - * The mode field of a segment. + * Describes how a segment's data bits are interpreted. */ enum qrcodegen_Mode { qrcodegen_Mode_NUMERIC = 0x1, diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index 94b72e5..1bc05a8 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -42,11 +42,13 @@ class QrCode final { /*---- Public helper enumeration ----*/ /* - * Represents the error correction level used in a QR Code symbol. + * The error correction level in a QR Code symbol. */ public: enum class Ecc { - // Constants declared in ascending order of error protection. - LOW = 0, MEDIUM = 1, QUARTILE = 2, HIGH = 3 + LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords + MEDIUM , // The QR Code can tolerate about 15% erroneous codewords + QUARTILE, // The QR Code can tolerate about 25% erroneous codewords + HIGH , // The QR Code can tolerate about 30% erroneous codewords }; diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index efe74a2..4f56e97 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -42,7 +42,7 @@ class QrSegment final { /*---- Public helper enumeration ----*/ /* - * The mode field of a segment. Immutable. Provides methods to retrieve closely related values. + * Describes how a segment's data bits are interpreted. Immutable. */ public: class Mode final { diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index 2d3ed61..f4e610f 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -739,12 +739,15 @@ public final class QrCode { /*---- Public helper enumeration ----*/ /** - * Represents the error correction level used in a QR Code symbol. + * The error correction level in a QR Code symbol. */ public enum Ecc { - // These enum constants must be declared in ascending order of error protection, - // for the sake of the implicit ordinal() method and values() function. - LOW(1), MEDIUM(0), QUARTILE(3), HIGH(2); + // Must be declared in ascending order of error protection + // so that the implicit ordinal() and values() work properly + /** The QR Code can tolerate about 7% erroneous codewords. */ LOW(1), + /** The QR Code can tolerate about 15% erroneous codewords. */ MEDIUM(0), + /** The QR Code can tolerate about 25% erroneous codewords. */ QUARTILE(3), + /** The QR Code can tolerate about 30% erroneous codewords. */ HIGH(2); // In the range 0 to 3 (unsigned 2-bit integer). final int formatBits; diff --git a/java/io/nayuki/qrcodegen/QrSegment.java b/java/io/nayuki/qrcodegen/QrSegment.java index b662ca7..251d1a1 100644 --- a/java/io/nayuki/qrcodegen/QrSegment.java +++ b/java/io/nayuki/qrcodegen/QrSegment.java @@ -236,7 +236,7 @@ public final class QrSegment { /*---- Public helper enumeration ----*/ /** - * The mode field of a segment. Immutable. Provides methods to retrieve closely related values. + * Describes how a segment's data bits are interpreted. */ public enum Mode { diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index db6a72c..afa2ba3 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -671,14 +671,13 @@ var qrcodegen = new function() { /*---- Public helper enumeration ----*/ /* - * Represents the error correction level used in a QR Code symbol. + * The error correction level in a QR Code symbol. Immutable. */ this.QrCode.Ecc = { - // Constants declared in ascending order of error protection - LOW : new Ecc(0, 1), - MEDIUM : new Ecc(1, 0), - QUARTILE: new Ecc(2, 3), - HIGH : new Ecc(3, 2), + LOW : new Ecc(0, 1), // The QR Code can tolerate about 7% erroneous codewords + MEDIUM : new Ecc(1, 0), // The QR Code can tolerate about 15% erroneous codewords + QUARTILE: new Ecc(2, 3), // The QR Code can tolerate about 25% erroneous codewords + HIGH : new Ecc(3, 2), // The QR Code can tolerate about 30% erroneous codewords }; @@ -848,7 +847,7 @@ var qrcodegen = new function() { /*---- Public helper enumeration ----*/ /* - * Represents the mode field of a segment. Immutable. + * Describes how a segment's data bits are interpreted. Immutable. */ this.QrSegment.Mode = { // Constants NUMERIC : new Mode(0x1, [10, 12, 14]), diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 3ab89db..debc3a4 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -569,17 +569,17 @@ class QrCode(object): # ---- Public helper enumeration ---- class Ecc(object): - """Represents the error correction level used in a QR Code symbol.""" + """The error correction level in a QR Code symbol. Immutable.""" # Private constructor def __init__(self, i, fb): self.ordinal = i # (Public) In the range 0 to 3 (unsigned 2-bit integer) self.formatbits = fb # (Package-private) In the range 0 to 3 (unsigned 2-bit integer) # Public constants. Create them outside the class. - Ecc.LOW = Ecc(0, 1) - Ecc.MEDIUM = Ecc(1, 0) - Ecc.QUARTILE = Ecc(2, 3) - Ecc.HIGH = Ecc(3, 2) + Ecc.LOW = Ecc(0, 1) # The QR Code can tolerate about 7% erroneous codewords + Ecc.MEDIUM = Ecc(1, 0) # The QR Code can tolerate about 15% erroneous codewords + Ecc.QUARTILE = Ecc(2, 3) # The QR Code can tolerate about 25% erroneous codewords + Ecc.HIGH = Ecc(3, 2) # The QR Code can tolerate about 30% erroneous codewords @@ -742,7 +742,7 @@ class QrSegment(object): # ---- Public helper enumeration ---- class Mode(object): - """The mode field of a segment. Immutable.""" + """Describes how a segment's data bits are interpreted. Immutable.""" # Private constructor def __init__(self, modebits, charcounts): diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 3cf2bcd..ca74cf7 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -714,13 +714,13 @@ static NUM_ERROR_CORRECTION_BLOCKS: [[i8; 41]; 4] = [ /*---- QrCodeEcc functionality ----*/ -// Represents the error correction level used in a QR Code symbol. Immutable. +// The error correction level in a QR Code symbol. #[derive(Clone, Copy)] pub enum QrCodeEcc { - Low, - Medium, - Quartile, - High, + Low , // The QR Code can tolerate about 7% erroneous codewords + Medium , // The QR Code can tolerate about 15% erroneous codewords + Quartile, // The QR Code can tolerate about 25% erroneous codewords + High , // The QR Code can tolerate about 30% erroneous codewords } @@ -1024,7 +1024,7 @@ static ALPHANUMERIC_CHARSET: [char; 45] = ['0','1','2','3','4','5','6','7','8',' /*---- QrSegmentMode functionality ----*/ -// The mode field of a segment. Immutable. +// Describes how a segment's data bits are interpreted. #[derive(Clone, Copy)] pub enum QrSegmentMode { Numeric, diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 46d0222..a587360 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -930,16 +930,16 @@ namespace qrcodegen.QrCode { /* - * Represents the error correction level used in a QR Code symbol. + * The error correction level in a QR Code symbol. Immutable. */ export class Ecc { /*-- Constants --*/ - public static readonly LOW = new Ecc(0, 1); - public static readonly MEDIUM = new Ecc(1, 0); - public static readonly QUARTILE = new Ecc(2, 3); - public static readonly HIGH = new Ecc(3, 2); + public static readonly LOW = new Ecc(0, 1); // The QR Code can tolerate about 7% erroneous codewords + public static readonly MEDIUM = new Ecc(1, 0); // The QR Code can tolerate about 15% erroneous codewords + public static readonly QUARTILE = new Ecc(2, 3); // The QR Code can tolerate about 25% erroneous codewords + public static readonly HIGH = new Ecc(3, 2); // The QR Code can tolerate about 30% erroneous codewords /*-- Constructor and fields --*/ @@ -963,7 +963,7 @@ namespace qrcodegen.QrSegment { /* - * Represents the mode field of a segment. Immutable. + * Describes how a segment's data bits are interpreted. Immutable. */ export class Mode {