Added/updated/synchronized documentation comments for QrSegment's accessor methods, in all languages except C.

pull/39/merge
Project Nayuki 6 years ago
parent 139e67eee2
commit aa39108f0d

@ -172,12 +172,21 @@ class QrSegment final {
/*---- Methods ----*/ /*---- Methods ----*/
/*
* Returns the mode field of this segment.
*/
public: Mode getMode() const; public: Mode getMode() const;
/*
* Returns the character count field of this segment.
*/
public: int getNumChars() const; public: int getNumChars() const;
/*
* Returns the data bits of this segment.
*/
public: const std::vector<bool> &getData() const; public: const std::vector<bool> &getData() const;

@ -193,7 +193,7 @@ public final class QrSegment {
/*---- Methods ----*/ /*---- 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}) * @return the data bits of this segment (not {@code null})
*/ */
public BitBuffer getBits() { public BitBuffer getBits() {

@ -718,7 +718,7 @@ var qrcodegen = new function() {
// Always zero or positive. Not the same as the data's bit length. // Always zero or positive. Not the same as the data's bit length.
Object.defineProperty(this, "numChars", {value:numChars}); 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() { this.getBits = function() {
return bitData.slice(); // Make defensive copy return bitData.slice(); // Make defensive copy
}; };

@ -704,12 +704,15 @@ class QrSegment(object):
# ---- Accessor methods ---- # ---- Accessor methods ----
def get_mode(self): def get_mode(self):
"""Returns the mode field of this segment."""
return self._mode return self._mode
def get_num_chars(self): def get_num_chars(self):
"""Returns the character count field of this segment."""
return self._numchars return self._numchars
def get_bits(self): def get_bits(self):
"""Returns a new copy of the data bits of this segment."""
return list(self._bitdata) # Make defensive copy return list(self._bitdata) # Make defensive copy

@ -962,19 +962,19 @@ impl QrSegment {
/*---- Instance field getters ----*/ /*---- Instance field getters ----*/
// Returns the mode indicator for this segment. // Returns the mode indicator of this segment.
pub fn mode(&self) -> QrSegmentMode { pub fn mode(&self) -> QrSegmentMode {
self.mode 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 { pub fn num_chars(&self) -> usize {
self.numchars self.numchars
} }
// Returns a view of the bits of this segment. // Returns the data bits of this segment.
pub fn data(&self) -> &Vec<bool> { pub fn data(&self) -> &Vec<bool> {
&self.data &self.data
} }

@ -761,7 +761,7 @@ namespace qrcodegen {
/*-- Methods --*/ /*-- 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<bit> { public getBits(): Array<bit> {
return this.bitData.slice(); // Make defensive copy return this.bitData.slice(); // Make defensive copy
} }

Loading…
Cancel
Save