Updated documentation comments for two QrSegment.Mode members, in all language versions.

pull/39/merge
Project Nayuki 6 years ago
parent f9a40a31db
commit 4ee7f6df96

@ -964,8 +964,8 @@ testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int
}
// Returns the bit width of the segment character count field for the
// given mode at the given version number. The result is in the range [0, 16].
// Returns the bit width of the character count field for a segment in the given mode
// in a QR Code at the given version number. The result is in the range [0, 16].
static int numCharCountBits(enum qrcodegen_Mode mode, int version) {
assert(qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX);
int i = (version + 7) / 17;

@ -60,7 +60,7 @@ class QrSegment final {
// The mode indicator bits, which is a uint4 value (range 0 to 15).
private: int modeBits;
// Three values for different version ranges.
// Number of character count bits for three different version ranges.
private: int numBitsCharCount[3];
@ -77,7 +77,8 @@ class QrSegment final {
public: int getModeBits() const;
/*
* (Package-private) Returns the bit width of the segment character count field for this mode object at the given version number.
* (Package-private) Returns the bit width of the character count field for a segment in
* this mode in a QR Code at the given version number. The result is in the range [0, 16].
*/
public: int numCharCountBits(int ver) const;

@ -250,7 +250,7 @@ public final class QrSegment {
/** The mode indicator bits, which is a uint4 value (range 0 to 15). */
final int modeBits;
/** Three values for different version ranges. */
/** Number of character count bits for three different version ranges. */
private final int[] numBitsCharCount;
@ -265,9 +265,10 @@ public final class QrSegment {
/*-- Method --*/
/**
* Returns the bit width of the segment character count field for this mode object at the specified version number.
* Returns the bit width of the character count field for a segment
* in this mode in a QR Code at the specified version number.
* @param ver the version number, which is between 1 to 40 (inclusive)
* @return the number of bits for the character count, which is between 8 to 16 (inclusive)
* @return the number of bits for the character count, which is between 0 to 16 (inclusive)
*/
int numCharCountBits(int ver) {
assert QrCode.MIN_VERSION <= ver && ver <= QrCode.MAX_VERSION;

@ -856,7 +856,8 @@ var qrcodegen = new function() {
// (Package-private) The mode indicator bits, which is a uint4 value (range 0 to 15).
Object.defineProperty(this, "modeBits", {value:mode});
// (Package-private) Returns the bit width of the segment character count field for this mode object at the given version number.
// (Package-private) Returns the bit width of the character count field for a segment in
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
this.numCharCountBits = function(ver) {
return ccbits[Math.floor((ver + 7) / 17)];
};

@ -733,7 +733,7 @@ class QrSegment(object):
# Private constructor
def __init__(self, modebits, charcounts):
self._modebits = modebits # The mode indicator bits, which is a uint4 value (range 0 to 15)
self._charcounts = charcounts # Three values for different version ranges
self._charcounts = charcounts # Number of character count bits for three different version ranges
# Package-private method
def get_mode_bits(self):
@ -742,7 +742,8 @@ class QrSegment(object):
# Package-private method
def num_char_count_bits(self, ver):
"""Returns the bit width of the segment character count field for this mode object at the given version number."""
"""Returns the bit width of the character count field for a segment in this mode
in a QR Code at the given version number. The result is in the range [0, 16]."""
return self._charcounts[(ver + 7) // 17]
# Public constants. Create them outside the class.

@ -1044,8 +1044,8 @@ impl QrSegmentMode {
}
// Returns the bit width of the segment character count field
// for this mode object at the given version number.
// Returns the bit width of the character count field for a segment in this mode
// in a QR Code at the given version number. The result is in the range [0, 16].
pub fn num_char_count_bits(&self, ver: Version) -> u8 {
use QrSegmentMode::*;
(match *self {

@ -975,13 +975,14 @@ namespace qrcodegen.QrSegment {
private constructor(
// The mode indicator bits, which is a uint4 value (range 0 to 15).
public readonly modeBits: int,
// Three values for different version ranges.
// Number of character count bits for three different version ranges.
private readonly numBitsCharCount: [int,int,int]) {}
/*-- Method --*/
// (Package-private) Returns the bit width of the segment character count field for this mode object at the given version number.
// (Package-private) Returns the bit width of the character count field for a segment in
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
public numCharCountBits(ver: int): int {
return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
}

Loading…
Cancel
Save