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----*/
/*
* 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,

View File

@ -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
};

View File

@ -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 {

View File

@ -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;

View File

@ -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 {

View File

@ -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]),

View File

@ -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):

View File

@ -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,

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 {
/*-- 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 {