Updated a few documentation comments.

This commit is contained in:
Project Nayuki 2017-08-31 20:21:32 +00:00
parent 272ca8bb54
commit 3d4d941da3
3 changed files with 6 additions and 4 deletions

View File

@ -82,8 +82,8 @@ public final class QrCode {
* Returns a QR Code symbol representing the specified data segments at the specified error correction
* level or higher. The smallest possible QR Code version is automatically chosen for the output.
* <p>This function allows the user to create a custom sequence of segments that switches
* between modes (such as alphanumeric and binary) to encode text more efficiently. This
* function is considered to be lower level than simply encoding text or binary data.</p>
* between modes (such as alphanumeric and binary) to encode text more efficiently.
* This function is considered to be lower level than simply encoding text or binary data.</p>
* @param segs the segments to encode
* @param ecl the error correction level to use (will be boosted)
* @return a QR Code representing the segments

View File

@ -206,6 +206,7 @@ var qrcodegen = new function() {
// Based on the given number of border modules to add as padding, this returns a
// string whose contents represents an SVG XML file that depicts this QR Code symbol.
// Note that Unix newlines (\n) are always used, regardless of the platform.
this.toSvgString = function(border) {
if (border < 0)
throw "Border must be non-negative";

View File

@ -598,7 +598,7 @@ impl QrCode {
/*---- Private static helper functions ----*/
// Returns a set of positions of the alignment patterns in ascending order. These positions are
// used on both the x and y axes. Each value in the resulting array is in the range [0, 177).
// used on both the x and y axes. Each value in the resulting list is in the range [0, 177).
// This stateless pure function could be implemented as table of 40 variable-length lists of unsigned bytes.
fn get_alignment_pattern_positions(ver: u8) -> Vec<i32> {
assert!(1 <= ver && ver <= 40, "Version number out of range");
@ -1013,7 +1013,8 @@ impl QrSegmentMode {
/*---- Bit buffer functionality ----*/
// Appends the given number of bits of the given value to this sequence.
// Appends the given number of low bits of the given value
// to this sequence. Requires 0 <= val < 2^len.
pub fn append_bits(bb: &mut Vec<bool>, val: u32, len: u8) {
assert!(len < 32 && (val >> len) == 0 || len == 32, "Value out of range");
for i in (0 .. len).rev() { // Append bit by bit