From aa39108f0dfd10ad1ee9f49e94d6b38e3c8e3203 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 5 Oct 2018 19:30:21 +0000 Subject: [PATCH] Added/updated/synchronized documentation comments for QrSegment's accessor methods, in all languages except C. --- cpp/QrSegment.hpp | 9 +++++++++ java/io/nayuki/qrcodegen/QrSegment.java | 2 +- javascript/qrcodegen.js | 2 +- python/qrcodegen.py | 3 +++ rust/src/lib.rs | 6 +++--- typescript/qrcodegen.ts | 2 +- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index 47c41b0..565778f 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -172,12 +172,21 @@ class QrSegment final { /*---- Methods ----*/ + /* + * Returns the mode field of this segment. + */ public: Mode getMode() const; + /* + * Returns the character count field of this segment. + */ public: int getNumChars() const; + /* + * Returns the data bits of this segment. + */ public: const std::vector &getData() const; diff --git a/java/io/nayuki/qrcodegen/QrSegment.java b/java/io/nayuki/qrcodegen/QrSegment.java index 605ab71..74dbc1b 100644 --- a/java/io/nayuki/qrcodegen/QrSegment.java +++ b/java/io/nayuki/qrcodegen/QrSegment.java @@ -193,7 +193,7 @@ public final class QrSegment { /*---- Methods ----*/ /** - * Returns a copy of the data bits of this segment. + * Returns the data bits of this segment. * @return the data bits of this segment (not {@code null}) */ public BitBuffer getBits() { diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index f54d9a4..7579698 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -718,7 +718,7 @@ var qrcodegen = new function() { // 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. + // Returns a new copy of the data bits of this segment. this.getBits = function() { return bitData.slice(); // Make defensive copy }; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 8a9fc37..4a6c14c 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -704,12 +704,15 @@ class QrSegment(object): # ---- Accessor methods ---- def get_mode(self): + """Returns the mode field of this segment.""" return self._mode def get_num_chars(self): + """Returns the character count field of this segment.""" return self._numchars def get_bits(self): + """Returns a new copy of the data bits of this segment.""" return list(self._bitdata) # Make defensive copy diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 33c73c2..8e3ea1e 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -962,19 +962,19 @@ impl QrSegment { /*---- Instance field getters ----*/ - // Returns the mode indicator for this segment. + // Returns the mode indicator of this segment. pub fn mode(&self) -> QrSegmentMode { self.mode } - // Returns the length of this segment's unencoded data, measured in characters. + // Returns the character count field of this segment. pub fn num_chars(&self) -> usize { self.numchars } - // Returns a view of the bits of this segment. + // Returns the data bits of this segment. pub fn data(&self) -> &Vec { &self.data } diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index b831050..aa31b85 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -761,7 +761,7 @@ namespace qrcodegen { /*-- Methods --*/ - // Returns a copy of all bits, which is an array of 0s and 1s. + // Returns a new copy of the data bits of this segment. public getBits(): Array { return this.bitData.slice(); // Make defensive copy }