diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index bcc822e..6e57c51 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -54,7 +54,7 @@ public: // Fields. public: const int ordinal; // In the range 0 to 3 (unsigned 2-bit integer). - const int formatBits; // In the range 0 to 3 (unsigned 2-bit integer). + const int formatBits; // (Package-private) In the range 0 to 3 (unsigned 2-bit integer). // Constructor. private: diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index cc8db37..741a6dc 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -59,7 +59,7 @@ public: /*-- Fields --*/ - /* An unsigned 4-bit integer value (range 0 to 15) representing the mode indicator bits for this mode object. */ + /* (Package-private) An unsigned 4-bit integer value (range 0 to 15) representing the mode indicator bits for this mode object. */ public: const int modeBits; @@ -76,7 +76,7 @@ public: /*-- Method --*/ /* - * 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 segment character count field for this mode object at the given version number. */ public: int numCharCountBits(int ver) const; diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index fd62b68..e610ce3 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -755,7 +755,7 @@ public final class QrCode { LOW(1), MEDIUM(0), QUARTILE(3), HIGH(2); // In the range 0 to 3 (unsigned 2-bit integer). - public final int formatBits; + final int formatBits; // Constructor. private Ecc(int fb) { diff --git a/java/io/nayuki/qrcodegen/QrSegment.java b/java/io/nayuki/qrcodegen/QrSegment.java index c41792a..4fa7766 100644 --- a/java/io/nayuki/qrcodegen/QrSegment.java +++ b/java/io/nayuki/qrcodegen/QrSegment.java @@ -243,7 +243,7 @@ public final class QrSegment { /*-- Fields --*/ /** An unsigned 4-bit integer value (range 0 to 15) representing the mode indicator bits for this mode object. */ - public final int modeBits; + final int modeBits; private final int[] numBitsCharCount; @@ -264,7 +264,7 @@ public final class QrSegment { * @return the number of bits for the character count, which is between 8 to 16, inclusive * @throws IllegalArgumentException if the version number is out of range */ - public int numCharCountBits(int ver) { + int numCharCountBits(int ver) { if ( 1 <= ver && ver <= 9) return numBitsCharCount[0]; else if (10 <= ver && ver <= 26) return numBitsCharCount[1]; else if (27 <= ver && ver <= 40) return numBitsCharCount[2]; diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 0b3c9f6..c7763cf 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -37,11 +37,10 @@ * - Fields int version, size, mask * - Field QrCode.Ecc errorCorrectionLevel * - Method getModule(int x, int y) -> int - * - Method isFunctionModule(int x, int y) -> bool * - Method toSvgString(int border) -> str * - Enum Ecc: * - Constants LOW, MEDIUM, QUARTILE, HIGH - * - Fields int ordinal, formatBits + * - Field int ordinal * - Class QrSegment: * - Function makeBytes(list data) -> QrSegment * - Function makeNumeric(str data) -> QrSegment @@ -53,8 +52,6 @@ * - Method getBits() -> list * - Enum Mode: * - Constants NUMERIC, ALPHANUMERIC, BYTE, KANJI - * - Field int modeBits - * - Method numCharCountBits(int ver) -> int */ var qrcodegen = new function() { @@ -172,8 +169,9 @@ var qrcodegen = new function() { return 0; // Infinite white border }; - // Tests whether the module at the given coordinates is a function module (true) or not (false). The top left - // corner has the coordinates (x=0, y=0). If the given coordinates are out of bounds, then false is returned. + // (Package-private) Tests whether the module at the given coordinates is a function module (true) or not (false). + // The top left corner has the coordinates (x=0, y=0). If the given coordinates are out of bounds, then false is returned. + // The JavaScript version of this library has this method because it is impossible to access private variables of another object. this.isFunctionModule = function(x, y) { if (0 <= x && x < size && 0 <= y && y < size) return isFunction[y][x]; @@ -681,6 +679,7 @@ var qrcodegen = new function() { // (Public) In the range 0 to 3 (unsigned 2-bit integer) Object.defineProperty(this, "ordinal", {value:ord}); + // (Package-private) In the range 0 to 3 (unsigned 2-bit integer) Object.defineProperty(this, "formatBits", {value:fb}); } @@ -844,10 +843,10 @@ var qrcodegen = new function() { // Private constructor. function Mode(mode, ccbits) { - // An unsigned 4-bit integer value (range 0 to 15) representing the mode indicator bits for this mode object. + // (Package-private) An unsigned 4-bit integer value (range 0 to 15) representing the mode indicator bits for this mode object. Object.defineProperty(this, "modeBits", {value:mode}); - // 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 segment character count field for this mode object at the given version number. this.numCharCountBits = function(ver) { if ( 1 <= ver && ver <= 9) return ccbits[0]; else if (10 <= ver && ver <= 26) return ccbits[1]; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 73ae851..cc31111 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -42,7 +42,7 @@ This module "qrcodegen", public members: - Method to_svg_str(int border) -> str - Enum Ecc: - Constants LOW, MEDIUM, QUARTILE, HIGH - - Fields int ordinal, formatbits + - Field int ordinal - Class QrSegment: - Function make_bytes(bytes data) -> QrSegment - Function make_numeric(str digits) -> QrSegment @@ -54,8 +54,6 @@ This module "qrcodegen", public members: - Method get_bits() -> list - Enum Mode: - Constants NUMERIC, ALPHANUMERIC, BYTE, KANJI - - Method get_mode_bits() -> int - - Method num_char_count_bits(int ver) -> int """ @@ -584,7 +582,7 @@ class QrCode(object): # Private constructor def __init__(self, i, fb): self.ordinal = i # In the range 0 to 3 (unsigned 2-bit integer) - self.formatbits = fb # 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) @@ -724,10 +722,12 @@ class QrSegment(object): self._modebits = modebits self._charcounts = charcounts + # Package-private method def get_mode_bits(self): """Returns an unsigned 4-bit integer value (range 0 to 15) representing the mode indicator bits for this mode object.""" return self._modebits + # 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.""" if 1 <= ver <= 9: return self._charcounts[0]