Updated and synchronized QrCode.Ecc and QrSegment.Mode enums' documentation comments, in all languages.

This commit is contained in:
Project Nayuki 2018-10-05 17:58:16 +00:00
parent 29479efedf
commit 179f7be089
9 changed files with 46 additions and 40 deletions

View File

@ -36,13 +36,15 @@ extern "C" {
/*---- Enum and struct types----*/ /*---- 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 { enum qrcodegen_Ecc {
qrcodegen_Ecc_LOW = 0, // Must be declared in ascending order of error protection
qrcodegen_Ecc_MEDIUM, // so that an internal qrcodegen function works properly
qrcodegen_Ecc_QUARTILE, qrcodegen_Ecc_LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords
qrcodegen_Ecc_HIGH, 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 { enum qrcodegen_Mode {
qrcodegen_Mode_NUMERIC = 0x1, qrcodegen_Mode_NUMERIC = 0x1,

View File

@ -42,11 +42,13 @@ class QrCode final {
/*---- Public helper enumeration ----*/ /*---- 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 { public: enum class Ecc {
// Constants declared in ascending order of error protection. LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords
LOW = 0, MEDIUM = 1, QUARTILE = 2, HIGH = 3 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
}; };

View File

@ -42,7 +42,7 @@ class QrSegment final {
/*---- Public helper enumeration ----*/ /*---- 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 { public: class Mode final {

View File

@ -739,12 +739,15 @@ public final class QrCode {
/*---- Public helper enumeration ----*/ /*---- 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 { public enum Ecc {
// These enum constants must be declared in ascending order of error protection, // Must be declared in ascending order of error protection
// for the sake of the implicit ordinal() method and values() function. // so that the implicit ordinal() and values() work properly
LOW(1), MEDIUM(0), QUARTILE(3), HIGH(2); /** 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). // In the range 0 to 3 (unsigned 2-bit integer).
final int formatBits; final int formatBits;

View File

@ -236,7 +236,7 @@ public final class QrSegment {
/*---- Public helper enumeration ----*/ /*---- 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 { public enum Mode {

View File

@ -671,14 +671,13 @@ var qrcodegen = new function() {
/*---- Public helper enumeration ----*/ /*---- 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 = { this.QrCode.Ecc = {
// Constants declared in ascending order of error protection LOW : new Ecc(0, 1), // The QR Code can tolerate about 7% erroneous codewords
LOW : new Ecc(0, 1), MEDIUM : new Ecc(1, 0), // The QR Code can tolerate about 15% erroneous codewords
MEDIUM : new Ecc(1, 0), QUARTILE: new Ecc(2, 3), // The QR Code can tolerate about 25% erroneous codewords
QUARTILE: new Ecc(2, 3), HIGH : new Ecc(3, 2), // The QR Code can tolerate about 30% erroneous codewords
HIGH : new Ecc(3, 2),
}; };
@ -848,7 +847,7 @@ var qrcodegen = new function() {
/*---- Public helper enumeration ----*/ /*---- 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 this.QrSegment.Mode = { // Constants
NUMERIC : new Mode(0x1, [10, 12, 14]), NUMERIC : new Mode(0x1, [10, 12, 14]),

View File

@ -569,17 +569,17 @@ class QrCode(object):
# ---- Public helper enumeration ---- # ---- Public helper enumeration ----
class Ecc(object): 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 # Private constructor
def __init__(self, i, fb): def __init__(self, i, fb):
self.ordinal = i # (Public) In the range 0 to 3 (unsigned 2-bit integer) 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) self.formatbits = fb # (Package-private) In the range 0 to 3 (unsigned 2-bit integer)
# Public constants. Create them outside the class. # Public constants. Create them outside the class.
Ecc.LOW = Ecc(0, 1) Ecc.LOW = Ecc(0, 1) # The QR Code can tolerate about 7% erroneous codewords
Ecc.MEDIUM = Ecc(1, 0) Ecc.MEDIUM = Ecc(1, 0) # The QR Code can tolerate about 15% erroneous codewords
Ecc.QUARTILE = Ecc(2, 3) Ecc.QUARTILE = Ecc(2, 3) # The QR Code can tolerate about 25% erroneous codewords
Ecc.HIGH = Ecc(3, 2) Ecc.HIGH = Ecc(3, 2) # The QR Code can tolerate about 30% erroneous codewords
@ -742,7 +742,7 @@ class QrSegment(object):
# ---- Public helper enumeration ---- # ---- Public helper enumeration ----
class Mode(object): class Mode(object):
"""The mode field of a segment. Immutable.""" """Describes how a segment's data bits are interpreted. Immutable."""
# Private constructor # Private constructor
def __init__(self, modebits, charcounts): def __init__(self, modebits, charcounts):

View File

@ -714,13 +714,13 @@ static NUM_ERROR_CORRECTION_BLOCKS: [[i8; 41]; 4] = [
/*---- QrCodeEcc functionality ----*/ /*---- 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)] #[derive(Clone, Copy)]
pub enum QrCodeEcc { pub enum QrCodeEcc {
Low, Low , // The QR Code can tolerate about 7% erroneous codewords
Medium, Medium , // The QR Code can tolerate about 15% erroneous codewords
Quartile, Quartile, // The QR Code can tolerate about 25% erroneous codewords
High, 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 ----*/ /*---- QrSegmentMode functionality ----*/
// The mode field of a segment. Immutable. // Describes how a segment's data bits are interpreted.
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub enum QrSegmentMode { pub enum QrSegmentMode {
Numeric, Numeric,

View File

@ -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 { export class Ecc {
/*-- Constants --*/ /*-- Constants --*/
public static readonly LOW = new Ecc(0, 1); 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); 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); 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); public static readonly HIGH = new Ecc(3, 2); // The QR Code can tolerate about 30% erroneous codewords
/*-- Constructor and fields --*/ /*-- 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 { export class Mode {