From 3c995fa0965e51cc232a99a674724d9e1b16e6ac Mon Sep 17 00:00:00 2001 From: Nayuki Minase Date: Wed, 20 Apr 2016 20:46:46 +0000 Subject: [PATCH] Updated some comments to note public and private members in JavaScript, Python, C++ code. --- cpp/QrCode.hpp | 2 +- javascript/qrcodegen.js | 4 ++-- python/qrcodegen.py | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index 6e57c51..0d981c0 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -53,7 +53,7 @@ public: // Fields. public: - const int ordinal; // In the range 0 to 3 (unsigned 2-bit integer). + const int ordinal; // (Public) 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. diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 0327469..6fbc6b1 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -161,7 +161,7 @@ var qrcodegen = new function() { /*---- Accessor methods ----*/ - // Returns the color of the module (pixel) at the given coordinates, which is either 0 for white or 1 for black. The top + // (Public) Returns the color of the module (pixel) at the given coordinates, which is either 0 for white or 1 for black. The top // left corner has the coordinates (x=0, y=0). If the given coordinates are out of bounds, then 0 (white) is returned. this.getModule = function(x, y) { if (0 <= x && x < size && 0 <= y && y < size) @@ -820,7 +820,7 @@ var qrcodegen = new function() { // (Public) Can test whether a string is encodable in alphanumeric mode (such as by using QrSegment.makeAlphanumeric()). this.QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/; - // Maps shifted ASCII codes to alphanumeric mode character codes. + // (Private) Maps shifted ASCII codes to alphanumeric mode character codes. QrSegment.ALPHANUMERIC_ENCODING_TABLE = [ // SP, !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, ;, <, =, >, ?, @, // ASCII codes 32 to 64 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, -1, // Array indices 0 to 32 diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 81c445b..9c987c1 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -52,6 +52,7 @@ This module "qrcodegen", public members: - Method get_mode() -> QrSegment.Mode - Method get_num_chars() -> int - Method get_bits() -> list + - Constants regex NUMERIC_REGEX, ALPHANUMERIC_REGEX - Enum Mode: - Constants NUMERIC, ALPHANUMERIC, BYTE, KANJI """ @@ -581,7 +582,7 @@ class QrCode(object): """Represents the error correction level used in a QR Code symbol.""" # Private constructor def __init__(self, i, fb): - self.ordinal = i # In the range 0 to 3 (unsigned 2-bit integer) + self.ordinal = i # (Public) 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. @@ -702,10 +703,10 @@ class QrSegment(object): # ---- Constants ---- - # Can test whether a string is encodable in numeric mode (such as by using make_numeric()) + # (Public) Can test whether a string is encodable in numeric mode (such as by using make_numeric()) NUMERIC_REGEX = re.compile("[0-9]*$") - # Can test whether a string is encodable in alphanumeric mode (such as by using make_alphanumeric()) + # (Public) Can test whether a string is encodable in alphanumeric mode (such as by using make_alphanumeric()) ALPHANUMERIC_REGEX = re.compile("[A-Z0-9 $%*+./:-]*$") # (Private) Dictionary of "0"->0, "A"->10, "$"->37, etc.