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

This commit is contained in:
Project Nayuki 2018-10-05 19:27:11 +00:00
parent 3e1454ab72
commit 139e67eee2
7 changed files with 27 additions and 23 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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().

View File

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

View File

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