Updated and synchronized documentation comments for QrSegment's fields, in all languages.

pull/39/merge
Project Nayuki 6 years ago
parent 3e1454ab72
commit 139e67eee2

@ -84,12 +84,12 @@ enum qrcodegen_Mode {
* bit length is 32767, because even the largest QR Code (version 40) has only 31329 modules.
*/
struct qrcodegen_Segment {
// The mode indicator for this segment.
// The mode indicator of this segment.
enum qrcodegen_Mode mode;
// The length of this segment's unencoded data, measured in characters for
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive.
// Always zero or positive. Not the same as the data's bit length.
int numChars;
// The data bits of this segment, packed in bitwise big endian.

@ -139,15 +139,16 @@ class QrSegment final {
/*---- Instance fields ----*/
/* The mode indicator for this segment. */
/* The mode indicator of this segment. Accessed through getMode(). */
private: Mode mode;
/* The length of this segment's unencoded data, measured in characters for
/* The length of this segment's unencoded data. Measured in characters for
* numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
* Always zero or positive. */
* Always zero or positive. Not the same as the data's bit length.
* Accessed through getNumChars(). */
private: int numChars;
/* The data bits of this segment. */
/* The data bits of this segment. Accessed through getData(). */
private: std::vector<bool> data;

@ -156,15 +156,15 @@ public final class QrSegment {
/*---- Instance fields ----*/
/** The mode indicator for this segment. Never {@code null}. */
/** The mode indicator of this segment. Not {@code null}. */
public final Mode mode;
/** The length of this segment's unencoded data, measured in characters for
/** The length of this segment's unencoded data. Measured in characters for
* numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
* Always zero or positive. */
* Always zero or positive. Not the same as the data's bit length. */
public final int numChars;
/** The data bits of this segment. Accessed through {@link getBits()}. Not {@code null}. */
/** The data bits of this segment. Not {@code null}. Accessed through {@link getBits()}. */
final BitBuffer data;

@ -710,12 +710,12 @@ var qrcodegen = new function() {
throw "Invalid argument";
bitData = bitData.slice(); // Make defensive copy
// The mode indicator for this segment.
// The mode indicator of this segment.
Object.defineProperty(this, "mode", {value:mode});
// The length of this segment's unencoded data, measured in characters for
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive.
// Always zero or positive. Not the same as the data's bit length.
Object.defineProperty(this, "numChars", {value:numChars});
// Returns a copy of all bits, which is an array of 0s and 1s.

@ -688,12 +688,13 @@ class QrSegment(object):
if numch < 0:
raise ValueError()
# The mode indicator for this segment.
# The mode indicator of this segment. Accessed through get_mode().
self._mode = mode
# The length of this segment's unencoded data, measured in characters for
# The length of this segment's unencoded data. Measured in characters for
# numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
# Always zero or positive.
# Always zero or positive. Not the same as the data's bit length.
# Accessed through get_num_chars().
self._numchars = numch
# The data bits of this segment. Accessed through get_bits().

@ -833,14 +833,15 @@ impl ReedSolomonGenerator {
#[derive(Clone)]
pub struct QrSegment {
// The mode indicator for this segment.
// The mode indicator of this segment. Accessed through mode().
mode: QrSegmentMode,
// The length of this segment's unencoded data, measured in characters for
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Not the same as the data's bit length. Accessed through num_chars().
numchars: usize,
// The bits of this segment.
// The data bits of this segment. Accessed through data().
data: Vec<bool>,
}

@ -742,14 +742,15 @@ namespace qrcodegen {
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
public constructor(
// The mode indicator for this segment.
// The mode indicator of this segment.
public readonly mode: QrSegment.Mode,
// The length of this segment's unencoded data, measured in characters for
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive.
// Always zero or positive. Not the same as the data's bit length.
public readonly numChars: int,
// The data bits of this segment. Accessed through getBits().
private readonly bitData: Array<bit>) {
if (numChars < 0)

Loading…
Cancel
Save