Updated class QrCode's field comments, in most languages.

pull/39/merge
Project Nayuki 6 years ago
parent 028b377472
commit eab76f20d6

@ -92,7 +92,7 @@ class QrCode final {
/*---- Instance fields ----*/
// Immutable scalar parameters
// Immutable scalar parameters:
/* This QR Code symbol's version number, which is always between 1 and 40 (inclusive). */
private: int version;
@ -109,9 +109,13 @@ class QrCode final {
* (mask = -1), the resulting object will still have a mask value between 0 and 7. */
private: int mask;
// Private grids of modules/pixels (conceptually immutable)
private: std::vector<std::vector<bool> > modules; // The modules of this QR Code symbol (false = white, true = black)
private: std::vector<std::vector<bool> > isFunction; // Indicates function modules that are not subjected to masking
// Private grids of modules/pixels, with dimensions of size*size:
// The modules of this QR Code symbol (false = white, true = black). Immutable after constructor finishes.
private: std::vector<std::vector<bool> > modules;
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
private: std::vector<std::vector<bool> > isFunction;

@ -171,7 +171,7 @@ public final class QrCode {
/*---- Instance fields ----*/
// Public immutable scalar parameters
// Public immutable scalar parameters:
/** This QR Code symbol's version number, which is always between 1 and 40 (inclusive). */
public final int version;
@ -188,9 +188,13 @@ public final class QrCode {
* (mask = -1), the resulting object will still have a mask value between 0 and 7. */
public final int mask;
// Private grids of modules/pixels (conceptually immutable)
private boolean[][] modules; // The modules of this QR Code symbol (false = white, true = black)
private boolean[][] isFunction; // Indicates function modules that are not subjected to masking
// Private grids of modules/pixels, with dimensions of size*size:
// The modules of this QR Code symbol (false = white, true = black). Immutable after constructor finishes.
private boolean[][] modules;
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
private boolean[][] isFunction;

@ -164,9 +164,13 @@ class QrCode(object):
if len(datacodewords) != QrCode._get_num_data_codewords(version, errcorlvl):
raise ValueError("Invalid array length")
# Initialize grids of modules
self._modules = [[False] * self._size for _ in range(self._size)] # The modules of the QR symbol; start with entirely white grid
self._isfunction = [[False] * self._size for _ in range(self._size)] # Indicates function modules that are not subjected to masking
# The modules of this QR Code symbol (False = white, True = black). Immutable after constructor finishes
self._modules = [[False] * self._size for _ in range(self._size)]
# Indicates function modules that are not subjected to masking. Discarded when constructor finishes
self._isfunction = [[False] * self._size for _ in range(self._size)]
# Draw function patterns, draw all codewords
self._draw_function_patterns()
allcodewords = self._add_ecc_and_interleave(datacodewords)

@ -31,6 +31,8 @@
#[derive(Clone)]
pub struct QrCode {
// Scalar parameters:
// This QR Code symbol's version number, which is always between 1 and 40 (inclusive).
version: Version,
@ -46,10 +48,12 @@ pub struct QrCode {
// (mask = -1), the resulting object will still have a mask value between 0 and 7.
mask: Mask,
// The modules of this QR Code symbol (false = white, true = black)
// Grids of modules/pixels, with dimensions of size*size:
// The modules of this QR Code symbol (false = white, true = black). Immutable after constructor finishes.
modules: Vec<bool>,
// Indicates function modules that are not subjected to masking
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
isfunction: Vec<bool>,
}

@ -137,10 +137,10 @@ namespace qrcodegen {
// Always equal to version * 4 + 17, in the range 21 to 177.
public readonly size: int;
// The modules of this QR Code symbol (false = white, true = black).
// The modules of this QR Code symbol (false = white, true = black). Immutable after constructor finishes.
private readonly modules: Array<Array<boolean>> = [];
// Indicates function modules that are not subjected to masking.
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
private readonly isFunction: Array<Array<boolean>> = [];

Loading…
Cancel
Save